The Converter.expand function turns a CURIE into a URI. This PR implements Converter.expand_or_standardize, which works like the normal Converter.expand, but if a URI is given, then it standardizes it and returns it. The other mechanics for "strict" and "passthrough" work the same.
This PR also implements Converter.compress_or_standardize as a counterpart for Converter.compress
Demo
The expansion and compression demos use a very simple extended prefix map:
from curies import Converter, Record
converter = Converter.from_extended_prefix_map([
Record(
prefix="CHEBI",
prefix_synonyms=["chebi"],
uri_prefix="http://purl.obolibrary.org/obo/CHEBI_",
uri_prefix_synonyms=["https://identifiers.org/chebi:"],
),
])
Projects like LinkML that do not often make distinctions between URIs and CURIEs being in the same field would be able to use this functionality nicely
Data science workflows that have started relying on "passthrough=True" could better use these updated functions to be more careful about keeping content that is valid w.r.t. the prefix map and also standardized.
TODO
[x] I am looking for a better name for this before merging it.
[x] Add docs for bulk operations
[x] Add corresponding compress operation (after picking a better nomenclature)
The
Converter.expand
function turns a CURIE into a URI. This PR implementsConverter.expand_or_standardize
, which works like the normalConverter.expand
, but if a URI is given, then it standardizes it and returns it. The other mechanics for "strict" and "passthrough" work the same.This PR also implements
Converter.compress_or_standardize
as a counterpart forConverter.compress
Demo
The expansion and compression demos use a very simple extended prefix map:
Expansion
Compression
Known Use Cases
TODO