Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

docs(case-studies): add dcat-us-binding, and the two validator defects it found

Fabio Rovai37819070d814
diff --git a/README.md b/README.md
index 6b451778..b37cd4a0 100644
--- a/README.md
+++ b/README.md
@@ -332,6 +332,7 @@ The benchmarks below are not a feature tour. Each one exists to answer a specifi
| **RQ6** | Can the SHACL-SPARQL governance rules an ontology ships actually be executed as written at national scale, or does the reference store force a workaround? | [`investment-fund-ontology`](case-studies/investment-fund-ontology/): 1.29M-triple US fund universe, 4 layer-3 rules, rdflib 7.6.0 A/B | **Store-specific.** rdflib finishes the anti-join (0.1s) and nested aggregate (0.8s) but times out (>300s) on both multi-way self-joins — exactly the cross-source reconciliation rules the ontology exists for. This repo's Oxigraph engine runs load + all four rules, unmodified, in 2.1s, reproducing the reference pipeline's published counts (73 / 0 / 214 / 2,148) exactly. The shapes also forced two validator fixes here: `sh:inversePath` support and `sh:severity` reporting. |
| **RQ7** | When the graph is register-scale (276k triples) rather than fund-universe-scale (1.29M), does the reference store still force the set-based workaround, and do the rule counts survive entity resolution? | [`insurance-register-ontology`](case-studies/insurance-register-ontology/): 276,683-triple EEA insurance register, 6 layer-3 rules, rdflib 7.6.0 A/B | **The workaround becomes speed, not survival.** At this scale rdflib completes all six rules (133.2s total, 97s of it in one double anti-join) against 2s to 9s for the Oxigraph engine; nothing times out. Counts match the reference pipeline exactly on R1-R4 (643 / 4 / 118 / 42). R5 falls from 227 to 20 and R6 rises from 283 to 291 because the graph runs the same rule text after entity resolution, which absorbs the legitimate branch shares and attributes 8 more zombie passports via the LEI join; both differences were verified set-based. The shapes forced two more validator fixes: `sh:pattern` and `sh:hasValue`. |
+| **RQ8** | When a published standard ships a validator but no RDF binding, does a green SHACL result mean the data is valid, or that nothing was checked? | [`dcat-us-binding`](case-studies/dcat-us-binding/): DCAT-US 3.0, the US federal metadata profile, 115 published examples, pySHACL vs this engine | **It means nothing was checked, and the distinction is invisible without reporting reach.** The corpus as published expands to **76 triples, 1 predicate, 0 DCAT**, so the shapes GSA deleted select **0 focus nodes** and return `conforms=True`. Generating a JSON-LD context from the same JSON Schema that already carries the RDF terms (231 of 270 properties) lifts the corpus to **1,510 triples and 228 DCAT statements**, and the *same deleted shapes*, unchanged, then select **228 focus nodes and report 287 violations**. This is why `onto_shacl` reports `focus_nodes` next to the verdict. The run also cost us two defects here: `sh:class` and `sh:nodeKind` are not evaluated at all (287 of pySHACL's 316 findings invisible), and `sh:datatype` rejects `"1024"^^xsd:nonNegativeInteger` against `sh:datatype xsd:nonNegativeInteger`. |
RQ2 and RQ4 are the ones worth reading if you are deciding whether to trust this repo. Both are negative results about work done here.
diff --git a/case-studies/dcat-us-binding/README.md b/case-studies/dcat-us-binding/README.md
new file mode 100644
index 00000000..8d8d4fce
--- /dev/null
+++ b/case-studies/dcat-us-binding/README.md
@@ -0,0 +1,89 @@
+# dcat-us-binding
+
+**A national metadata standard that claims conformance to W3C DCAT, whose 115 published
+examples expand to 76 triples, one predicate and zero DCAT. The engine was used to
+cross-check the repair, and the same run exposed two defects in the engine itself.**
+
+Code and full evidence live in a standalone repository:
+**[fabio-rovai/dcat-us-binding](https://github.com/fabio-rovai/dcat-us-binding)**.
+This page records what the case study contributes here.
+
+## The situation
+
+[DCAT-US 3.0](https://github.com/GSA/dcat-us) is the metadata profile every US federal
+agency publishes against, maintained by GSA for data.gov. Its README states it is "an
+implementation of the World Wide Web Consortium's (W3C) DCAT standard". DCAT v3 section
+4 defines conformance in RDF terms.
+
+The project inherited a website, a JSON Schema and a SHACL definition that were out of
+sync, with nobody left who knew which was authoritative, and collapsed to the JSON
+Schema as the single source of truth. The SHACL file was deleted in PR #120. What was
+never published is a JSON-LD context, so the JSON has no defined RDF interpretation at
+all.
+
+## The result
+
+| Expansion of the same 115 unedited example files | Triples | Predicates | DCAT triples | Empty files |
+| --- | --: | --: | --: | --: |
+| As published | 76 | 1 | **0** | 38 |
+| With the generated binding | **1,510** | **123** | **228** | 10 |
+
+The binding was not written. 26 of 26 classes and 231 of 270 properties already record
+the RDF term they stand for, in `_oldDocs` blocks retained when SHACL was retired. The
+context and the shapes are generated from those records, which is the point: two
+projections of one source cannot contradict each other, so the objection that killed
+SHACL upstream ("two validations that do not agree") stops applying.
+
+## What validation reach means here
+
+| Run | `conforms` | Target classes matched | Focus nodes | Results |
+| --- | --- | --- | --: | --: |
+| Deleted shapes, corpus as published | `True` | 0 / 34 | 0 | 0 |
+| Deleted shapes, corpus with the binding | `False` | 23 / 34 | 228 | 287 |
+| Generated shapes, corpus with the binding | `False` | 24 / 24 | 191 | 316 |
+
+The first row is the failure mode this repository exists to name. A SHACL run reports
+`conforms` whether or not any shape matched anything, so a green result is ambiguous by
+construction. Zero focus nodes and zero violations is not a pass, it is a miss, and
+`onto_shacl` reports `focus_nodes` alongside the verdict for exactly this reason. The
+shapes GSA deleted were not stale. They were pointed at a graph that did not exist.
+
+## What it forced in this engine
+
+Both cross-checks were run through `open-ontologies batch` (`load` then `shacl`) against
+pySHACL on identical inputs. The two agree exactly on reach, 191 focus nodes each, and
+disagree on findings:
+
+| Measure | pySHACL | this engine |
+| --- | --: | --: |
+| `sh:class` results | 165 | **0** |
+| `sh:nodeKind` results | 122 | **0** |
+| `sh:maxCount` results | 27 | 27 |
+| `sh:datatype` results | 2 | **8** |
+
+Two defects, both ours:
+
+1. **`sh:class` and `sh:nodeKind` are not evaluated.** 287 of pySHACL's 316 findings are
+ invisible to the engine.
+2. **`sh:datatype` rejects a correctly typed literal for derived numeric types.**
+ `"1024"^^xsd:nonNegativeInteger` fails `sh:datatype xsd:nonNegativeInteger`, while
+ `xsd:integer`, `xsd:decimal` and `xsd:string` all pass. Eight-line repro in the
+ standalone repository's `tests/test_engine_findings.py`.
+
+A third defect belongs to rdflib 7.6.0, which raises `UnboundLocalError` from
+`plugins/parsers/jsonld.py:242` on a scalar JSON-LD document rather than producing the
+empty graph the specification calls for.
+
+## Reproducing
+
+```sh
+git clone https://github.com/fabio-rovai/dcat-us-binding
+cd dcat-us-binding && pip install -e '.[dev]' && make build && make test
+```
+
+Then the engine leg:
+
+```sh
+printf 'load build/corpus.expanded.ttl\nshacl build/dcat-us-3.0-shapes.ttl\n' \
+ | open-ontologies batch -
+```