NamableReference
- class NamableReference(*, prefix: Prefix, identifier: str, name: str | None = None)[source]
Bases:
Reference
A reference, maybe with a name.
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
from_curie
(curie[, name, sep, converter])Parse a CURIE string and populate a reference.
from_reference
(reference, *[, converter])Parse a CURIE string and populate a reference.
Attributes Documentation
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Methods Documentation
- classmethod from_curie(curie: str, name: str | None = None, *, sep: str = ':', converter: Converter | None = None) Self [source]
Parse a CURIE string and populate a reference.
- Parameters:
curie – A string representation of a compact URI (CURIE)
name – The optional name of the reference
sep – The separator
converter – The converter to use as context when parsing
- Returns:
A reference object
>>> NamableReference.from_curie("chebi:1234") NamableReference(prefix='chebi', identifier='1234', name=None)
>>> NamableReference.from_curie("chebi:1234", "6-methoxy-2-octaprenyl-1,4-benzoquinone") NamableReference(prefix='chebi', identifier='1234', name='6-methoxy-2-octaprenyl-1,4-benzoquinone')