SHACL shapes
Validation rules expressed as SHACL — generated programmatically from JSON Schema constraints, with manual additions for cross-property business rules.
The Ontology manual's Physical-Ontology tier covers the generator-emitted SHACL work: Severity tiers (Cat 1–4 classification for shape violations) and SHACL-AF rules (derived-attribute and succession rules using the SPARQL extension). These are the realised output; this page describes the generation approach and business-rule authoring model.
This is a stub for upcoming work. The structure below is what we plan to populate; existing artefacts in source/ that feed it are cited inline.
Why SHACL alongside JSON Schema?
JSON Schema validates JSON documents. SHACL validates RDF graphs. PDTF v2.0 is built on W3C VC, which is fundamentally graph-shaped. Both tools serve different audiences:
- JSON Schema — used by validators in client/server code (AJV etc.) at API boundaries
- SHACL — used when claims are aggregated into a transaction graph and need cross-claim validation
Generation pipeline
What translates mechanically
Most JSON Schema constraints have direct SHACL equivalents:
| JSON Schema | SHACL |
|---|---|
required | sh:minCount 1 |
type | sh:datatype / sh:nodeKind |
enum | sh:in |
pattern | sh:pattern |
minimum / maximum | sh:minInclusive / sh:maxInclusive |
minLength / maxLength | sh:minLength / sh:maxLength |
What needs hand-authoring
- Cross-property dependencies (e.g. if tenure = leasehold, then groundRent is required)
- Cross-claim rules (e.g. BASPI v5 disclosure and TA6 answer must be consistent)
- Claim-provenance rules (e.g. title information must be issued by HMLR)
Target folder: source/00-deliverables/semantic-models/shapes/.
Comments