Constants¶
Constants, enums, and schema helpers used across sssom-py.
sssom.constants
¶
Constants.
SEMAPV
¶
Bases: Enum
SEMAPV Enum containing different mapping_justification.
See also: https://mapping-commons.github.io/semantic-mapping-vocabulary/#matchingprocess
Source code in src/sssom/constants.py
SchemaValidationType
¶
Bases: str, Enum
Schema validation types.
Source code in src/sssom/constants.py
NewEnumValue
dataclass
¶
Bases: object
Represents a enum value that had been added posteriorly to 1.0.
Ideally that information should be encoded in the LinkML schema and made available through the SSSOMSchemaView class below, but it does not seem possible to annotate enum values in LinkML the way it can be done for slots. So the information comes from the spec instead, at https://mapping-commons.github.io/sssom/spec-model/#model-changes-across-versions.
Source code in src/sssom/constants.py
SSSOMSchemaView
¶
Bases: object
SchemaView class from linkml which is instantiated when necessary.
Reason for this: https://github.com/mapping-commons/sssom-py/issues/322 Implemented via PR: https://github.com/mapping-commons/sssom-py/pull/323
Source code in src/sssom/constants.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
view
cached
property
¶
Return SchemaView object.
dict
cached
property
¶
Return SchemaView as a dictionary.
mapping_slots
cached
property
¶
Return list of mapping slots.
mapping_set_slots
cached
property
¶
Return list of mapping set slots.
multivalued_slots
cached
property
¶
Return set of multivalued slots.
entity_reference_slots
cached
property
¶
Return set of entity reference slots.
mapping_enum_keys
cached
property
¶
Return a set of mapping enum keys.
slots
cached
property
¶
Return the slots for SSSOMSchemaView object.
double_slots
cached
property
¶
Return the slot names for SSSOMSchemaView object.
propagatable_slots
cached
property
¶
Return the names of all propagatable slots.
__new__()
¶
Create a instance of the SSSOM schema view if non-existent.
get_new_enum_values(after=(1, 0))
¶
Get enum values introduced after a given version of the specification.
:param after: The target version of the SSSOM specification, as a (major, minor) tuple. The default is (1,0), meaning all enum values introduced in any version after 1.0 will be returned. :return: The list of newly introduced enum values.
Source code in src/sssom/constants.py
get_minimum_version(slot_name, class_name='mapping')
¶
Get the minimum version of SSSOM required for a given slot.
:param slot_name: The queried slot. :param class_name: The class the slot belongs to. This is needed because a slot may have been added to a class in a later version than the version in which it was first introduced in the schema. :return: A tuple containing the major and minor numbers of the earliest version of SSSOM that defines the given slot in the given class. May be None if the requested slot name is not a valid slot name.
Source code in src/sssom/constants.py
parse_sssom_version(version)
¶
Parse a string into a valid SSSOM version number.
:param version: The string to parse into a version number. :return: A (major, minor) tuple.
Source code in src/sssom/constants.py
generate_mapping_set_id()
¶
get_default_metadata()
¶
Get default metadata.
:returns: A metadata dictionary containing a default license with value :data:DEFAULT_LICENSE
and an auto-generated mapping set ID
If you want to combine some metadata you loaded but ensure that there is also default metadata,
the best tool is :class:collections.ChainMap. You can do:
.. code-block:: python
my_metadata: dict | None = ...
from collections import ChainMap
from sssom import get_default_metadata
metadata = dict(ChainMap(my_metadata or {}, get_default_metadata()))