Skip to content

Support openMINDS v5 alongside v4 (v4 remains the default) - #118

Merged
apdavison merged 9 commits into
HumanBrainProject:masterfrom
apdavison:openminds-v5
Aug 22, 2026
Merged

Support openMINDS v5 alongside v4 (v4 remains the default)#118
apdavison merged 9 commits into
HumanBrainProject:masterfrom
apdavison:openminds-v5

Conversation

@apdavison

Copy link
Copy Markdown
Member

Adds the openMINDS v5 schemas alongside v4. v4 remains the default, so existing code is unaffected; v5 is opt-in and flagged experimental until the KG migration completes. User-facing detail is in the README, doc/modules.rst and the 0.15.0 release notes.

596 files, of which 567 are generated: the new fairgraph/openminds/v5/ tree and the move of the existing classes into v4/.

Internals, not covered by the docs:

  • NodeMeta derives class_name from the version segment of the module path, so v4 and v5 classes register as openminds.v4.<domain>.<Class> and openminds.v5.<domain>.<Class> rather than both claiming the v4 name.
  • KGClient carries openminds_version and passes it to lookup_type at the two sites that resolve a type URI to a class — KGObject.from_id on the untyped path, and KGClient.space_info. Needed because a v4 class and its v5 counterpart share the same @type URI.
  • fairgraph/openminds/__init__.py is hand-written rather than generated; it supplies the legacy v4 aliases.

New tests in test/test_openminds_versions.py.

apdavison added 9 commits May 27, 2026 09:37
v4 and v5 share identical @type URIs, so URI alone cannot disambiguate
which schema version a JSON-LD response belongs to. KGClient now carries
an openminds_version (default "v4") and feeds it into the two lookup_type
callsites that previously hardcoded OPENMINDS_VERSION: KGObject.from_id
(type-unknown branch) and KGClient.space_info. Pass openminds_version="v5"
when constructing a client against a v5-migrated KG; existing code is
unaffected.

MockKGClient grows the same parameter so tests can exercise both paths.
The v5 introduction aliased only the top-level v4 modules (core, sands,
etc.) under fairgraph.openminds.<top>. Walking a deeper dotted path like
fairgraph.openminds.core.products.dataset_version then caused Python to
import a fresh, separate module object distinct from its v4 counterpart.
Anything that resolved an attribute via the legacy path (notably
unittest.mock.patch in test_dataset_version_download) silently operated
on a duplicate copy: the patch landed on the legacy module while the
class under test used urlretrieve from the v4 module.
(Used `doc/build_codemeta.py` script)

[skip ci]
Folds in the introspection-helper move, the initialise_instances rewrite, the data-proxy URL fix, the id_key threading and the v0.14.0 release.

set_error_handling() is now defined at the version level (fairgraph.openminds.v4 / .v5), generated by the builder, with the top-level fairgraph.openminds.set_error_handling() delegating to both.

Adds the missing "MRIScannerUsage" entry to the builder's reverse_name_map, without which generation of the v5 classes fails with a KeyError, and regenerates both versions from openMINDS v4.0/v5.0. This gives MRIScannerUsage its "device" property and MRIScanner the corresponding "usage" reverse property, and brings the v5 ScholarlyArticle into line with its additional_methods overlay.
Rewrites the passages that assumed a single schema version: the README's "Knowledge Graph and openMINDS versions" section, and the introductory text in knowledgegraph.rst, index.rst and queries.rst. The openMINDS build instructions in contributing.rst now describe generating both versions with --generate-all, the additional_methods overlays, and the reverse_name_map entry that a newly-introduced schema property may need.

Replaces the non-existent host named in the modules.rst example with a placeholder, and notes that the production and pre-production deployments serve openMINDS v4, v5 metadata being available so far only from a development deployment with restricted access.

Adds release notes for 0.15.0, covering openMINDS v5 support and the removal of the v3 transitional machinery.

Also documents ten classes that were missing from the v4 module pages: IdentifiersDotOrgID, BiologicalProcess, MRIPulseSequence, MRIWeighting, MeasuredSignalType, CommonCoordinateSpaceVersion, SingleColor, ViewerSpecification, DataCopy and GenericComputation.
@apdavison apdavison added the enhancement New feature or request label Aug 22, 2026
@apdavison apdavison added this to the 0.15 milestone Aug 22, 2026
@apdavison
apdavison merged commit 62e3203 into HumanBrainProject:master Aug 22, 2026
7 checks passed
@apdavison apdavison linked an issue Aug 22, 2026 that may be closed by this pull request
@apdavison
apdavison deleted the openminds-v5 branch August 22, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retrieve data from multiple schema versions

1 participant