SemanticMapping

class SemanticMapping(*, subject: Annotated[NamableReference, BeforeValidator(func=_ensure_namable, json_schema_input_type=PydanticUndefined)], predicate: Annotated[NamableReference, BeforeValidator(func=_ensure_namable, json_schema_input_type=PydanticUndefined)], object: Annotated[NamableReference, BeforeValidator(func=_ensure_namable, json_schema_input_type=PydanticUndefined)], justification: Reference, predicate_modifier: Literal['Not'] | None = None, record: Reference | None = None, authors: list[Reference] | None = None, confidence: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, mapping_tool: MappingTool | None = None, license: str | None = None, subject_category: Reference | None = None, subject_match_field: list[Reference] | None = None, subject_preprocessing: list[Reference] | None = None, subject_source: Reference | None = None, subject_source_version: str | None = None, subject_type: Reference | None = None, predicate_type: Reference | None = None, object_category: Reference | None = None, object_match_field: list[Reference] | None = None, object_preprocessing: list[Reference] | None = None, object_source: Reference | None = None, object_source_version: str | None = None, object_type: Reference | None = None, creators: list[Reference] | None = None, reviewers: list[Reference] | None = None, publication_date: date | None = None, mapping_date: date | None = None, review_date: date | None = None, reviewer_agreement: Annotated[float | None, Ge(ge=-1.0), Le(le=1.0)] = None, comment: str | None = None, curation_rule: list[Reference] | None = None, curation_rule_text: list[str] | None = None, issue_tracker_item: Reference | None = None, cardinality: Literal['1:1', '1:n', 'n:1', '1:0', '0:1', 'n:n', '0:0'] | None = None, cardinality_scope: list[str] | None = None, provider: AnyUrl | None = None, source: Reference | None = None, match_string: list[str] | None = None, other: dict[str, str] | None = None, derived_from: list[Reference] | None = None, see_also: list[str] | None = None, similarity_measure: str | None = None, similarity_score: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None)[source]

Bases: Triple, SemanticallyStandardizable

Represents most fields for SSSOM.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes Summary

author

Get the single author or raise a value error.

mapping_tool_name

Get the mapping tool label, if available.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

negated

Check if the mapping record is negated.

object_name

Get the object label, if available.

predicate_name

Get the predicate label, if available.

subject_name

Get the subject label, if available.

Methods Summary

exact(subject, object, *[, justification])

Construct a skos:exactMatch mapping from a subject-object pair.

from_triple(subject, predicate, object, *[, ...])

Construct a semantic mapping from a subject-predicate-object triple.

get_prefixes()

Get prefixes used in this mapping.

negate()

Return the negated version of this mapping.

standardize(converter)

Standardize.

to_record()

Get a record.

Attributes Documentation

author

Get the single author or raise a value error.

mapping_tool_name

Get the mapping tool label, if available.

model_config = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

negated

Check if the mapping record is negated.

object_name

Get the object label, if available.

predicate_name

Get the predicate label, if available.

subject_name

Get the subject label, if available.

Methods Documentation

classmethod exact(subject: str | Reference, object: str | Reference, *, justification: str | Reference | None = None, **kwargs: Any) Self[source]

Construct a skos:exactMatch mapping from a subject-object pair.

Parameters:
  • subject – The subject of the mapping triple.

  • object – The object of the mapping triple.

  • justification – The justification of the mapping triple. Defaults to curies.vocabulary.unspecified_matching_process

  • kwargs – Additional fields to pass to the constructor

Returns:

A semantic mapping

>>> from curies import Reference
>>> from sssom_pydantic import SemanticMapping
>>> c1, c2, c3 = "DOID:0050577", "mesh:C562966", "umls:C4551571"
>>> r1, r2, r3 = (Reference.from_curie(c) for c in (c1, c2, c3))
>>> m1 = SemanticMapping.exact(r1, r2)
>>> m2 = SemanticMapping.exact(r2, r3)
>>> m3 = SemanticMapping.exact(r1, r3)
classmethod from_triple(subject: str | Reference, predicate: str | Reference, object: str | Reference, *, justification: str | Reference | None = None, **kwargs: Any) Self[source]

Construct a semantic mapping from a subject-predicate-object triple.

Parameters:
  • subject – The subject of the mapping triple.

  • predicate – The predicate of the mapping triple.

  • object – The object of the mapping triple.

  • justification – The justification of the mapping triple. Defaults to curies.vocabulary.unspecified_matching_process

  • kwargs – Additional fields to pass to the constructor

Returns:

A semantic mapping

>>> from curies import Reference
>>> from curies.vocabulary import exact_match
>>> from sssom_pydantic import SemanticMapping
>>> c1, c2, c3 = "DOID:0050577", "mesh:C562966", "umls:C4551571"
>>> r1, r2, r3 = (Reference.from_curie(c) for c in (c1, c2, c3))
>>> m1 = SemanticMapping.from_triple(r1, exact_match, r2)
>>> m2 = SemanticMapping.from_triple(r2, exact_match, r3)
>>> m3 = SemanticMapping.from_triple(r1, exact_match, r3)
get_prefixes() set[str][source]

Get prefixes used in this mapping.

negate() Self[source]

Return the negated version of this mapping.

standardize(converter: Converter) Self[source]

Standardize.

to_record() Record[source]

Get a record.