get_uri_format

get_uri_format(prefix: str, priority: Sequence[str] | None = None) str | None[source]

Get the URI format string for the given prefix, if it’s available.

Parameters:
  • prefix – The name of the prefix (possibly unnormalized)

  • priority

    The priority order of metaresources to use for URI format string lookup. The default is:

    1. Default first party (from the Bioregistry, BioContext, or MIRIAM)

    2. OBO Foundry

    3. BioContext

    4. MIRIAM/Identifiers.org

    5. N2T

    6. OLS

    7. Prefix Commons

Returns:

The best URI format string, where the $1 should be replaced by the identifier. $1 could potentially appear multiple times.

>>> import bioregistry
>>> bioregistry.get_uri_format('chebi')
'http://purl.obolibrary.org/obo/CHEBI_$1'

If you want to specify a different priority order, you can do so with the priority keyword. This is of particular interest to ontologists and semantic web people who might want to use purl.obolibrary.org URI prefixes over the URI prefixes corresponding to the first-party providers for each resource (e.g., the ChEBI example above). Do so like:

>>> import bioregistry
>>> bioregistry.get_uri_format('chebi', priority=['obofoundry', 'bioregistry', 'biocontext', 'miriam', 'ols'])
'http://purl.obolibrary.org/obo/CHEBI_$1'