Collection

pydantic model Collection[source]

A collection of resources.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Show JSON schema
{
   "title": "Collection",
   "description": "A collection of resources.",
   "type": "object",
   "properties": {
      "identifier": {
         "title": "Identifier",
         "description": "The collection's identifier",
         "pattern": "^\\d{7}$",
         "type": "string"
      },
      "name": {
         "title": "Name",
         "description": "The name of the collection",
         "type": "string"
      },
      "description": {
         "title": "Description",
         "description": "A description of the collection",
         "type": "string"
      },
      "resources": {
         "title": "Resources",
         "description": "A list of prefixes of resources appearing in the collection",
         "type": "array",
         "items": {
            "type": "string"
         }
      },
      "authors": {
         "title": "Authors",
         "description": "A list of authors/contributors to the collection",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Author"
         }
      },
      "context": {
         "title": "Context",
         "type": "string"
      }
   },
   "required": [
      "identifier",
      "name",
      "description",
      "resources",
      "authors"
   ],
   "definitions": {
      "Author": {
         "title": "Author",
         "description": "Metadata for an author.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "description": "The full name of the researcher",
               "type": "string"
            },
            "orcid": {
               "title": "Open Researcher and Contributor Identifier",
               "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.",
               "type": "string"
            },
            "email": {
               "title": "Email address",
               "description": "The email address specific to the researcher.",
               "type": "string"
            },
            "github": {
               "title": "GitHub handle",
               "description": "The GitHub handle enables contacting the researcher on GitHub: the *de facto* version control in the computer sciences and life sciences.",
               "type": "string"
            }
         },
         "required": [
            "name",
            "orcid"
         ]
      }
   }
}

Fields
field authors: List[Author] [Required]

A list of authors/contributors to the collection

field context: Optional[str] = None

JSON-LD context name

field description: str [Required]

A description of the collection

field identifier: str [Required]

The collection’s identifier

Constraints
  • pattern = ^d{7}$

field name: str [Required]

The name of the collection

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()[source]

Get the JSON-LD context from a given collection.

Return type

Mapping[str, Mapping[str, str]]

as_context_jsonld_str()[source]

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

Return type

str

as_prefix_map()[source]

Get the prefix map for a given collection.

Return type

Mapping[str, str]