Skip to content

Add 7 new ontology providers and enhance OM with file-based unit lookup - #9

Merged
stevevanhooser merged 1 commit into
mainfrom
claude/pensive-galileo-j24fio
Oct 21, 2026
Merged

stevevanhooser merged 1 commit into
mainfrom
claude/pensive-galileo-j24fio

Conversation

@stevevanhooser

@stevevanhooser stevevanhooser commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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:metre is an om:Unit), which the EBI OLS index does not hold. So OMProvider, like OM.m since 44efcec, now reads om-2.0.rdf first 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=True forgets 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.
  • Purely numeric terms skip the file, as in MATLAB. An unreadable file raises a warning and falls back to OLS.
  • clearCache() now also resets the OM file index, matching MATLAB's clearCache.

New providers

  • OLS-backed: MICRO, MCO, OBI, ZECO, WBls. Each is a minimal OLSProvider subclass 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):

    • OWLTime (time:) holds OWL-Time's 15 interval relations.
    • CREDIT (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.json is an exact copy of MATLAB's at 2349314 (30 prefixes).
  • The README's supported-ontologies table and shared-case counts are updated.
  • ndi_matlab_python_bridge.yaml has new entries for the seven providers, OM and ontology.m are re-examined, and the MATLAB hashes are recorded. It also records a gap that predates this PR: Python's clearCache() does not reset EMPTY's cached download, whereas MATLAB's clears its OBO file cache.

Tests

  • Ported TestOMFile.m (offline parsing and matching against an RDF excerpt).
  • Added unit tests for OM's file lookup, its fallback and cache reset, the new OLS providers' parameters, and CREDIT and OWLTime lookup and not-found behaviour.
  • MATLAB's shared case table (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.
  • All CI checks pass, including the live shared-case-table job.

🤖 Generated with Claude Code

https://claude.ai/code/session_017iFBFMQmEZaz21d9ZFJbiH

…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
@stevevanhooser
stevevanhooser merged commit e77721b into main Oct 21, 2026
6 checks passed
@stevevanhooser
stevevanhooser deleted the claude/pensive-galileo-j24fio branch October 21, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants