curie_from_iri

curie_from_iri(iri: str, *, prefix_map=None, use_preferred: bool = False) str | None[source]

Generate a CURIE from an IRI via Manager.compress().

Parameters:
  • iri – A valid IRI

  • prefix_map – This functionality was removed in Bioregistry v0.8.0. Leave this as None. This argument will be removed in Bioregistry v0.9.0.

  • use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.

Returns:

A CURIE string, if the IRI can be parsed.

Raises:

NotImplementedError – If prefix_map is not None.