Repository navigation
Add 7 new ontology providers and enhance OM with file-based unit lookup - #9
Merged
Merged
Conversation
…ontologies Brings the port to parity with ndi-ontology-matlab at 1fbd38b. - OM: read units (individuals, which OLS does not index) from OM's own om-2.0.rdf before falling back to OLS. Ports OM.fileIndex, parseRDF and findInIndex under MATLAB's names; clearCache() forgets the index, as MATLAB's clearCache now does. - New OLS-backed providers: MICRO, MCO, OBI, ZECO, WBls. - New fixed-list providers: OWLTime (prefix `time`, 15 interval relations) and CREDIT (14 CRediT roles, slug ids, CRO numbering as an alias). Tables copied verbatim from MATLAB and checked equal row for row. - ontology_list.json: byte-identical copy of MATLAB at 2349314 (30 prefixes). - Tests: port TestOMFile.m; unit tests for the new providers; CREDIT and OWLTime shared cases run offline alongside NDIC. - Bridge: new entries, OM and ontology re-examined, hashes recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the port to parity with ndi-ontology-matlab at
1fbd38b(its PR #10): OM now reads its units from OM's own RDF file, and seven new ontologies are added.Changes
OM reads units from OM's own file
OM's units are individuals (
om:metreis anom:Unit), which the EBI OLS index does not hold. SoOMProvider, likeOM.msince44efcec, now readsom-2.0.rdffirst and falls back to the existing OLS label search only when the file can't be read or has no match. That fallback is still how OM's classes are found, e.g.MolarVolumeUnit.fileIndex(reset=False)downloads and indexes the file once per process.reset=Trueforgets the index, and a failed download caches nothing.parseRDF(txt)uses MATLAB's regex to index every top-level entry, merging blocks that share an identifier. It keeps the English label, comment and alternative labels.findInIndex(idx, term)tries five rules in order (identifier exact, identifier ignoring case, label, alternative label, camel-case heuristic). The first rule that names exactly one entry wins.clearCache()now also resets the OM file index, matching MATLAB'sclearCache.New providers
OLS-backed: MICRO, MCO, OBI, ZECO, WBls. Each is a minimal
OLSProvidersubclass that sets only the OLS ontology id and the prefix, as the MATLAB classes do.Fixed lists held in the provider (no lookup service indexes them):
time:) holds OWL-Time's 15 interval relations.credit:) holds the 14 CRediT contributor roles. Ids are slugs (credit:data-curation), and CRO's older numbering (CREDIT:00000002) is accepted as an alias.Both lists were copied verbatim from MATLAB and checked equal row for row. A term that isn't on the list raises.
Data, docs and the bridge contract
ontology_list.jsonis an exact copy of MATLAB's at2349314(30 prefixes).ndi_matlab_python_bridge.yamlhas new entries for the seven providers, OM andontology.mare re-examined, and the MATLAB hashes are recorded. It also records a gap that predates this PR: Python'sclearCache()does not reset EMPTY's cached download, whereas MATLAB's clears its OBO file cache.Tests
TestOMFile.m(offline parsing and matching against an RDF excerpt).ontology_lookup_tests.json, read from the MATLAB checkout, not vendored here) now has 114 cases across 23 ontologies, up from 66. MATLAB's PR added the new cases; this PR supplies the providers they run against. Every case now has a ported provider behind it. CREDIT and OWLTime cases run offline alongside NDIC's.🤖 Generated with Claude Code
https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH