Collection

class Collection(*, identifier: str, name: str, description: Annotated[str, MinLen(min_length=30)], resources: Annotated[list[str | CollectionAnnotation], MinLen(min_length=1)], contributors: Annotated[list[Attributable], MinLen(min_length=1)], maintainers: Annotated[list[Author] | None, MinLen(min_length=1)] = None, logo: str | None = None, organizations: Annotated[list[Organization] | None, MinLen(min_length=1)] = None, context: str | None = None, references: list[str] | None = None, keywords: list[str] | None = None, mappings: list[Reference] | 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.

get_annotated_prefixes()

Get annotated prefixes.

get_prefixes()

Get prefixes.

has_organization(reference)

Check if there is an organization with a given ROR.

has_organization_with_ror(ror)

Check if there is an organization with a given ROR.

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.

get_annotated_prefixes() list[CollectionAnnotation][source]

Get annotated prefixes.

get_prefixes() list[str][source]

Get prefixes.

has_organization(reference: Reference) bool[source]

Check if there is an organization with a given ROR.

has_organization_with_ror(ror: str) bool[source]

Check if there is an organization with a given ROR.