Collection

class Collection(*, identifier: str, name: str, description: Annotated[str, MinLen(min_length=30)], resources: Annotated[list[str], MinLen(min_length=1)], authors: Annotated[list[Author], MinLen(min_length=1)], organizations: Annotated[list[Organization] | None, MinLen(min_length=1)] = None, context: str | None = None, references: list[str] | None = None)[source]

Bases: BaseModel

A collection of resources.

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

add_triples(graph)

Add triples to an RDF graph for this collection.

as_context_jsonld()

Get the JSON-LD context from a given collection.

as_context_jsonld_str()

Get the JSON-LD context as a string from a given collection.

as_prefix_map()

Get the prefix map for a given collection.

Attributes Documentation

model_config = {}

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

Methods Documentation

add_triples(graph: rdflib.Graph) None[source]

Add triples to an RDF graph for this collection.

Parameters:

graph – An RDF graph

Returns:

The RDF node representing this collection using a Bioregistry IRI.

as_context_jsonld() Mapping[str, Mapping[str, str]][source]

Get the JSON-LD context from a given collection.

as_context_jsonld_str() str[source]

Get the JSON-LD context as a string from a given collection.

as_prefix_map() Mapping[str, str][source]

Get the prefix map for a given collection.