Unit: rdf-sparql-patterns-phase
Status: Slices 1 and 2 complete. ADR-A78/A79/A80 ratified. The compiler’s re-sync with the vocabulary extended on 2026-09-23 is complete in persistence-compiler-iri-sync (Slices 1–5 done, human-validated, 774/774 passing; Slice 6 documentation close-out in progress). Slice 3 (housekeeping first cut) not started.
Last updated: 2026-09-25 (persistence-compiler-iri-sync re-sync complete)
Owner: Agent (autonomous execution authorised by the human; Slice 2 delivered without further pause)
Slice 1 is complete: rdf-sparql-patterns-guide.md consolidates the four source notes into one corrected, cross-referenced reference.
ADR-A78, ADR-A79, and ADR-A80 are ratified (Status: Accepted).
Slice 2 is complete as delivered on 2026-09-22. ontology/persistence is authored (vocabulary, self-validating SHACL shapes, 14 example fixtures, two design-note documents) and tools/persistence is a working Python compiler: 239 tests pass under mise run check:persistence, covering the resolver, validator, capability self-check, boundary-shape walker, an 11-template Mustache library, a 164-case injection corpus, determinism under triple-order permutation, full compile→instantiate→parse round trips, and three Python architecture-policy checks. Doc deltas (root README.md, ontology-architecture.md, mise.toml) are done. Traceability matrix and validation pack are in place.
2026-09-23 update (superseded by the paragraph that follows): ontology/persistence/spec/persistence.ttl and shapes/constraints.ttl were substantially extended by the IRI-patterns remediation (commit c276afb) — three new profile dimensions, extensions to six existing ones, eight new SHACL shapes. None of it is consumed by tools/persistence; the 239 passing tests above exercise only the pre-c276afb vocabulary subset, which is still valid and unmodified, but no longer the complete picture. See persistence-compiler-iri-sync.md for the gap analysis and fix plan.
2026-09-23, current position: the sync unit has closed the epoch-guard correctness gap and the extension-property gap (526 tests), and a second review of the guide (iri-patterns-post-3866b21-remediation, complete) corrected the guide and realigned the templates. The generated SPARQL’s caller contract changed: payload and log-bucket lists are Mustache request-time slots, and every write records a request digest (see tools/persistence/README.md, “Using the generated SPARQL directly”). Identity profiles are resolved per resource role (sync Slice 3); privacy and claim-scheme profiles are still unwired (sync Slices 4–5).
2026-09-25, re-sync complete: persistence-compiler-iri-sync finished Slices 4 and 5 — privacy/erasure profile resolution and checks (Slice 4), and uniqueness dal:onViolation reconciler operations plus dal:ClaimScheme dal:Dual rotation (Slice 5) — both human-validated. The compiler is now fully re-synced against the post-c276afb vocabulary: every profile dimension and SHACL shape that vocabulary added is resolved, checked, and (where it drives generated SPARQL) selected by tools/persistence. 774/774 tests pass under mise run check:persistence. Slice 6 (documentation close-out) is that unit’s own final pass.
Slice 3 (housekeeping first cut) has not been started and remains scoped as written in the plan.
Key findings from building Slice 2, beyond what the sketch anticipated:
Target is a (class, deployment) pair, one per distinct dal:GraphPatternScope a class has (via a new dal:coversClass property, added during implementation), plus one unscoped/fallback target. Documented in tools/persistence/README.md and ontology/persistence/docs/precedence-and-resolution.md.rdflib’s own SPARQL parser: (1) SPARQL 1.1 permits a property path only inside WHERE, never inside a DELETE/INSERT template block, and has no bounded {n,m} repetition at all — the sketch’s CompositePropertyBoundary worked SPARQL used both incorrectly. (2) A single SPARQL variable cannot stand in for an entire set of triples (GRAPH ?g { $payload } is not valid SPARQL) — every template needing to accept caller-supplied payload triples now uses a documented, non-SPARQL #PAYLOAD# text marker instead, which whatever eventually executes the template must splice in before submission. (Since 2026-09-23 this is the Mustache request-time slot }.)ontology/persistence/spec/persistence.ttl had one property the sketch’s Appendix A never declared (dal:aggregateBoundary, used inconsistently against the actually-declared dal:strategy), found and fixed in both the ontology and the sketch itself during implementation.pyshacl’s conforms flag treats any result, including sh:Warning severity, as non-conformant unless allow_warnings=True is passed — needed for the SharedClassProfileWarningShape design to work as a non-blocking warning at all.docs/architecture/rdf-sparql-patterns-guide.mdStatus: ✅ Complete.
docs/developer/sketches/persistence-profile-substrate.mdStatus: ✅ Complete, remediated per human review (concurrency renamed for what it provides, the capability model rebuilt as an unconditional-requirement-plus-optional-self-check with no live-backend dependency, the compiler’s canonical output made TTL rather than SPARQL text, and the hand-declared composition-property authoring surface dropped in favour of SHACL only). Governs Slice 2 and Slice 3.
Status: ✅ Accepted.
docs/developer/plans/rdf-sparql-patterns-phase-plan.mdStatus: ✅ Complete. Slice 2 executed as scoped; Slice 3 unchanged.
ontology/persistence| Path | Contents |
|---|---|
README.md |
purpose, the dal: prefix, three worked examples (single class, shared-class deployments, SHACL-declared composite boundary) |
spec/persistence.ttl |
the vocabulary, ~300 triples, all eleven sections (scopes, six dimensions, capability triad, templates/operations, compiled output) |
shapes/constraints.ttl |
self-validating SHACL shapes, including the mandatory-boundaryShape check and the SharedClassProfileWarningShape |
examples/ |
14 fixtures: 5 positive (including the lending/credit conflict and the SHACL-declared composite boundary), 5 cross-axis negative fixtures (one per sketch §3.5 row), 1 mixed-receipt-model warning fixture, 1 shared-class-profile warning fixture, 1 SHACL-level negative fixture (missing boundaryShape), 1 value-based-CAS positive fixture |
docs/precedence-and-resolution.md, docs/aggregate-boundaries.md |
the two design notes the plan required |
tools/persistencePython package (persistence), pyproject.toml, installable via mise run bootstrap:persistence. Modules: terms (the injection-safety encoder hierarchy), render (the type-enforced Mustache renderer), namespaces, scopes (including the Target model), resolver (the precedence algorithm), boundary (the SHACL closure walker), capability (requirement/spec/check), validator (every cross-axis check, named exception types), operations (template selection), compiler (orchestration and RDF emission), instantiate (the optional SPARQL-rendering stage), cli. 11 Mustache templates. 239 tests across 7 test modules, all passing.
Validation pack: docs/developer/validation/persistence-substrate-and-compiler.md.
Traceability: docs/traceability/matrix.csv.
docs/architecture/ontology-architecture.md — new §8a (Persistence), plus an Implementation Status table row.README.md — a new paragraph in “Ontology Layers”, a tree entry, a repository-structure check entry, and a “Validate the persistence compiler” section.mise.toml — bootstrap:persistence and check:persistence tasks, wired into the aggregate bootstrap and check tasks..gitignore — *.egg-info/ added (missing before this slice).| Slice | Identifier | Status |
|---|---|---|
| 1. Core patterns | rdf-sparql-core-patterns |
✅ Complete (fulfilled by the guide) |
| 2. Substrate and compiler | persistence-substrate-and-compiler |
✅ Complete |
| 3. Housekeeping first cut | housekeeping-first-cut |
Scoped, not started |
Unchanged from before Slice 2 began. Building the compiler did not resolve any of these; it also did not need to.
| # | Question | Where tracked |
|---|---|---|
| 1 | Request Query Mapping library design | lattice-platform-agentic-development-v0.2.md Part 13, row 11 |
| 2 | Query Execution component design | lattice-platform-agentic-development-v0.2.md Part 13, row 12 |
| 3 | Store SPI shape (proposed A75) | Not yet an ADR. Both items above depend on it |
| 4 | Whether dal: receipt/capability terms align to fnd:Evidence/fnd:recordedAt |
Sketch §3.1, not settled by Slice 2 |
| 5 | Whether a Java equivalent of tools/persistence is ever needed for JVM-embedded build pipelines |
ADR-A79 consequences, not scheduled |
New, found during Slice 2 (not previously tracked):
| # | Question | Notes |
|---|---|---|
| 6 | unconditional-write’s missing variants |
Only handles dal:NamedGraphBoundary. A target combining dal:ProvidedConcurrency/dal:LockingConcurrency with dal:CompositePropertyBoundary or dal:NoBoundary needs a second template variant, not yet built. |
| 7 | Multi-property CompositePropertyBoundary closures |
cas-replace-composite-property uses only the first composite property found, with + traversal. A shape with several sibling composite properties at one level needs a property-path alternation this first cut does not generate. |
python -m persistence instantiate.| Sketch/implementation section | Guide chapter |
|---|---|
| Precedence algorithm | Chapter 25 (capabilities, strategies, planners) |
| Aggregate boundary mechanisms | Part V, Chapter 19; §24.1 (tombstones) |
| Receipt model dimension | Chapter 20 |
| Ordering grain and dataset tier | Chapter 21, Chapter 22 |
| Uniqueness constraint | Chapter 8, §6.2 (key-claim write/retire) |
| Housekeeping job taxonomy (Slice 3, not yet built) | §7.5 (P7), S3, F5, §24.2 |
| Injection safety | Chapter 28 (QP1) |
ontology/persistence and persistence.{scopes,resolver,boundary}.tools/persistence in full (both compile and instantiate subcommands).See docs/traceability/matrix.csv.
platform/housekeeping Maven module, job contracts, configuration model split, generated queries via persistence instantiate, README, and docs/architecture/platform-housekeeping.md.CompositePropertyBoundary targets, if any exist.docs/developer/validation/persistence-substrate-and-compiler.md ✅ complete.docs/developer/validation/housekeeping-first-cut.md (to be created at slice start).docs/developer/validation/LOG.md (not yet created; human sign-off per the plan’s Part 3 five-step gate is still pending).