load_prefix_map

load_prefix_map(prefix_map: str | Path | Mapping[str, str], **kwargs: Any) Converter[source]

Get a converter from a simple prefix map.

Parameters:
  • prefix_map

    One of the following:

    • A mapping whose keys represent CURIE prefixes and values represent URI prefixes

    • A string containing a remote location of a JSON file containg a prefix map

    • A string or pathlib.Path object corresponding to a local file path to a JSON file containing a prefix map

  • kwargs – Keyword arguments to pass to curies.Converter.__init__()

Returns:

A converter

>>> import curies
>>> converter = curies.load_prefix_map(
...     {
...         "CHEBI": "http://purl.obolibrary.org/obo/CHEBI_",
...     }
... )
>>> converter.expand("CHEBI:138488")
'http://purl.obolibrary.org/obo/CHEBI_138488'
>>> converter.compress("http://purl.obolibrary.org/obo/CHEBI_138488")
'CHEBI:138488'