feat(contracts): SKOS-typed lifecycle properties; remove dprod:select#199
Merged
Conversation
|
@tonyseale is attempting to deploy a commit to the EKGF Team on Vercel. A member of the Team first needs to authorize it. |
…oncept-typed lifecycle properties Resolves changes-plan items 5.5 and 1.3. 5.5 — dprod:select removed. Every documented use was a verbatim restatement of an existing dprod:path sequence; the few SPARQL-only capabilities (filters, joins, aggregates, inverse/alternative traversal) are unexercised by any policy in dprod-contracts/examples/; and the spec was underdefined when measured against SHACL's sh:SPARQLConstraint machinery (variable-name inconsistency, no prefix mechanism, contradictory dprod:path composition, hand-waved multi-row and graph-context semantics). Future-revisit trigger: a real policy example needs filters/joins/aggregates/inverse/alternatives — at that point reinstate either a properly-specified dprod:select modelled on sh:SPARQLConstraint, or extend dprod:path with sh:inversePath/sh:alternativePath first. 1.3 — dprod:State class and dprod:state union-domain property deleted. Replaced with three domain-specific object properties: dprod:offerLifeCycleStatus (dprod:DataOffer), dprod:contractLifeCycleStatus (dprod:DataContract), and dprod:dutyState (odrl:Duty). Range is the open class skos:Concept rather than a closed DPROD enumeration; this preserves the group's open-world intent better than the originally-discussed subclass split, and aligns with how DPROD already uses skos:Concept for operands and actions. The four canonical state instances (dprod:Pending, dprod:Active, dprod:Fulfilled, dprod:Violated) are retyped as skos:Concept and grouped into a new skos:ConceptScheme dprod:DataContractLifeCycleStatus, shipped as an example vocabulary — implementations are free to use it, extend it via skos:inScheme, or substitute a different scheme. The vocabulary lives in its own comment-block section between Classes and Properties. Property descriptions lead with the distinguishing question each property answers — publication lifecycle (assigned by publisher) vs administrative lifecycle (assigned by contract management) vs evaluation result (computed by an evaluator) — surfacing the declared-vs-computed contrast that was previously hidden. Shape side-effects: dprod-shapes:StatePropertyGroup (with closed sh:in over the four states) split into dprod-shapes:OfferLifeCycleStatusPropertyGroup, ContractLifeCycleStatusPropertyGroup, and DutyStatePropertyGroup — each constraining sh:maxCount 1 and sh:nodeKind sh:IRI with no enumeration. SHACL shape for dprod:path value structure (changes-plan §2.3) also closed: the sh:path dprod:path property in LeftOperandShape now carries sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node dprod-shapes:RdfListOfIris ] ), where the non-recursive RdfListOfIris helper walks the list with ( [ sh:zeroOrMorePath rdf:rest ] rdf:first ) to avoid pyshacl's recursion warning. Examples rewritten by enclosing-entity type: 9 dprod:state assertions in baseline.ttl became dprod:offerLifeCycleStatus, 6 became dprod:dutyState; in data-contract.ttl 1 became dprod:offerLifeCycleStatus and 3 became dprod:dutyState; single offer-status replacements in odcs.ttl and contracts-guide.md. All four example files (baseline, data-contract, data-use-policy, odcs) validate under the updated shapes with zero pyshacl recursion warnings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds dprod-contracts/validate.py: parses every contracts TTL and validates each example against dprod-contracts-shapes.ttl (ontology supplied as ont_graph, RDFS inference on). Exits non-zero on any parse error or SHACL violation. Adds pyshacl to requirements.txt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a15c895 to
1e5f860
Compare
jgeluk
approved these changes
Jun 16, 2026
FroehlichMarcel
approved these changes
Jun 16, 2026
This was referenced Jun 16, 2026
7 tasks
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.
Summary
Follows on from #156 (merged 2026-05-28). Resolves two open
changes-plan.mditems:§5.5 —
dprod:selectremoved. Every documented use was a verbatim restatement of an existingdprod:pathsequence; the few SPARQL-only capabilities (filters, joins, aggregates, inverse/alternative traversal) are unexercised by any policy indprod-contracts/examples/; and the previous specification was underdefined when measured against SHACL'ssh:SPARQLConstraintmachinery (variable-name inconsistency?vvs?value, no prefix mechanism, contradictory composition withdprod:path, hand-waved multi-row and graph-context semantics). Future-revisit trigger and the SHACL-rigour template are recorded inchanges-plan.md§5.5.§1.3 —
dprod:Stateclass anddprod:stateunion-domain property removed. Replaced with three domain-specific object properties:dprod:offerLifeCycleStatusondprod:DataOfferdprod:contractLifeCycleStatusondprod:DataContractdprod:dutyStateonodrl:DutyRange on all three is the open class
skos:Concept. This preserves the group's open-world intent better than the originally-discussed subclass split, and aligns with how DPROD already usesskos:Conceptfor operands and actions. The four canonical state individuals (dprod:Pending,dprod:Active,dprod:Fulfilled,dprod:Violated) are retyped fromdprod:Statetoskos:Conceptand grouped into a new exampleskos:ConceptScheme,dprod:DataContractLifeCycleStatus— shipped as one ready-made vocabulary that implementations are free to use, extend viaskos:inScheme, or replace entirely.Property descriptions lead with the distinguishing question each property answers — publication lifecycle (assigned by publisher) vs administrative lifecycle (assigned by contract management) vs evaluation result (computed by an evaluator) — surfacing the declared-vs-computed contrast that was previously hidden.
Side-effects also landed in this PR
dprod:pathvalue structure (changes-plan§2.3, also closed).LeftOperandShapenow constrainsdprod:pathto a single IRI or anrdf:Listof IRIs viash:or, with a non-recursivedprod-shapes:RdfListOfIrishelper that walks the list using( [ sh:zeroOrMorePath rdf:rest ] rdf:first )— avoids pyshacl'sShapeRecursionWarning(which fires on the naïve recursive variant at depth 14).dprod-shapes:StatePropertyGroup(with closedsh:inover the four states) replaced withOfferLifeCycleStatusPropertyGroup,ContractLifeCycleStatusPropertyGroup,DutyStatePropertyGroup— each constrainingsh:maxCount 1andsh:nodeKind sh:IRI(no enumeration; therdfs:range skos:Conceptin the ontology remains the authoritative range).dprod:stateassertions inbaseline.ttlbecamedprod:offerLifeCycleStatus, 6 becamedprod:dutyState; indata-contract.ttl1 becamedprod:offerLifeCycleStatusand 3 becamedprod:dutyState; single offer-status replacements inodcs.ttlandcontracts-guide.md.README.md,docs/specification.md(§3.1 Example Lifecycle Concept Scheme, §3.2/§3.3 Recommended properties, §4.1 grouped property table, property-incidence matrix),docs/overview.md,docs/term-mapping.md,docs/contracts-guide.md,examples/odcs.md,docs/policy-writers-guide.mdall updated. Detailed DONE entries appended tochanges-plan.md§§1.3, 2.3, 5.5.Diff: 16 files, +333 / −184 (14 contracts files scoped to
dprod-contracts/, plus the validation tooling noted below).Added by maintainer (jgeluk)
developto resolve the merge conflicts (the branch had diverged before Add dprod-contracts folder #156's squash-merge landed; the rebased tree is byte-identical to the prior fork tip — no content changed).dprod-contracts/validate.py+pyshacldep added: parses every contracts TTL and SHACL-validates each example against the shapes (ontology asont_graph, RDFS inference on); exits non-zero on any parse error or violation. Confirms the new SKOS lifecycle shapes/examples validate cleanly, and is wired for CI in CI: run dprod-contracts SHACL validation (validate.py) on push/PR #200.Test plan
dprod-contracts.ttlanddprod-contracts-shapes.ttlparse cleanly (rdflib, 569-triple combined graph).baseline.ttl,data-contract.ttl,data-use-policy.ttl,odcs.ttl— validate under the updated shapes withconforms=Trueand zeroShapeRecursionWarning.LeftOperandwhosedprod:pathis a literal triggers a violation; a sequence containing a literal triggers a violation.rdf:Listof IRIs both accepted.dprod:select,dprod:state, ordprod:Stateoutsidechanges-plan.mdhistorical context entries.dprod:selectanddprod:Stateare gone from the property-incidence matrix.🤖 Generated with Claude Code