Fix semanticId matching: tolerate trailing eCl@ss/IRDI version suffix#8
Open
opendpp-node wants to merge 1 commit into
Open
Fix semanticId matching: tolerate trailing eCl@ss/IRDI version suffix#8opendpp-node wants to merge 1 commit into
opendpp-node wants to merge 1 commit into
Conversation
matchesSemanticId documented itself as version-suffix tolerant, but endsWith only tolerates a LEADING IRI prefix: a real-world versioned value like 0173-1#02-AAW338#001 ends with CIRPASS-2#1, so a version-less configured target never matched and extraction silently fell back to idShort-path navigation (or missed entirely with non-standard idShorts). Also compare the candidate with a trailing #NNN segment stripped (only when another '#' remains, so plain IRIs with numeric fragments are left untouched). Regression test: dpp-aas-versioned.json carries versioned eCl@ss semanticIds AND vendor-specific idShorts, so it can only pass via the semanticId scan (fails with 1/4 fields before this fix). Fixes CIRPASS-2#7
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.
Fix:
semanticIdmatching misses trailing eCl@ss/IRDI version suffixesFixes #7.
The bug
AasExtractorStrategy.matchesSemanticIddocumented itself as "suffix-insensitive totolerate version suffixes (e.g. #2)", but the implementation
only tolerates a leading IRI prefix. A real-world versioned value ends with the version,
not the target:
semanticId.keys[].value0173-1#02-AAW338#0010173-1#02-AAW338https://…/0173-1#02-AAW3380173-1#02-AAW338So version-less configured targets (the pattern the bundled configs deliberately use) never
matched versioned AAS values, and extraction silently fell back to idShort-path
navigation — or missed entirely when idShorts are vendor-specific. Notably, the existing
dpp-aas.jsonfixture already carries versioned semanticIds (…#001,…#012,…#003);its test passes only because the standard idShorts let the fallback rescue it.
The fix
Also compare the candidate with a trailing
#NNNsegment stripped — only when another#remains after stripping, so plain IRIs with a numeric fragment are left untouched. Pinned
(versioned) targets keep their exact-match semantics; existing behaviour is otherwise
unchanged (the old comparison still runs first).
Regression test (red → green)
dpp-aas-versioned.json: same data asdpp-aas.json, but with vendor-specific idShortsand versioned eCl@ss semanticIds — so the idShort fallback cannot mask the bug and extraction
must succeed via the semanticId scan alone (
granularity, configured by idShortPath only,keeps its standard idShorts and keeps working).
expected: <4> but was: <1>(onlygranularityextracted)SearchKeyExtractorTest: tests=5, failures=0, errors=0(4 existing + 1 new), all modules (
./mvnw test, JDK 21).Checklist
— Giovanni Savastano · OpenDPP (opendpp-node.eu)