Ontology · Knowledge graphs

SHACL for knowledge graphs: a practical validation checklist

An ontology describes what your world can contain. It does not stop bad data getting into the graph. That is SHACL's job, and most knowledge graph projects add it too late.

ChecklistSumanta Mukhopadhyay7 min read5 sources
#ontology#knowledge-graph#data#ai
CHECKLIST · ONTOLOGY · KNOWLEDGE GRAPHS20 Oct 2026 · 12:30 GST

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.

OWLSHACL
Question it answersWhat follows from what we know?Is this data acceptable?
Missing valueUnknownA violation, if the shape requires it
OutputInferred factsA validation report
Typical ownerOntology and domain expertsData 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

  1. 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.
  2. 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.
  3. 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.
  4. Decide where inference sits. If you validate after reasoning, test that inferred facts don't create spurious violations, particularly with closed shapes5.
  5. 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.
  6. Track validation results over time. Violation counts per source and per shape are a data quality metric the business can understand.
  7. 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.
  8. 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.

References
  1. 1
    Shapes Constraint Language (SHACL)W3C Recommendation · 20 Jul 2017
  2. 2
  3. 3
    SHACL 1.2 Core (Working Draft)W3C Data Shapes Working Group · 2026
  4. 4
  5. 5
FAQ

Common questions

What is SHACL?

The Shapes Constraint Language, a W3C Recommendation since July 2017. It validates RDF data graphs against conditions described in shapes graphs and produces a validation report.

What is the difference between OWL and SHACL?

OWL works under an open-world assumption: a missing fact is unknown, not false, and OWL is used to infer new facts. SHACL validates the data as it is, so a missing required property is reported as a violation. Many teams use both.

Is there a new version of SHACL?

The W3C Data Shapes Working Group has published SHACL 1.2 Working Drafts in 2026, including Core, SPARQL Extensions and Node Expressions. They are drafts and may change; the 2017 Recommendation remains the stable reference.

Keep reading

Related

Open to advisory, fractional CTO & select builds

Let's talk about what you're building.

The fastest route is a free 30-minute call. Prefer to write? Send a message and I'll reply personally within two business days.

Start a conversation

How would you like to reach me?

Book a 30-min callFastest. Pick any open slot on my calendar.→ Write in GmailOpens a pre-filled draft in your browser.→ Use my email appOutlook, Apple Mail or your default client.→

I reply personally within two business days. US & UAE time zones.