LiteralMapping

class LiteralMapping(*, reference: R, predicate: Reference = NamedReference(prefix='oboInOwl', identifier='hasRelatedSynonym', name='has related synonym'), text: str, language: LanguageAlpha2 | None = None, type: Reference | None = None, provenance: list[Reference] = <factory>, contributor: Reference | None = None, comment: str | None = None, source: str | None = None, date: date | None = None, taxon: Reference | None = None)[source]

Bases: BaseModel, Generic[R]

A data model for literal mappings.

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

curie

Get the reference's CURIE.

date_str

Get the date as a string.

model_config

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

name

Get the reference's (optional) name.

Methods Summary

from_gilda(-> ~ssslm.model.LiteralMapping)

Construct a synonym from a gilda term.

from_row(-> ~ssslm.model.LiteralMapping)

Parse a dictionary representing a row in a TSV.

get_all_references()

Get all references made by this object.

to_gilda()

Get this synonym as a gilda term.

Attributes Documentation

curie

Get the reference’s CURIE.

date_str

Get the date as a string.

model_config = {}

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

name

Get the reference’s (optional) name.

Methods Documentation

classmethod from_gilda(term: gilda.Term, *, reference_cls: type[R] = None) LiteralMapping[source]
classmethod from_gilda(term: gilda.Term, *, reference_cls: None = None) LiteralMapping[NamableReference]

Construct a synonym from a gilda term.

Parameters:
  • term – A Gilda term

  • reference_cls – the class to use to instantiate references

Returns:

A literal mapping object

Warning

Gilda’s data model is less detailed, so resulting synonym objects will not have detailed curation provenance

classmethod from_row(row: dict[str, Any], *, names: Mapping[Reference, str] | None = None, reference_cls: type[R] = None) LiteralMapping[source]
classmethod from_row(row: dict[str, Any], *, names: Mapping[Reference, str] | None = None, reference_cls: None = None) LiteralMapping[NamableReference]

Parse a dictionary representing a row in a TSV.

get_all_references() set[Reference][source]

Get all references made by this object.

to_gilda() gilda.Term[source]

Get this synonym as a gilda term.

Returns:

An object that can be indexed by Gilda for NER and grounding