Skip to content

feat: read documents written for any known openMINDS namespace - #112

Open
ehennestad wants to merge 2 commits into
refactor-serializer-onto-transformerfrom
support-cross-namespace-loading
Open

feat: read documents written for any known openMINDS namespace#112
ehennestad wants to merge 2 commits into
refactor-serializer-onto-transformerfrom
support-cross-namespace-loading

Conversation

@ehennestad

@ehennestad ehennestad commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Documents written before openMINDS v4 use the openminds.ebrains.eu namespace; from v4 they use openminds.om-i.org. Reading one required the active model to match the document, so a v3 file failed under a v4 model and vice versa.

Type resolution

Types.fromAtType asserted that every @type starts with the base URI of the active model:

assert(all(startsWith(typeName, openminds.constant.BaseURI)), ...
    'OPENMINDS_MATLAB:Types:InvalidAtType', ...
    'Expected @type to start with "%s"', openminds.constant.BaseURI)

Both namespaces are now accepted. The type name is the last segment of the @type in either form — .../core/Person and .../types/Person both end in Person — and the types that share a name are the same type, so a document maps onto the active model whichever version wrote it.

A namespace belonging to neither is still rejected, now with an error naming both accepted prefixes and the value actually given, rather than an assertion that only names one.

A type name that does not exist in the active model previously surfaced as an eval failure mentioning a MATLAB enumeration. It now reports the type name and the model version that lacks it.

Vocabulary prefixes

jsonld2struct removed the vocabulary prefix from property names by replacing a hardcoded string:

vocabBaseUri = "https://openminds.ebrains.eu/vocab/";
jsonInstance = strrep(jsonInstance, vocabBaseUri, '');

Documents in expanded form written under v4 use https://openminds.om-i.org/props/, so their property names kept the prefix and matched nothing on the type classes. Every known openMINDS vocabulary is now stripped, listed in one place in getVocabularyIRIs.

What is deliberately not done

Cross-namespace reads produce no warning. A property that a version does not have fails when it is assigned, and the deserializer added earlier in this stack already reports every node it could not read, with identifiers. Genuine incompatibilities therefore surface on their own, whereas a warning on every legacy document would fire on entirely correct use and get ignored.

This is partial compatibility, not a migration layer. Types that were renamed or removed between versions will not resolve, and will be reported as unreadable nodes.

Tests

The fixture test for legacy documents changes from asserting a clear rejection to asserting that the document loads — which is what that test's own comment anticipated when it was written. A new test takes its place, checking that a document from a genuinely foreign namespace is still rejected with OPENMINDS_MATLAB:Types:InvalidAtType.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Test Results (R2022a)

760 tests   758 ✅  2m 44s ⏱️
 20 suites    1 💤
  1 files      1 ❌

For more details on these failures, see this check.

Results for commit d042a60.

♻️ This comment has been updated with latest results.

A document written before openMINDS v4 uses the openminds.ebrains.eu
namespace, and one written from v4 uses openminds.om-i.org. Reading either
one required the active model to match the document, so a v3 file failed
under a v4 model with an assertion about the expected prefix, and a v4
file failed under a v3 model.

Types.fromAtType now accepts both namespaces. The type name is the last
segment of the @type in either form, and the types that share a name are
the same type, so the document maps onto the active model regardless of
which version wrote it. A namespace that belongs to neither is still
rejected, now with an error naming both accepted prefixes and the value
that was given rather than an assertion.

A type name that does not exist in the active model was previously an eval
error naming a MATLAB enumeration. It now reports the type name and the
model version that does not have it.

jsonld2struct stripped the vocabulary prefix by replacing a hardcoded
openminds.ebrains.eu vocabulary IRI. Documents in expanded form written
under v4 use a different vocabulary IRI and were left with property names
that no type class has. It now strips every known openMINDS vocabulary,
listed in one place.

Cross-namespace reads are not warned about. A property that a version does
not have fails when it is assigned, and the deserializer already reports
every node it could not read, so genuine incompatibilities surface on
their own. A warning on every legacy document would fire on correct use.

The fixture test for legacy documents changes from asserting a clear
rejection to asserting the document loads, which is what its own comment
anticipated. A test that a foreign namespace is still rejected takes its
place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ehennestad
ehennestad force-pushed the support-cross-namespace-loading branch from d2c72e3 to d042a60 Compare August 28, 2026 12:59
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.

1 participant