API Reference

Idiomatic conversion between URIs and compact URIs (CURIEs).

Functions

chain(converters, *[, case_sensitive])

Chain several converters.

discover(uris, *[, delimiters, cutoff, ...])

Discover new URI prefixes and construct a converter with a unique dummy CURIE prefix for each.

discover_from_rdf(graph, *[, format])

Discover new URI prefixes from RDF content via rdflib.

get_bioregistry_converter([web])

Get the latest extended prefix map from the Bioregistry [hoyt2022].

get_go_converter()

Get the Prefix Commons-maintained GO context.

get_monarch_converter()

Get the Prefix Commons-maintained Monarch context.

get_obo_converter()

Get the latest OBO Foundry context.

get_prefixcommons_converter([name])

Get a Prefix Commons-maintained context.

get_version()

Get the curies version string.

load_extended_prefix_map(records, **kwargs)

Get a converter from a list of dictionaries by creating records out of them.

load_jsonld_context(data, **kwargs)

Get a converter from a JSON-LD object, which contains a prefix map in its @context key.

load_prefix_map(prefix_map, **kwargs)

Get a converter from a simple prefix map.

load_shacl(data, **kwargs)

Get a converter from a JSON-LD object, which contains a prefix map in its @context key.

remap_curie_prefixes(converter, remapping)

Apply CURIE prefix remappings.

remap_uri_prefixes(converter, remapping)

Apply URI prefix remappings.

rewire(converter, rewiring)

Apply URI prefix upgrades.

upgrade_prefix_map(prefix_map)

Convert a (potentially problematic) prefix map (i.e., not bijective) into a list of records.

write_extended_prefix_map(converter, path)

Write an extended prefix map as JSON to a file.

write_jsonld_context(converter, path, *[, ...])

Write the converter's bijective map as a JSON-LD context to a file.

write_shacl(converter, path, *[, ...])

Write the converter's bijective map as SHACL in turtle RDF to a file.

write_tsv(converter, path, *[, header])

Write a simple prefix map CSV file.

Classes

Converter(records, *[, delimiter, strict])

A cached prefix map data structure.

DuplicatePrefixes(duplicates)

An error raised with constructing a converter with data containing duplicate prefixes.

DuplicateURIPrefixes(duplicates)

An error raised with constructing a converter with data containing duplicate URI prefixes.

DuplicateValueError(duplicates)

An error raised with constructing a converter with data containing duplicate values.

NamableReference(*, prefix, identifier[, name])

A reference, maybe with a name.

NamedReference(*, prefix, identifier, name)

A reference with a name.

Prefix

A string that is validated by Pydantic as a CURIE prefix.

PrefixMap([root])

A simple prefix map.

PreprocessingBlocklists(*, full, ...)

A model for prefix and full blocklists.

PreprocessingConverter(*args, rules[, ...])

A converter with pre-processing rules.

PreprocessingRewrites(*, full, str] =, ...)

A model for prefix and full rewrites.

PreprocessingRules(*, blocklists, rewrites)

A model for blocklists and rewrites.

Record(*, prefix, uri_prefix, ...)

A record of some prefixes and their associated URI prefixes.

Records([root])

A list of records.

Reference(*, prefix, identifier)

A reference to an entity in a given identifier space.

ReferenceTuple(prefix, identifier)

A pair of a prefix (corresponding to a semantic space) and a local unique identifier in that semantic space.

Triple(*, subject, predicate, object)

A model for a triple of subject-predicate-object triple.

Class Inheritance Diagram

digraph inheritance1dccc342d4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseModel" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="!!! abstract \"Usage Documentation\""]; "Converter" [URL="api/curies.Converter.html#curies.Converter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A cached prefix map data structure."]; "DuplicatePrefixes" [URL="api/curies.DuplicatePrefixes.html#curies.DuplicatePrefixes",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error raised with constructing a converter with data containing duplicate prefixes."]; "DuplicateValueError" -> "DuplicatePrefixes" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DuplicateURIPrefixes" [URL="api/curies.DuplicateURIPrefixes.html#curies.DuplicateURIPrefixes",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error raised with constructing a converter with data containing duplicate URI prefixes."]; "DuplicateValueError" -> "DuplicateURIPrefixes" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DuplicateValueError" [URL="api/curies.DuplicateValueError.html#curies.DuplicateValueError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error raised with constructing a converter with data containing duplicate values."]; "Generic" [URL="https://docs.python.org/3/library/typing.html#typing.Generic",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for generic types."]; "NamableReference" [URL="api/curies.NamableReference.html#curies.NamableReference",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A reference, maybe with a name."]; "Reference" -> "NamableReference" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NamedReference" [URL="api/curies.NamedReference.html#curies.NamedReference",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A reference with a name."]; "NamableReference" -> "NamedReference" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Prefix" [URL="api/curies.Prefix.html#curies.Prefix",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A string that is validated by Pydantic as a CURIE prefix."]; "PrefixMap" [URL="api/curies.PrefixMap.html#curies.PrefixMap",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A simple prefix map."]; "RootModel[dict[Prefix, str]]" -> "PrefixMap" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PreprocessingBlocklists" [URL="api/curies.PreprocessingBlocklists.html#curies.PreprocessingBlocklists",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A model for prefix and full blocklists."]; "BaseModel" -> "PreprocessingBlocklists" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PreprocessingConverter" [URL="api/curies.PreprocessingConverter.html#curies.PreprocessingConverter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A converter with pre-processing rules."]; "Converter" -> "PreprocessingConverter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PreprocessingRewrites" [URL="api/curies.PreprocessingRewrites.html#curies.PreprocessingRewrites",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A model for prefix and full rewrites."]; "BaseModel" -> "PreprocessingRewrites" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PreprocessingRules" [URL="api/curies.PreprocessingRules.html#curies.PreprocessingRules",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A model for blocklists and rewrites."]; "BaseModel" -> "PreprocessingRules" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Record" [URL="api/curies.Record.html#curies.Record",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A record of some prefixes and their associated URI prefixes."]; "BaseModel" -> "Record" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Records" [URL="api/curies.Records.html#curies.Records",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A list of records."]; "RootModel[list[Record]]" -> "Records" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Reference" [URL="api/curies.Reference.html#curies.Reference",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A reference to an entity in a given identifier space."]; "BaseModel" -> "Reference" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ReferenceTuple" [URL="api/curies.ReferenceTuple.html#curies.ReferenceTuple",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A pair of a prefix (corresponding to a semantic space) and a local unique identifier in that semantic space."]; "RootModel" [URL="https://docs.pydantic.dev/latest/api/root_model/#pydantic.root_model.RootModel",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="!!! abstract \"Usage Documentation\""]; "BaseModel" -> "RootModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Generic" -> "RootModel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RootModel[dict[Prefix, str]]" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "RootModel" -> "RootModel[dict[Prefix, str]]" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RootModel[list[Record]]" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "RootModel" -> "RootModel[list[Record]]" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Triple" [URL="api/curies.Triple.html#curies.Triple",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A model for a triple of subject-predicate-object triple."]; "BaseModel" -> "Triple" [arrowsize=0.5,style="setlinewidth(0.5)"]; }