How to record evaluated duty instances outside a policy
Found while reviewing the contracts prose and examples for #275.
Problem
A contract records what the parties agreed. It is not a log of what happened under it: that comes later and changes over time. The formal semantics agrees. Duty state is evaluator state (Σ), and how it is persisted between evaluations is out of scope (formal-semantics.md §1). So DPROD has no agreed way to record an evaluated duty instance, and the examples that try contradict the semantics:
dprod-contracts/examples/baseline.ttlanddata-contract.ttl, in their "Duty Instances" sections:- Each record is a standalone
odrl:Dutythat keepsdprod:schedule. That makes it a template, and by #274 a template is never fulfilled or violated, yet some records carrydprod:dutyState dprod:Fulfilled. - Nothing links a record to the duty it instantiates, or to its occurrence time. The formal semantics identifies an instance by that pair (duty, t).
- Each record is a standalone
dprod:dutyStatehas domainodrl:Duty, so the only place to put a state is on a duty. In an agreement'sodrl:obligation, such a record becomes another clause.
#282 removes the instance records that were inside a contract's odrl:obligation (the lifecycle JSON-LD example). This issue covers the rest.
Options
- No vocabulary. Leave instance state to evaluators, say so in the spec, and remove the "Duty Instances" sections from the Turtle examples.
dprod:dutyStatewould then only describe unscheduled duties evaluated in place, or would go. - A small instance record. Add something like
dprod:instanceOf(the duty) anddprod:occurrence(the scheduled time, anxsd:dateTime), withdprod:dutyStateon the record, kept outside any policy. Evaluators could then exchange and persist state, and an evaluation context could carry it as an input. The open question is whether the record is anodrl:Duty(it isn't a rule) or its own class, and how it relates to the state snapshot (prov:Entity).
Either way, the Turtle examples should stop putting dprod:dutyState on a scheduled duty.
Decision needed
Should DPROD standardise how evaluated duty state is recorded (option 2), or leave it to implementations (option 1)?
🤖 Generated with Claude Code
My recommendation is option 1. Logging and tracking duty performance, and any vocabulary for it, should be outside the scope of this spec.
An offer or a contract records what was agreed. What happened under it is a different record. It is written later and keeps changing over time. The formal semantics already treats how duty state is persisted between evaluations as out of scope (formal-semantics.md §1). Implementations can log and track performance however suits them, and supply what an evaluation needs in its evaluation context.
If the group agrees, the follow-up would be:
- remove the "Duty Instances" sections from
baseline.ttlanddata-contract.ttl; - say in the spec that recording duty state is left to implementations;
- decide whether
dprod:dutyStatestays, as a term for an evaluator's result, or goes.