NamedReference

class NamedReference(*, prefix: Prefix, identifier: str, name: str)[source]

Bases: Reference

A reference 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

model_config

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.

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, *, sep: str = ':', converter: Converter | None = None) NamedReference[source]

Parse a CURIE string and populate a reference.

Parameters:
  • curie – A string representation of a compact URI (CURIE)

  • name – The name of the reference

  • sep – The separator

  • converter – The converter to use as context when parsing

Returns:

A reference object

>>> NamedReference.from_curie("chebi:1234", "6-methoxy-2-octaprenyl-1,4-benzoquinone")
NamedReference(prefix='chebi', identifier='1234', name='6-methoxy-2-octaprenyl-1,4-benzoquinone')