SHACL shapes
Validation rules expressed as SHACL — generated programmatically from JSON Schema constraints, with manual additions for cross-property business rules.
Status
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
flowchart LR
classDef src fill:#eef4f8,stroke:#1a4d80,color:#0b2545;
classDef proc fill:#fef3c7,stroke:#b45309,color:#7c2d12;
classDef out fill:#dcfce7,stroke:#166534,color:#14532d;
JS[JSON Schema v3
+ overlays]:::src ONT[Ontology .ttl]:::src GEN[Translator
schema → SHACL]:::proc HAND[Hand-authored
business rules]:::src SHAPES[SHACL .ttl
per overlay]:::out JS --> GEN ONT --> GEN GEN --> SHAPES HAND --> SHAPES
+ overlays]:::src ONT[Ontology .ttl]:::src GEN[Translator
schema → SHACL]:::proc HAND[Hand-authored
business rules]:::src SHAPES[SHACL .ttl
per overlay]:::out JS --> GEN ONT --> GEN GEN --> SHAPES HAND --> SHAPES
Mechanical translation of JSON Schema constraints + hand-authored cross-property rules.
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/.