Support openMINDS v5 alongside v4 (v4 remains the default) - #118
Merged
Conversation
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.
# Conflicts: # codemeta.json
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.
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.rstand 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 intov4/.Internals, not covered by the docs:
NodeMetaderivesclass_namefrom the version segment of the module path, so v4 and v5 classes register asopenminds.v4.<domain>.<Class>andopenminds.v5.<domain>.<Class>rather than both claiming the v4 name.KGClientcarriesopenminds_versionand passes it tolookup_typeat the two sites that resolve a type URI to a class —KGObject.from_idon the untyped path, andKGClient.space_info. Needed because a v4 class and its v5 counterpart share the same@typeURI.fairgraph/openminds/__init__.pyis hand-written rather than generated; it supplies the legacy v4 aliases.New tests in
test/test_openminds_versions.py.