Repository navigation
termIndex: index equivalents and synonyms for readers (NDI-matlab#1332) - #558
Merged
Merged
Conversation
did2.schema.termIndex gains byEquivalent (curieKey of each `equivalent` id) and bySynonym (termNameKey of each `synonyms` entry), and each registered term carries `synonyms`. A row's own node or name wins over another row's equivalent or synonym. termRegistered and registeredTerm do not read the new maps, so a writer's rule is unchanged. For VH-Lab/NDI-matlab#1332 ([entity search resolves a term through the registry], Jess Haley, 2026-11-30): NDI's searches resolve a term through this index instead of parsing the registry a second time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
testEquivalentsAndSynonymsAreIndexedForAReader checked 'body midpoint' for empty lists, but the fixture gives that row CHEBI:15379 and 'dioxygen' on purpose (the own-row-wins control). Check dioxygen's empty lists instead, and that body midpoint keeps its own list. The index code was correct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
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.
The DID-matlab step of VH-Lab/NDI-matlab#1332 ([entity search resolves a term through the registry], decided by Jess Haley on 2026-11-30 and recorded in did-schema #406). It is paired with an NDI-matlab PR on the same branch name,
claude/search-resolves-terms. NDI-matlab's No Cloud workflow picks this DID-matlab branch by that name. Merge order: this PR first, then the NDI-matlab PR (siblings first).Why
did2.schema.termIndexkeysbyNodeonly on each row's ownnode, andbyNameonly on its ownname. It keepsequivalenton each entry, but nothing indexes it. It never readssynonymsat all. NDI's searches need to look a term up by an equivalent node or a synonym. Without this change, NDI would have to parse the registry a second time.What changed
src/did/+did2/+schema/termIndex.m:byEquivalent:curieKey(id)for each id in a row'sequivalentlist.bySynonym:termNameKey(s)for each entry in a row'ssynonymslist.synonyms(a cellstr).byNodeorbyNameis not added to the new maps.termRegisteredandregisteredTermdo not read the new maps, so the writer's rule is unchanged: an equivalent node or a synonym is still not the registered term.tests/+did2/+unittest/testBuildTermRegistry.m: new testtestEquivalentsAndSynonymsAreIndexedForAReader, on a registry written in the test (carbogen CHEBI:757169 with equivalent NCIm:CL1445492 and one synonym).byNodeand the synonym is not inbyName.termRegisteredstill refuses the equivalent node.This was written without MATLAB (Octave cannot parse
argumentsblocks), so this PR's runs are the first execution.Proposed (not decided)
check_term_registrydoes not refuse that today.Generated by Claude Code