Skip to content

PROV-O made demonstrable: SPARQL example script + jsonld export format - #13

Merged
kjpatel merged 1 commit into
mainfrom
m4/provo-demo
Jul 30, 2026
Merged

PROV-O made demonstrable: SPARQL example script + jsonld export format#13
kjpatel merged 1 commit into
mainfrom
m4/provo-demo

Conversation

@kjpatel

@kjpatel kjpatel commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Follow-up to #11 answering "is it demoable?" — with the deliberate scope decision discussed in review: script plus query param, no UI button. A demo viewer wants the receipt; a lineage stack wants an HTTP path. The export panel stays three buttons.

What's here

spec/provo_sparql_demo.py — run uv run --with rdflib python spec/provo_sparql_demo.py from the repo root and watch three auditor questions get answered in standard SPARQL over live-adjudicated receipts plus the committed human-correction case:

  1. Which decisions used a fact grounded in this document? → exactly the NY notice receipt, and correctly not the TRID receipt in the same graph
  2. Which decisions relied on a human-asserted fact, and what did it supersede?review-0001, its reviewer, and the superseded machine fact's id as a graph edge
  3. Under which rule-pack version was each decision made? → every receipt with its prov:Plan

rdflib deliberately stays out of the dependency tree (--with at invocation) — it stands in for "whatever RDF tooling your organization already runs," which is the whole pitch. Context resolution is offline against spec/contexts/; network fetches are refused.

The script header documents a caveat discovered while building it: the synthetic golden corpus is attestation-grounded (those cases have no documents), so document-lineage queries correctly return nothing over it — span-grounded facts (the starters, any real deployment) are where Q1 lights up. Query silence there is correct behavior, and now it's written down so nobody repeats the twenty confused minutes it cost.

GET /api/report?format=jsonld — the existing export endpoint (md/pdf) grows a third format: the adjudicated receipt wrapped by as_jsonld, served as application/ld+json with a download disposition. Two new tests cover the happy path (context/id/hash coherence with the stored receipt riding inside unchanged) and format rejection.

spec/prov-o.md — a "Seeing it work" section pointing at both paths and stating the no-button rationale.

Verification

398 tests passing (2 new); 351 golden receipts replay byte-for-byte; spec validation including contexts green; the demo script executed with outputs verified before its claims were written down.

🤖 Generated with Claude Code

- spec/provo_sparql_demo.py: adjudicates the two span-grounded starters
  live, adds the committed review-0001 correction case, expands through
  the repo's own contexts offline, and answers three auditor questions
  in standard SPARQL (document lineage, human-fact reliance with the
  supersession chain, rule-pack-version-as-plan). rdflib deliberately
  stays out of the dependency tree — invoked via uv run --with, standing
  in for whatever RDF tooling an organization already runs. The header
  documents the grounding caveat found while building it: attestation-
  grounded facts (the whole synthetic corpus) correctly return no
  document-lineage rows.
- /api/report grows format=jsonld: the adjudicated receipt wrapped by
  duly_kernel.provo.as_jsonld, served as application/ld+json. Endpoint
  only, deliberately no UI button: a demo viewer wants the receipt; a
  lineage stack wants an HTTP path, not a button.
- spec/prov-o.md gains a 'Seeing it work' section covering both paths.

398 tests passing (2 new); 351 golden receipts replay; spec validation
incl. contexts green; demo script executed and outputs verified.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@kjpatel
kjpatel merged commit 7ea4ca3 into main Jul 30, 2026
2 checks passed
@kjpatel
kjpatel deleted the m4/provo-demo branch July 30, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant