verifiedPillar 4 — Validation (SHACL Core)
pgrdf.validate(data_graph_id BIGINT, shapes_graph_id BIGINT, mode TEXT DEFAULT 'native') → JSONB validates the data graph against the shapes graph and returns a W3C sh:ValidationReport-shape JSONB document.
The default mode => 'native' is genuine W3C SHACL Core — the full SHACL Core constraint set, conformant against the W3C SHACL Core test suite at 25/25. Backed by the shacl crate from the rudof project. mode => 'sparql' exposes the SHACL-SPARQL surface — see SHACL-SPARQL.
Topics in this pillar
- info Mental model.
- description Worked example — minCount, datatype, nodeKind constraints.
- verified SHACL Core components — what's supported.
- fact_check Report as data — querying violations with regular SQL.
- verified SHACL-SPARQL —
mode => 'sparql'custom-constraint surface (shipped + honest; the constraint execution engine is an upstream gate, E-012).
At a glance
sql
SELECT pgrdf.validate(1, 2);
-- → { "conforms": false, "results": [ {...}, {...} ] }auto_storiesTraining
Validation is the simplest of the four pillars conceptually — one UDF, one report — but the SHACL Core surface is broad. Take the pages in order:
- info Start with the Mental model — what a shapes graph is, what a validation report is, why this matters.
- description Run the Worked example — minCount + datatype + nodeKind constraint composition, end-to-end in psql.
- verified Read the SHACL Core components reference — what's supported and what's not. Bookmark this page.
- fact_check Then Report as data — SHACL reports are JSONB. Querying violations with regular SQL is the gate-ingestion idiom.
- verified Then SHACL-SPARQL — the
mode => 'sparql'surface for custom constraint components defined as embedded SPARQL; shipped and honest about the upstream-gated execution engine (E-012).
Learn more
- school Shapes Constraint Language (SHACL) — the W3C recommendation.
- school SHACL Playground — paste a data graph + shapes graph, see the report in your browser. Great for prototyping.
- code rudof project's
shaclcrate — the engine pgRDF wraps. - school Knublauch & Kontokostas, Validating RDF Data — book on SHACL by the spec editors.
- mic Audio companion — five episodes covering the validation pillar (see Training).