Mapping

class Mapping(*, subject: ~bioregistry.reference.NormalizedNamableReference, predicate: ~bioregistry.reference.NormalizedNamableReference, object: ~bioregistry.reference.NormalizedNamableReference, evidence: list[~typing.Annotated[~semra.struct.ReasonedEvidence | ~semra.struct.SimpleEvidence, FieldInfo(annotation=NoneType, required=True, discriminator='evidence_type')]] = <factory>)[source]

Bases: Triple, ConfidenceMixin, KeyedMixin[(), StrTriple]

A semantic mapping.

This builds on the basic concept of a subject-predicate-object triple, where the predicate is a semantic predicate, such as those listed in the SSSOM specification.

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

has_primary

Get if there is a primary evidence associated with this mapping.

has_secondary

Get if there is a secondary evidence associated with this mapping.

has_tertiary

Get if there are any tertiary (i.e., reasoned) evidences for this mapping.

model_config

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

triple

Get the mapping's core triple as a tuple.

Methods Summary

from_triple(triple[, evidence])

Instantiate a mapping from a triple.

get_confidence()

Aggregate the mapping's evidences' confidences in a binomial model.

key()

Get a hashable key for the mapping, based on the subject, predicate, and object.

Attributes Documentation

has_primary

Get if there is a primary evidence associated with this mapping.

has_secondary

Get if there is a secondary evidence associated with this mapping.

has_tertiary

Get if there are any tertiary (i.e., reasoned) evidences for this mapping.

model_config: ClassVar[ConfigDict] = {'frozen': True}

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

triple

Get the mapping’s core triple as a tuple.

Methods Documentation

classmethod from_triple(triple: Triple | tuple[NormalizedNamableReference, NormalizedNamableReference, NormalizedNamableReference], evidence: list[Annotated[ReasonedEvidence | SimpleEvidence, FieldInfo(annotation=NoneType, required=True, discriminator='evidence_type')]] | None = None) Mapping[source]

Instantiate a mapping from a triple.

get_confidence() float[source]

Aggregate the mapping’s evidences’ confidences in a binomial model.

key() StrTriple[source]

Get a hashable key for the mapping, based on the subject, predicate, and object.