Real ESPR/battery SHACL shapes + verified fixtures (starter, non-normative) - #9
Merged
marco-volpini merged 1 commit intoAug 4, 2026
Conversation
Non-normative starter shapes authored against a real implementer's DPP vocabulary, complementing the placeholder example.org templates. - opendpp_battery_shacl.ttl + valid/invalid JSON-LD fixtures (hermetic: inline @context only, so parsing needs no remote context fetch) - MockShaclRepository routes OpenDPP-vocabulary inputs to the new template (vehicle behaviour unchanged) - ValidatorServiceTest: valid passport conforms; invalid passport yields exactly 2 violations (dpp:status enum + dpp:metadata shape)
opendpp-node
force-pushed
the
feat/opendpp-espr-battery-shapes
branch
from
July 9, 2026 13:27
5aebca4 to
3750ce2
Compare
opendpp-node
marked this pull request as ready for review
July 9, 2026 13:28
Contributor
Author
|
Following up on our call today: wired the tests in (valid conforms; invalid → exactly 2 violations on |
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.
Real ESPR/battery SHACL shapes + wired tests (starter, non-normative)
Follow-up from our call: shapes contributed with fixtures and the tests wired in, ready for review.
Motivation
The bundled SHACL templates (
core/src/test/resources/shacl-templates/{battery_pass,electronics,vehicle}_shacl.ttl)use placeholder
http://example.org/…namespaces, so they can't validate a real passport.This adds a starter shapes set authored against an actual implementer's DPP vocabulary
(OpenDPP's public
application/ld+jsonpassport), so the repo ships something that validatesa real document out of the box.
What's added
core/src/test/resources/shacl-templates/opendpp_battery_shacl.ttl— NodeShapes for the DPProot + battery/ESPR metadata block (lifecycle status, economic operator, manufacturing
facility, carbon-footprint presence, durability, material composition, battery category,
rated capacity, seal material).
core/src/test/resources/json-ld/valid-opendpp-battery-ld.json— a real OpenDPP batterypassport that conforms.
core/src/test/resources/json-ld/invalid-opendpp-battery-ld.json— same passport withstatusset toBOGUS_STATUSandmetadata.durabilityremoved.ValidatorServiceTest#testOpenDPPBatteryJSONLDValidation— valid passport conforms.ValidatorServiceTest#testFailingOpenDPPBatteryJSONLDValidation— invalid passport yieldsexactly 2 violations, on
dpp:status(enum) anddpp:metadata(failsBatteryMetadataShape).MockShaclRepository.findBestMatchroutes inputs whose type/vocabulary belong to theOpenDPP vocabulary to the new template — vehicle behaviour unchanged, all existing
tests untouched and passing.
Verified locally (JDK 21,
./mvnw test, full reactor)Design notes
@contextis fully inline (no remote context URL), soneither the titanium metadata extraction nor Jena's JSON-LD parsing performs any network
fetch at test time — consistent with the existing
vehicle-ld.jsonfixture style.@context. Only terms inthat context survive JSON-LD→RDF expansion, so nested
economicOperator/Facilityinnerfields are presence-checked rather than class-targeted (class-targeting unexpanded
nodes would be unsound).
opendpp-node.eu/…) — noexample.org, and no borrowedeCl@ss/IDTA identifiers.
Scope / claims
Non-normative, starter. These are OpenDPP-authored shapes offered as a contribution — not
an EU / CIRPASS-2 conformance oracle, not a claim of Battery-Regulation completeness. Glad to
extend the same pattern to the pilot chains (electronics / textiles / tyres / construction).
Checklist
./mvnw test, full reactor, JDK 21)example.org/ unverified IRDIs introduced— Giovanni Savastano · OpenDPP (opendpp-node.eu)