Importing External Prefixes
While the Bioregistry automatically imports all prefixes from external
registries with similar scope and sufficient minimum metadata and quality
standards (e.g., Identifiers.org), it only partially aligns most external
registries (e.g., BioPortal). This is a tutorial on how to import a prefix from
one of the partially aligned registries on an as-needed basis. More
specifically, it describes importing the Food classification
(FOODEX2
) ontology from
AgroPortal. Pull request
#573 contains the
relevant diff for the changes described in this tutorial.
- Identify a prefix of interest from AgroPortal (or another) curation sheet (e.g., here)
- Pick a prefix for the Bioregistry. This doesn’t have to be the same as the
external one, but usually it is. If the external prefix is too short or too
vague, it might be a good chance to improve on this. Further, keep in mind
that Bioregistry requires lowercase, so the best choice here is
foodex2
- Go into the
bioregistry.json
file and use the prefix as a key for a new dictionary object. -
The only thing you need inside the object is
"mappings"
which itself is a dictionary object where the key is the metaprefix for the external registry (in this caseagroportal
) and the value is the external registry’s prefix (in this caseFOODEX2
)."foodex2": { "mappings": { "agroportal": "FOODEX2" } }
- Make sure the Bioregistry is installed in editable mode
- Run the alignment script for the registry. In this case, it’s
python -m bioregistry.align.bioportal
- Run unit tests with
tox -e py
. This reveals that the alignment doesn’t pull in enough metadata to meet the minimum requirements. In this case, OntoPortal instances (e.g., AgroPortal, BioPortal, etc.) don’t provide a well-defined example local unique identifier (though note they provide an unstandardizedexample_iri
field that might be helpful) - Curate an example identifier. In this case, the AgroPortal’s
example_iri
gives enough information to pull out an example identifier. - Add any additional curations