This summer I am stepping in for my friend Katariina Kari1 as an instructor for the Knowledge Graph Academy by The Knowledge Graph Guys. And during Tuesday’s class about ontology fundamentals, we got chatting about these magical terms entailment, inference, and reasoning.
I was really inspired by the class to write a piece about these terms. So, here I am with an abnormally large mojito and my mechanical keyboard. Ready to let the words flow.
In this course, we’re working with creating semantic models about the world of music. So I will cook up an example touching upon that topic.
Suppose you keep your record collection as a knowledge graph (you guessed right, ofc I do!). And you write down a modest set of facts like “this album is on vinyl”, “that person created it”, “you bought it in 2005”. You never once say that “Trent Reznor is an artist” or “this is a good pressing”. Yet, a well-designed graph, handed to the right engine, will tell you both! It will answer questions you never explicitly stated. ✨
You can find the ontology in RDF Turtle at this code-paste site.
Three mysterious words
In their simplest terms, they mean:
Entailment: the what, the facts that must be true given what you’ve said.
Inference: the how, the mechanical rules that derive those facts.
Reasoning: the process, an engine applying inference to check, classify and answer.
Entailment
Entailment is a semantic relation2 between statements (or graphs for that matter), defined by model theory3. A statement S entails a statement T when every interpretation that makes S true also makes T true. There is no way we can accept S and reject T.
In other words, entailments are static, semantic facts about what follows from what. It exists whether or not anyone ever computes it. When we say that genre:blackgaze skos:broader genre:blackMetal entails genre:blackMetal skos:narrower genre:blackgaze, we’re making a claim about meaning; given the semantics of SKOS, you cannot consistently assert the first and deny the second.
Crucially, entailment is always relative to a set of semantics. The same triple entail different things depending on if it’s under RDF, RDFS, or OWL. More on that later!
Inference
Inference is the procedure that computes entailments. It’s a set of rules; “if you see that statement, add this statement”, applied until nothing new appears. RDFS comes with such a ruleset4. One example (rdfs9) says:
IF ?c rdfs:subClassOf ?d AND ?x rdf:type ?c
THEN ?x rdf:type ?d If you run that rule (and its siblings) over your data, you’ll materialise new triples that were previously implicit. Good inference rules are sound and complete, meaning they derive every entailment. Inference is how the more abstract “must be true” of entailments becomes concrete triples(/statements/facts).
So, one can say that entailment defines the target, while inference is one method of hitting it!
Reasoning
Reasoning is the broadest of the three terms. It’s the whole job a reasoner does. A reasoner derive new statements, but it also does:
consistency checks, making sure that your graph is satisfiable and don’t contain contradictions,
classifies, how your classes sits relative to one another,
answers queries under an entailment regime, returning results that accounts for what’s entailed.
Put the other way around, you can say that inference are steps in the reasoning activity.
In RDFS, “reasoning” and “inference” are almost the same thing, because pretty much everything reduces to adding entailed triples.
In OWL, they diverge a bit. A reasoner might tell you that a class is unsatisfiable (nothing could ever be a member) or that two differently named individuals must be the same (conclusions that aren’t just adding more triples).
A short analogy
Entailment is the set of all theorems that hold in every model of a set of axioms, true by definition, whether or not anyone has proven them. Inference is the individual proof steps you chain together. Reasoning is the mathematician (or the theorem prover) that’s doing the work, deciding what to price, discovering contradictions and organising the results.
Entailment is what, inference how, and reasoning action! 🎬
The ladder of entailment regimes
The reason one graph can entail different things is that one can “choose how much semantics” is switched on.
RDF entailment: simple triple statements
RDFS entailment: subclass hierarchies, domain and range
OWL entailment (DL): equivalence, disjointness, cardinality, inverse and transitive properties, datatype restrictions
SKOS can also be seen in this mix, as the SKOS vocabulary itself is defined using RDFS and OWL, so you’ll have entailment shipped with SKOS axioms thereafter.
RDFS in action
Let us put some records in the collection. Here’s a slice of instance data.
:DownwardSpiral a :Album ;
:hasMedium :DS-vinyl ;
:hasGenre genre:industrial .
:DS-vinyl a :Vinyl ;
:pressingDate "1994-03-08"^^xsd:date ;
:hasCondition cond:vgplus .
:Trent
:name "Trent Reznor" ;
:gender gender:Male ;
:created :DownwardSpiral .
:MyOwnership
:owns :DownwardSpiral ;
:owner :Me ;
:startDate "2005-06-01"^^xsd:date . Notice what we do not say. We never type that :Trent is an :Artist. And we never said that :Me is a :Person. We never called :DownwardSpiral a :CreativeWork. But RDFS entailment supplies all three statements.
Domain and range
The ontology declare stuff like:
:created a owl:ObjectProperty ;
rdfs:domain :Artist ;
rdfs:range :CreativeWork .The RDFS domain and range rules (rdfs2 and rdfs3) says:
rdfs2: IF ?p rdfs:domain ?c AND ?s ?p ?o THEN ?s rdf:type ?c
rdfs3: IF ?p rdfs:range ?c AND ?s ?p ?o THEN ?o rdf:type ?cApply them to the statement :Trent :created :DownwardSpiral:
:Trent rdf:type :Artist . # from rdfs2 (domain of :created)
:DownwardSpiral rdf:type :CreativeWork . # from rdfs3 (range of :created)The same machinery over :owner (range :Person) and :gender (domain :Person):
:Me rdf:type :Person . # :owner has range :Person
:Trent rdf:type :Person . # :gender has domain :PersonSo Trent ends up typed as both :Artist and :Person. In this ontology, :Person is a rigid kind (meaning you can’t stop being a person), while :Artist is a subclass of :Role, something anti-rigid, something a person occupies and could leave.
RDFS/OWL will assign both types, but the rigid-versus-anti-rigid distinction is modelling guidance for humans, not a constraint the reasoner enforces. The engine just sees two class memberships.
Subclass propagation
Because :Album rdfs:subClassOf :CreativeWork, rule rdfs9 gives us :DownwardSpiral rdf:type :CreativeWork. And since :Artist rdfs:subClassOf :Role, Trent is also a :Role. Chain enough subclass links and rdfs:subClassOf itself propagates transitively (rule rdfs11): A ⊑ B and B ⊑ C entail A ⊑ C.
Inference is not validation!
RDFS domain/range might look like constraints. Like if we declare the domain of :created to be :Artist would require subjects of :created to be artists. They do no such thing! RDFS infers. If you use :created with a subject that “should not” be an artist, RDFS does not reject it, it concludes that the subject is an artist. This is the open-world, monotonic spirit of the Semantic Web; adding statements only ever adds conclusions, nothing get flagged as illegal. But it could be a contradiction!
SKOS in action
The three controlled vocabularies in play here (genre, condition grading, gender) are SKOS concept schemes. You’ll find them in the same file as the ontology.
What makes SKOS a bit more than just labels and definitions is that its terms carry real semantics, declared with RDFS and OWL axioms in the SKOS specification5. I find it particularly interesting diving into the source of SKOS6. When you use skos:broader or skos:related, you inherit those axioms, and entailment does the rest.
Inverse properties
SKOS declares skos:narrower owl:inverseOf skos:broader. So from either direction you get the other for free!
# what we put in (asserted):
genre:blackMetal skos:narrower genre:blackgaze .
# entailed:
genre:blackgaze skos:broader genre:blackMetal .Subproperty entailment
SKOS declared skos:topConceptOf rdfs:subPropertyOf skos:inScheme. The RDFS subproperty rule (rdfs7) then gives:
# asserted:
genre:industrial skos:topConceptOf genre:GenreScheme .
# entailed:
genre:industrial skos:inScheme genre:GenreScheme .Again, the ontology asserts both, and again the second is redundant. The same pattern turns every label into an rdfs:label, because skos:prefLabel rdfs:subPropertyOf rdfs:label.
# asserted:
cond:mint skos:prefLabel "Mint"@en .
# entailed:
cond:mint rdfs:label "Mint"@en .That last one is quite useful. Generic tools that only know rdfs:label will still find human-readable names for your SKOS concepts.
Symmetric properties
skos:related is declared as a owl:SymmetricProperty, which means we can entail the following.
# asserted:
cond:mint skos:related cond:vgplus .
# entailed (symmetry):
cond:vgplus skos:related cond:mint .Transitive properties
skos:broader is not itself transitive, so “broader” means directly broader. Instead, SKOS provides a separate super-property: skos:broader rdfs:subPropertyOf skos:broaderTransitive, and skos:broaderTransitive a owl:TransitiveProperty. Meaning, every direct broader relationship entail a broaderTransitive relationship.
# asserted:
genre:blackgaze skos:broader genre:blackMetal .
# entailed:
genre:blackgaze skos:broaderTransitive genre:blackMetal .broaderTransitive then chains through any hierarchy. Let’s add another level to the genre schema:
genre:atmosphericBlackgaze a skos:Concept ;
skos:prefLabel "Atmospheric Blackgaze"@en ;
skos:broader genre:blackgaze .Then transitivity entails its full ancestry, without specific assertion from anyone.
genre:atmosphericBlackgaze skos:broaderTransitive genre:blackgaze .
genre:atmosphericBlackgaze skos:broaderTransitive genre:blackMetal .
genre:atmosphericBlackgaze skos:broaderTransitive genre:shoegaze .Blackgaze has a broader relationship to both black metal and shoegaze, therefore both is entailed for atmospheric blackgaze7. The kind of queries where this comes in handy could be “give me everything, however deeply nested, under black metal”. That’s a lookup on the broaderTransitive!
OWL Reasoning
Everything so far has been inference, adding new triples to the knowledge base. OWL is where reasoning can shite, and where our record ontology does something that RDFS cannot.
Classification
The ontology defines a class not by listing members, but by giving us the conditions for membership:
:GoodPressing a owl:Class ;
owl:equivalentClass [
a owl:Class ;
owl:intersectionOf (
:Vinyl
[ a owl:Restriction ;
owl:onProperty :pressingDate ;
owl:someValuesFrom [
a rdfs:Datatype ;
owl:onDatatype xsd:date ;
owl:withRestrictions ( [ xsd:maxExclusive "1995-01-01"^^xsd:date ] )
]
]
)
] .In other words, GoodPressing is exactly any Vinyl whose pressingDate falls before 1 January 1995. Because it is stated with owl:equivalentClass (a definition, “if and only if”) instead of rdfs:subClassOf.
:DS-vinyl a :Vinyl ;
:pressingDate "1994-03-08"^^xsd:date .The reasoner checks the definition, sees a vinyl with a pressing date earlier than stated in the axiom, and classifies it:
# inferred by OWL DL classification, never asserted:
:DS-vinyl a :GoodPressing . Membership was computed from the definition and the datatype comparison. That’s classification!
Plain RDFS will not be able to produce this triple since it has no notion of equivalent class, class intersection, or datatype restrictions like xsd:maxExclusive. You would need OWL 2 DL reasoning (HermiT, Pellet, ELK, and friends) over the datatype restriction to get there.
Consistency
The ontology also declares the media types as mutually exclusive:
[] a owl:AllDisjointClasses ;
owl:members ( :Vinyl :CD :Cassette :StreamingMedium ) .Now, imagine a data-entry slip that types our record as a CD as well:
:DS-vinyl a :Vinyl , :CD . # oopsRDFS has no concept of disjointness, but an OWL reasoner will report the graph as inconsistent. Nothing can be both a Vinyl and a CD at the same time, so the individual :DS-vinyl is a contradiction, and (under classical semantics) an inconsistent ontology entails everything. That’s reasoning as checking, not just deriving.
Identity
One more thing. Let’s define ownership with cardinality, that a record can only be owned by one at a time.
:Ownership rdfs:subClassOf
[ a owl:Restriction ; owl:onProperty :owner ; owl:cardinality 1 ] .So, every :Ownership has exactly one owner. Suppose someone got careless and produced:
:myOwnership :owner :Me , :Veronika .RDF makes no unique-name assumption, different IRIs may denote the same thing unless told otherwise. Instead of flagging this as an error, an OWL reasoner reconciles the cardinality and concludes that :Me and :Veronika must be the same thing.
# inferred to satisfy "exactly one owner":
:Me owl:sameAs :Veronika .That’s not too obvious of an inference. The reasoner didn’t ass a fact about ownership, but it merged two identities.
Putting it back together
You assert a handful of triples about one Nine Inch Nails record. RDFS entailment typed Trent as an artist and a person, typed you as a person, and typed record as an album and creative work.
SKOS entailment, which is really just RDFS and OWL applied to the SKOS axioms, gave you genre and condition vocabularies thesaurus behaviour: inverse broader/narrower, topConceptOf implying inScheme, symmetric related, and transitive broaderTransitive that will return an entire tree in one hop.
OWL reasoning classified the record as a good pressing from datatype-restricted definition, catching disjointness violations as inconsistencies, and merging identities.
Entailment is the set of facts that must be true given what you said—defined by meaning, relative to a chosen regime, indifferent to how anyone computes it.
Inference is a sound, ideally complete procedure, a ruleset like RDFS, that derives those facts, typically by materialising new triples.
Reasoning is what an engine does: inference plus consistency checking plus classification, in service of answering questions.
About the author
Ontologist who code in C, Java and Python. Been a knowledge graph practitioner for over a decade, and had numerous talks on the topic around the globe. Knowledge Graph Specialist at Data Treehouse. Author of SHACL for the Practitioner and awarded amongst Norway’s Top 50 Women in Tech 2024.
Who also came up with the wonderful title for this Substack post. ❤️ Thank you!
P. Hitzler, M. Krötzsch, S. Rudolph, Foundations of Semantic Web Technologies, CRC Press, 2009, p. 74
R. Antonsen, Logical Methods: The Art of Thinking Abstractly and Mathematically, Springer, 2021, p. 179
RDFS Semantics, 7.3 RDFS Entailment Rules https://www.w3.org/TR/2004/REC-rdf-mt-20040210/#RDFSRules
SKOS Simple Knowledge Organization System Namespace Document https://www.w3.org/2009/08/skos-reference/skos.html#
SKOS RDF representation: https://www.w3.org/2009/08/skos-reference/skos.html#SKOS-REFERENCE (RDF/XML only unfortunately, but easily serialised to a more human-friendly format with e.g. EasyRdf https://www.easyrdf.org/converter)
The French band Alcest is a band that could fall under this genre, if you’re curious!




