A common pattern in knowledge graph projects: the team spends months on a careful ontology, loads data from a dozen sources, and then discovers that a third of the customer nodes have no country, some products have two prices and a few suppliers are typed as people. Nothing in the ontology stopped it, because that isn't what an ontology does.
OWL and SHACL do different jobs
OWL reasons under an open-world assumption: a missing fact is unknown, not false, and the language is built to infer new facts from the ones you have. SHACL validates the data graph as it stands, so a missing required property is a violation5. The W3C Recommendation describes this as checking "data graphs" against conditions in "shapes graphs"1.
| OWL | SHACL | |
|---|---|---|
| Question it answers | What follows from what we know? | Is this data acceptable? |
| Missing value | Unknown | A violation, if the shape requires it |
| Output | Inferred facts | A validation report |
| Typical owner | Ontology and domain experts | Data engineering and data quality |
Combining the two is not trivial. Research from TU Wien describes the semantic gap between OWL reasoning and SHACL validation as a major challenge, and notes conflicts, for example between reasoning and closed shapes5. In practice I keep them in separate stages and decide explicitly whether validation runs before or after inference.
The checklist
- Write shapes for the entities that matter first. Customer, product, patient, supplier: whatever your use cases depend on. Cardinality, datatypes, allowed values and required relationships cover most real problems.
- Validate at the boundary. Run SHACL on each source's data before it joins the main graph, so bad data is quarantined with a report rather than merged.
- Use severities deliberately. Not every failure should block a load. Separate hard violations from warnings, and route warnings to the data owner instead of the pipeline.
- Decide where inference sits. If you validate after reasoning, test that inferred facts don't create spurious violations, particularly with closed shapes5.
- Keep shapes in version control next to the ontology, reviewed like code and changed through the same process. A shape change can reject yesterday's valid data.
- Track validation results over time. Violation counts per source and per shape are a data quality metric the business can understand.
- Validate what AI writes. When an LLM extracts entities into the graph, as in GraphRAG, run its output through the same shapes. Extraction errors are cheap to catch at the door and expensive to find later.
- Pair with entity resolution. Shapes catch malformed records; they don't catch two records for the same customer. That needs entity resolution.
The rule I give teams: no data enters the shared graph without passing its shapes. The ontology says what the world looks like; the shapes are the contract every source has to meet.
Where the standard is going
SHACL became a W3C Recommendation in July 2017, with Core constraints and SPARQL-based extensions12. The W3C Data Shapes Working Group is now developing SHACL 1.2, with 2026 Working Drafts for Core and for Node Expressions among others34. They are drafts and may change, so I build on the 2017 Recommendation and track 1.2 for features worth adopting once they settle.
Why this matters for AI
Knowledge graphs are increasingly the grounding layer for LLM applications. A graph that answers confidently with malformed or contradictory data is worse than no graph, because the model will present it fluently. Validation is what makes a graph trustworthy enough to ground AI, and it fits the layered model in ontology vs knowledge graph vs semantic layer.
How I can help
I design ontologies, shapes and validation pipelines for enterprise knowledge graphs, so they stay trustworthy as sources and AI extraction grow. See ontology and knowledge graphs, or analyse your challenge and bring the result to a call.
- 1Shapes Constraint Language (SHACL)W3C Recommendation · 20 Jul 2017
- 2
- 3SHACL 1.2 Core (Working Draft)W3C Data Shapes Working Group · 2026
- 4SHACL 1.2 Node Expressions (First Public Working Draft)W3C · 8 Jan 2026
- 5SHACL Validation in the Presence of Ontologies: Semantics and Rewriting TechniquesOudshoorn, Ortiz and Šimkus, TU Wien (arXiv) · 2025