DPROD Contracts: reject duty-only properties on non-Duty rules
Context
Follow-up from #198 (fixme.md item 22), related to #184.
dprod:deadline, dprod:recurrence, dprod:subjectOfDuty, and dprod:objectOfDuty are duty-only properties. Their OWL domains describe that intent but do not validate input. A Permission or Prohibition carrying one of these properties is not explicitly rejected by the current SHACL graph; reasoning can instead infer an unintended additional odrl:Duty type.
That is not fail-fast validation and can produce resources belonging to ODRL-disjoint rule classes.
Acceptance criteria
- Add regression tests first for each duty-only property used on an
odrl:Permissionand anodrl:Prohibition; each case must currently demonstrate the validation gap. - Add SHACL violations targeting non-Duty subjects of the duty-only properties.
- Keep valid named and inline Duty instances conformant.
- Cover the schedule/recurrence model produced by #184 rather than preserving obsolete string-RRULE assumptions.
- Document the class scope of each property in the specification and usage matrix.
Implementation scope after the agreed #184 Schedule redesign:
dprod:deadline,dprod:subjectOfDuty, anddprod:objectOfDutyremain duty-only and will fail SHACL validation on every non-odrl:Dutysubject.dprod:recurrenceis obsolete under #184 and already fails validation everywhere; it will not be retained as a duty-only RRULE property.dprod:scheduleis intentionally not duty-only. The #184 decision defines it as a generic reference from duties, permissions, maintenance arrangements, backup obligations, and other resources. Restricting it to Duty here would contradict that model.
The regression coverage will therefore test Permission and Prohibition misuse of the three surviving duty-only properties, global rejection of obsolete dprod:recurrence, valid named and inline duties, and valid generic schedule use. Because #184 is still draft PR #234, the #239 implementation will be stacked on that branch rather than encoding the obsolete model on develop.
Confirmed as a SHACL-only gap and fixed in tonyseale/dprod@5ee46d72eab54401b30334c64e107dd44b126570 on issue/258-spec-contracts (lands on develop with the #258 PR).
What changed
- New
dprod-shapes:DutyOnlyPropertiesShapewithsh:targetSubjectsOffordprod:deadline,dprod:recurrence,dprod:subjectOfDutyanddprod:objectOfDuty. The subject must be anodrl:Dutyand must not be anodrl:Permissionorodrl:Prohibition. The explicitsh:notchecks matter because under RDFS inference the OWL domain would otherwise type the misused rule as a Duty and let it conform. - Regression tests in
dprod-contracts/tests/test_duty_only_properties.py: each property on a Permission and on a Prohibition (all eight cases failed before the shape, pass now), plus valid named and inline duties remain conformant. - The usage matrix in
docs/specification.mdalready records the duty-only scope of these properties, so no doc change was needed.
Note on #184: the Schedule redesign (PR #234) is not on this branch, so dprod:recurrence is still a live duty-only RRULE property here and is treated as such. When #234 lands, drop dprod:recurrence from the shape's target list; dprod:schedule is deliberately not included, per the comment above.