SHACL validation in RDF Studio follows a clear workflow: generate shapes from your ontology, validate your data, review violations, fix issues, and re-validate. This article walks through each step.
Before you can validate, you need SHACL shapes. RDF Studio can generate them automatically from your OWL ontology.
The translator produces a complete shapes graph covering every class and property in your ontology. You'll see the generated Turtle in the SHACL viewer.
Before validating, scan the generated shapes to understand what will be checked:
rdfs:domain
sh:minCount 1
# Example: EmployeeShape nws:EmployeeShape a sh:NodeShape ; sh:targetClass nwo:Employee ; sh:closed true ; sh:ignoredProperties ( rdf:type ) ; sh:property [ sh:path nwo:firstName ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:order 0 ; ] ; sh:property [ sh:path nwo:lastName ; sh:datatype xsd:string ; sh:minCount 1 ; sh:maxCount 1 ; sh:order 1 ; ] .
Ask yourself:
firstName
sh:closed true
With shapes ready, run validation:
The report groups violations by shape and property:
Each violation tells you:
nwr:employee-7
nwo:birthDate
sh:MinCountConstraintComponent
Focus: nwr:employee-7 Path: nwo:birthDate Constraint: sh:MinCountConstraintComponent Message: "Less than 1 values"
Cause: The shape requires birthDate (sh:minCount 1), but employee-7 doesn't have one.
birthDate
Fix options:
Focus: nwr:product-5 Path: nwo:unitPrice Constraint: sh:DatatypeConstraintComponent Message: "Value '29.99' is not of datatype xsd:decimal"
Cause: The value is a plain string "29.99" instead of a typed literal "29.99"^^xsd:decimal.
"29.99"
"29.99"^^xsd:decimal
Fix: Ensure your data loader applies correct XSD datatypes to literals.
Focus: nwr:employee-1 Path: foaf:nickname Constraint: sh:ClosedConstraintComponent Message: "Property foaf:nickname is not allowed"
Cause: sh:closed true is set, and foaf:nickname is not in the EmployeeShape.
foaf:nickname
sh:ignoredProperties
Focus: nwr:order-10248 Path: nwo:orderedBy Constraint: sh:ClassConstraintComponent Message: "Value does not have class nwo:Customer"
Cause: The orderedBy property points to something that isn't typed as Customer.
orderedBy
Customer
Fix: Check the target instance — it may be missing its rdf:type declaration.
rdf:type
After reviewing violations, you have three paths:
If violations reveal genuine data quality issues:
If constraints are too strict for your data:
sh:minCount
sh:closed
If many shapes need adjustment:
Closed Shapes
Best for: Production data quality, data imports, compliance.
Best for: Exploratory data analysis, early-stage development.
Best for: Large datasets, legacy data migration.