SHACL shapes

    Validation rules expressed as SHACL — generated programmatically from JSON Schema constraints, with manual additions for cross-property business rules.

    See also: Ontology manual — Physical-Ontology tier

    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.

    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. The SPDTF (Smart Property Data Trust Framework) 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 JS["`JSON Schema v3 + overlays`"]:::external ONT[Ontology .ttl]:::external GEN["`Translator schema → SHACL`"]:::process HAND["`Hand-authored business rules`"]:::external SHAPES["`SHACL .ttl per overlay`"]:::security 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 SchemaSHACL
    requiredsh:minCount 1
    typesh:datatype / sh:nodeKind
    enumsh:in
    patternsh:pattern
    minimum / maximumsh:minInclusive / sh:maxInclusive
    minLength / maxLengthsh: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

    Loading comments…