Collection

pydantic model Collection[source]

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.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

Show JSON schema
{
   "title": "Collection",
   "description": "A collection of resources.",
   "type": "object",
   "properties": {
      "identifier": {
         "description": "The collection's identifier",
         "title": "Identifier",
         "type": "string"
      },
      "name": {
         "description": "The name of the collection",
         "title": "Name",
         "type": "string"
      },
      "description": {
         "description": "A description of the collection",
         "title": "Description",
         "type": "string"
      },
      "resources": {
         "description": "A list of prefixes of resources appearing in the collection",
         "items": {
            "type": "string"
         },
         "title": "Resources",
         "type": "array"
      },
      "authors": {
         "description": "A list of authors/contributors to the collection",
         "items": {
            "$ref": "#/$defs/Author"
         },
         "title": "Authors",
         "type": "array"
      },
      "context": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The JSON-LD context's name",
         "title": "Context"
      },
      "references": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "URL references",
         "title": "References"
      }
   },
   "$defs": {
      "Author": {
         "description": "Metadata for an author.",
         "properties": {
            "name": {
               "description": "The full name of the researcher",
               "title": "Name",
               "type": "string"
            },
            "orcid": {
               "description": "The Open Researcher and Contributor Identifier (ORCiD) provides researchers with an open, unambiguous identifier for connecting various digital assets (e.g., publications, reviews) across the semantic web. An account can be made in seconds at https://orcid.org.",
               "title": "Open Researcher and Contributor Identifier",
               "type": "string"
            },
            "email": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The email address specific to the researcher.",
               "title": "Email address"
            },
            "github": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The GitHub handle enables contacting the researcher on GitHub: the *de facto* version control in the computer sciences and life sciences.",
               "title": "GitHub handle"
            }
         },
         "required": [
            "name",
            "orcid"
         ],
         "title": "Author",
         "type": "object"
      }
   },
   "required": [
      "identifier",
      "name",
      "description",
      "resources",
      "authors"
   ]
}

Fields:
field authors: List[Author] [Required]

A list of authors/contributors to the collection

field context: str | None = None

The JSON-LD context’s name

field description: str [Required]

A description of the collection

field identifier: str [Required]

The collection’s identifier

field name: str [Required]

The name of the collection

field references: List[str] | None = None

URL references

field resources: List[str] [Required]

A list of prefixes of resources appearing in the collection

add_triples(graph)[source]

Add triples to an RDF graph for this collection.

Parameters:

graph (rdflib.Graph) – An RDF graph

Return type:

rdflib.term.Node

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.