SHACL validation reports
SHACL Validation Reports
SHACL (Shapes Constraint Language) validation reports are structured documents that provide detailed information about the results of validating RDF data against SHACL shapes. These reports are crucial for understanding the conformance of data to predefined constraints and for identifying and addressing data quality issues.
Structure of a SHACL Validation Report
A SHACL validation report is itself an RDF graph, typically serialized in Turtle or JSON-LD format. The report contains the following key components:
Conforms Property
The sh:conforms
property indicates whether the validated data graph conforms to all shapes. It has a boolean value:
- true: The data graph conforms to all shapes
- false: At least one shape was violated
Result Nodes
For each constraint violation, the report includes a result node with the following properties:
sh:resultSeverity
: Indicates the severity of the violation (sh:Violation, sh:Warning, or sh:Info)sh:focusNode
: The RDF node that was validated against the shapesh:resultPath
: The property path related to the constraint violation (if applicable)sh:value
: The RDF node value that caused the violation (if applicable)sh:sourceShape
: The specific shape that was violatedsh:sourceConstraintComponent
: The constraint component that was violatedsh:message
: A human-readable message describing the violation
Example SHACL Validation Report
Here's a simple example of a SHACL validation report in Turtle format:
@prefix sh: <http://www.w3.org/ns/shacl#> . @prefix ex: <http://example.com/> . [] a sh:ValidationReport ; sh:conforms false ; sh:result [ a sh:ValidationResult ; sh:resultSeverity sh:Violation ; sh:focusNode ex:John ; sh:resultPath ex:age ; sh:value "twenty" ; sh:sourceShape ex:PersonShape ; sh:sourceConstraintComponent sh:DatatypeConstraintComponent ; sh:message "Value is not a valid integer" ; ] .
Using SHACL Validation Reports
SHACL validation reports can be used for various purposes:
- Data Quality Assurance: Identify and correct data that doesn't conform to the expected structure or constraints.
- Application Development: Ensure that data meets the requirements of applications before processing.
- Data Integration: Validate data from external sources before integrating it into a system.
- Compliance Checking: Verify that data adheres to specific standards or regulations.
Tools for Working with SHACL Validation Reports
Several tools can generate and process SHACL validation reports:
- TopBraid Composer: A commercial tool for creating and running SHACL validations
- Apache Jena: An open-source Java framework that includes SHACL validation capabilities
- RDF4J: Another open-source framework with SHACL support
- pyshacl: A Python library for SHACL validation
External Links
⚠️ LLM-generated content notice: Parts of this page may have been created or edited with the assistance of a large language model (LLM). The prompts that have been used might be on the page itself, the discussion page or in straight forward cases the prompt was just "Write a mediawiki page on X" with X being the page name. While the content has been reviewed it might still not be accurate or error-free.