dprod icon indicating copy to clipboard operation
dprod copied to clipboard

How to record evaluated duty instances outside a policy

Open matthiasautrata opened this issue 1 month ago • 1 comments

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.ttl and data-contract.ttl, in their "Duty Instances" sections:
    • Each record is a standalone odrl:Duty that keeps dprod:schedule. That makes it a template, and by #274 a template is never fulfilled or violated, yet some records carry dprod: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).
  • dprod:dutyState has domain odrl:Duty, so the only place to put a state is on a duty. In an agreement's odrl: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

  1. No vocabulary. Leave instance state to evaluators, say so in the spec, and remove the "Duty Instances" sections from the Turtle examples. dprod:dutyState would then only describe unscheduled duties evaluated in place, or would go.
  2. A small instance record. Add something like dprod:instanceOf (the duty) and dprod:occurrence (the scheduled time, an xsd:dateTime), with dprod:dutyState on 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 an odrl: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

matthiasautrata avatar Oct 13 '26 22:10 matthiasautrata

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.ttl and data-contract.ttl;
  • say in the spec that recording duty state is left to implementations;
  • decide whether dprod:dutyState stays, as a term for an evaluator's result, or goes.

matthiasautrata avatar Oct 13 '26 22:10 matthiasautrata