rdfs:subClassOf and entailment

Declare a hierarchy; get extra triples for free.

0/3 done

Theory

rdfs:subClassOf says every instance of A is also an instance of B.

:Ninja  rdfs:subClassOf :Person .
:Donatello a :Ninja .

RDFS entailment lets a reasoner conclude :Donatello a :Person . without you stating it. Inference is free triples.

Crucial mindset shift: RDFS is entailment, not constraint. Declaring :Ninja rdfs:subClassOf :Person does not reject data — it adds new triples (:Donatello a :Person .) on top of what you stated. If you want to reject invalid data, that's SHACL's job (Level 6). RDFS makes your graph bigger; SHACL keeps it honest.

Theory

Going deeper — where it bites

Entailment is monotonic. Adding triples can only add conclusions, never retract them. So a too-broad rdfs:subClassOf quietly pollutes your graph forever: declare :Ninja rdfs:subClassOf :Person when some ninjas are actually robots, and the reasoner will insist every robot-ninja is a :Person — and nothing you add later can take that back. You fix it by removing the bad axiom, not by adding a correction.

rdfs:domain / rdfs:range infer types — they do not check them. This is the single biggest RDFS surprise. If you declare :knows rdfs:range :Person and then write :Alice :knows 42, RDFS does not flag an error — it concludes 42 a :Person, which is nonsense but logically valid under the open-world, inference-not-constraint model. Treat domain/range as 'classify the endpoints', and reach for SHACL (Level 6) the moment you actually mean 'reject anything else'.

The open-world assumption underlies all of this: missing facts are unknown, not false. RDFS never concludes something is absent — only that more things are present.

Analogy

If every dachshund is a dog and every dog is a mammal, then your dachshund is a mammal — even if nobody wrote it down. Subclass hierarchies make that leap automatic.

And like in biology, the inference is cumulative: declare two levels of subclass and every fact true of mammal becomes true of dachshund too. You model the spine of the tree once; the reasoner fills in every branch.

Visualization

Thing Person Student Master subClassOf subClassOf subClassOf

A subclass hierarchy is a tree of is-a relationships. Anything true of a parent is automatically true of every descendant.

Reading in progress · 0 of 3 activities done