curie_from_iri
- curie_from_iri(iri, *, prefix_map=None, use_preferred=False)[source]
Parse a compact identifier from an IRI using
parse_iri()
and reconstitute it.- Parameters
- Return type
- Returns
A CURIE string, if the IRI can be parsed by
parse_iri()
.
IRI from an OBO PURL:
>>> curie_from_iri("http://purl.obolibrary.org/obo/DRON_00023232") 'dron:00023232'
IRI from the OLS:
>>> curie_from_iri("https://www.ebi.ac.uk/ols/ontologies/ecao/terms?iri=http://purl.obolibrary.org/obo/ECAO_1") 'ecao:1'
IRI from native provider
>>> curie_from_iri("https://www.alzforum.org/mutations/1234") 'alzforum.mutation:1234'
Dog food:
>>> curie_from_iri("https://bioregistry.io/DRON:00023232") 'dron:00023232'
IRIs from Identifiers.org (https and http, colon and slash):
>>> curie_from_iri("https://identifiers.org/aop.relationships:5") 'aop.relationships:5' >>> curie_from_iri("http://identifiers.org/aop.relationships:5") 'aop.relationships:5' >>> curie_from_iri("https://identifiers.org/aop.relationships/5") 'aop.relationships:5' >>> curie_from_iri("http://identifiers.org/aop.relationships/5") 'aop.relationships:5'
IRI from N2T >>> curie_from_iri(”https://n2t.net/aop.relationships:5”) ‘aop.relationships:5’
IRI from an OBO PURL (with preferred prefix) >>> curie_from_iri(”http://purl.obolibrary.org/obo/DRON_00023232”, use_preferred=True) ‘DRON:00023232’