What the hell is water?

Understanding the fundamental difference between OWL and SHACL - open world vs closed world assumptions in RDF modeling

By Greg Ruhnow
semantic-webrdfontologytechowlshacl

What the hell is water?

Assumptions in RDF Modeling

There is a famous parable David Foster Wallace used in his 2005 commencement speech:

Two young fish are swimming along. They pass an older fish who nods and says,
“Morning, boys. How’s the water?”
The two young fish swim for a while, and eventually one turns to the other and asks,
“What the hell is water?”

The point is that the most pervasive assumptions, the ones shaping everything we do, are often the hardest to see.

RDF modeling has exactly this problem.

When people debate SHACL vs OWL, they usually talk about surface distinctions:
entailment vs validation, inference vs constraints.

But what they are actually choosing, often without noticing, is a worldview: open world vs closed world.

And like freshwater vs saltwater, the fish may look the same, but they are fundamentally different.


OWL (The Open World)

In OWL, you are stating truths about the world.
The logic flows from Structure -> Type.

  • Mindset: “If it acts like a duck, it is a duck.”
ex:Person a owl:Class ;
  rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty ex:hasParent ;
    owl:cardinality 2 ;
  ] .

“Every ex:Person has exactly two ex:hasParent relationships.”

TypeParents PresentInterpretation under OWL (Open World)
untyped2 parentsWe can infer that the individual is ex:Person.
untyped1 or 0It may still be a Person; the graph may simply be incomplete.
ex:PersonunknownWe infer that exactly two parents exist somewhere, even if they are not stated.
ex:Person1 parentThe missing parent is assumed to exist.
ex:Person3 parentsIt is possible that two of the parents are actually the same individual.

Key idea: absence of evidence is not evidence of absence.
Missing data is assumed. The world is incomplete.

OWL behaves like scientists who, when they find one fossil, assume more may still be buried.


SHACL (The Closed World)

In SHACL, the logic is inverted.
The logic flows from Type -> Structure.

  • Mindset: “If you claim to be a duck, you had better have feathers.”
ex:Person a rdfs:Class, sh:NodeShape ;
  sh:property [
    sh:path ex:hasParent ;
    sh:minCount 2 ;
    sh:maxCount 2 ;
  ] .

“Every ex:Person must have exactly two ex:hasParent relationships in the data being validated.”

TypeParents PresentInterpretation under SHACL (Closed World)
untypedanyNot applicable.
ex:Person2 parentsValid.
ex:Person1 or 0Invalid.
ex:Person3 parentsInvalid.

The graph is taken as complete.
If it is not there, it does not exist.

SHACL behaves like accountants:
“Show me the receipts. If they are not on the page, they do not count.”


This is what you are buying into when you make the choice of modeling with OWL vs modeling with SHACL: open world vs closed world, freshwater vs salt.

You can get entailment while modeling with SHACL by mixing in RDFS and OWL.
You can get validation while modeling with OWL by using SHACL.

Do not choose based only on functionality, you can get fish in either one. Choose the water.