Triple
- class Triple(*, subject: Reference, predicate: Reference, object: Reference)[source]
Bases:
BaseModelA Pydantic model for a subject-predicate-object triple.
Triples can be constructed either from strings representing CURIEs or pre-parsed
Referenceobjects representing CURIEs.from curies import Triple, Reference # construction with string representations of CURIEs triple = Triple( subject="mesh:C000089", predicate="skos:exactMatch", object="CHEBI:28646", ) # construction with object representations of CURIEs triple = Triple( subject=Reference(prefix="mesh", identifier="C000089"), predicate=Reference(prefix="skos", identifier="exactMatch"), object=Reference(prefix="CHEBI", identifier="28646"), )
Note
It’s up to you to validate your CURIEs are semantically sound, e.g., against the
bioregistry.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
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Summary
Get a three-tuple of strings representing this triple.
as_uri_triple(converter)Get a three-tuple of strings representing the expanded URIs.
from_curies(subject_curie, predicate_curie, ...)Construct a triple from three CURIE strings.
from_uris(subject, predicate, object, *, ...)Construct a triple from three URI strings.
Attributes Documentation
- model_config = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Documentation
- as_uri_triple(converter: Converter) tuple[str, str, str][source]
Get a three-tuple of strings representing the expanded URIs.