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 shapes graph with one shape per OWL class and a property shape for every property that declares a domain (rdfs:domain) or is named in a restriction. The new shapes file appears as a highlighted card in the Shapes list.
rdfs:domain
Before validating, scan the generated shapes to understand what will be checked:
sh:minCount 1
# Example: EmployeeShape (as generated for Northwind, abridged) nws:EmployeeShape a sh:NodeShape ; sh:targetClass nwo:Employee ; sh:name "Employee" ; sh:property [ sh:path nwo:address ; sh:datatype xsd:string ; sh:nodeKind sh:Literal ; sh:order 0 ; ] ; sh:property [ sh:path nwo:birthDate ; sh:datatype xsd:dateTime ; sh:maxCount 1 ; sh:nodeKind sh:Literal ; sh:order 2 ; ] ; sh:property [ sh:path rdfs:label ; sh:minCount 1 ; ] . # No sh:closed here: Employee has subclasses, so its shape stays open. A class # without subclasses (Customer) gets a closed shape.
Ask yourself:
rdfs:label
With shapes ready, run validation:
The report is one table with a row per finding (the first 10,000 when there are more — a Results truncated chip says so, and the counts above the table stay complete), sorted by severity:
Each violation tells you:
nwd:employee-7
MinCountConstraintComponent
sh:message
Focus: nwd:employee-7 Path: rdfs:label Constraint: MinCountConstraintComponent Message: "MinCountConstraintComponent violated on <http://www.w3.org/2000/01/rdf-schema#label>"
Cause: With Closed shapes on and the rdfs:label rule left at its default (Violation), every generated shape requires rdfs:label (sh:minCount 1), but employee-7 has no label.
Fix options:
Focus: nwd:product-5 Path: nwo:unitPrice Constraint: DatatypeConstraintComponent Message: "DatatypeConstraintComponent violated on <http://example.org/ontology/northwind#unitPrice>"
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: nwd:customer-ALFKI Path: foaf:nickname Constraint: ClosedConstraintComponent Message: "ClosedConstraintComponent violated on <http://xmlns.com/foaf/0.1/nickname>"
Cause: CustomerShape is generated closed (Customer has no subclasses), and foaf:nickname is not in it.
foaf:nickname
sh:ignoredProperties
Focus: nwd:order-10248 Path: nwo:hasCustomer Constraint: ClassConstraintComponent Message: "ClassConstraintComponent violated on <http://example.org/ontology/northwind#hasCustomer>"
Cause: The hasCustomer property points to something that isn't typed as Customer.
hasCustomer
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
sh:closed true
Best for: Production data quality, data imports, compliance.
Best for: Exploratory data analysis, early-stage development.
Best for: Large datasets, legacy data migration.