RDF and OWL: The Web’s Knowledge Languages
📍 Where we are: Part I · Knowledge Representation — Chapter 2. Triples and Graphs showed that a pile of facts is a labelled directed graph — but a bare graph fixes structure with no shared meaning, and the rules we kept quoting stayed stranded in the margins; this chapter gives those nodes and edges globally unambiguous names and a language to state the rules the graph could only imply.
A graph a machine can traverse is not yet knowledge a machine can share. The last chapter left us two problems. First, the node named mit might mean a different institution in someone else's graph, so merging two graphs silently merges two different worlds. Second, the rules we leaned on — advising links a professor to a student, grand-advising is two advising hops, nobody is both a professor and a student — lived nowhere in the data; they were prose in the margins. Three web standards, stacked in layers, fix exactly these two problems, and this chapter builds the stack on the academic world's own fourteen axioms.
Imagine every research lab in the world keeps its facts on index cards, but each lab invented its own private shorthand — one writes advises, another writes supervises, a third reuses the letter A for something else entirely. Tip the shoeboxes together and it is chaos: nobody can tell which cards mean the same thing. Now imagine every term on every card is replaced by a full postal address that no two labs could ever collide on, and a shared rulebook says what each term entails — that a professor is a researcher, that you cannot be both a professor and a student. Suddenly the shoeboxes merge cleanly, and a machine can work out facts that nobody wrote down. That upgrade — from private shorthand to globally addressed, rule-bearing terms — is what RDF, RDFS, and OWL are.
What this chapter covers
- From private graph to shared knowledge — an IRI (Internationalized Resource Identifier) gives every node and edge a globally unique name, so two graphs can agree on what
advisesmeans; the RDF triple is that idea made a standard. - The layer cake — RDF (the data model) → RDFS (classes,
subClassOf, domains and ranges) → OWL (the full logical constructors), and precisely what each layer buys you. - The four OWL constructors that matter here — subclass, existential restriction, disjointness, and property chain, each shown as the exact academic-world axiom it expresses.
- The fourteen axioms rebuilt in OWL —
reasoners.build_ontologyreconstructsontology.TBOXaxiom for axiom with owlready2'sThing,ObjectProperty,GeneralClassAxiom,AllDisjoint, andPropertyChain. - A description-logic-to-OWL dictionary — one table mapping textbook DL syntax to its OWL 2 and owlready2 form.
- Why standardize — an off-the-shelf reasoner (HermiT, ELK) consumes the very same file, and its classification agrees entry-for-entry with the from-scratch code.
- The unsolved part — the layer cake stacks cleanly only if you keep schema and data disciplined; that discipline is the TBox/ABox split the next chapter formalizes.
From a private graph to shared knowledge
The last chapter's graph had one fatal weakness: its labels were local strings. The word advises meant whatever our margins said it meant, and a machine merging our graph with another's had no way to know whether the two advises labels denoted the same relationship. RDF — the Resource Description Framework, the W3C (World Wide Web Consortium) standard for the triple — closes that hole with a single discipline: every name is an IRI, a globally unique identifier drawn from the same address space as web URLs [1]. Our companion ontology already carries one: it declares its home namespace as an IRI (reasoners.py line 45),
world = get_ontology("http://nesy-guide.org/academic.owl")
so the concept Professor is not the bare string "Professor" but the full IRI http://nesy-guide.org/academic.owl#Professor. Two graphs that both use that IRI mean the same class by construction; two graphs that use different IRIs are safely kept apart. The local string became a global name, and merging became sound.
With that fix, the triple can be stated precisely. Before the symbols, the plain-language decoder: a triple is still "subject, predicate, object," exactly as in the last chapter — the IRIs only pin down which subject, predicate, and object. Let be the set of IRIs, the blank nodes (anonymous individuals with no global name), and the literals (raw data values like numbers and strings). An RDF graph is then a set of triples
where is set union and the Cartesian product ("every combination"). Read the three slots left to right: the subject is an IRI or a blank node, the predicate is always an IRI (a relationship must be globally named), and the object may additionally be a literal (advises points at an individual; a hypothetical age would point at the number 34). This is the same shape as before — now every , , that should be shared is a globally unambiguous name [1].
The layer cake: RDF, then RDFS, then OWL
RDF alone fixes naming but says nothing about meaning beyond the edge: it can record advises(alice, bob) with global names, yet it still cannot say "every professor advises a student" or "a professor is a researcher." Those come from two more layers stacked on top, each adding exactly one kind of expressive power. The standards are designed to nest: every RDFS graph is a legal RDF graph, and every OWL ontology is a legal RDF graph, so the layers add meaning without changing the underlying triple substrate [2].
| Layer | Full name | What it adds | Academic-world example |
|---|---|---|---|
| RDF | Resource Description Framework | globally named triples: the data model itself | (alice, advises, bob) with IRIs |
| RDFS | RDF Schema | classes, rdfs:subClassOf, property domain and range | Professor ⊑ Researcher; advises runs Person → Person |
| OWL | Web Ontology Language | the logical constructors: ∃, ⊓, ⊔, ¬, ⊥, property chains, cardinalities | Professor ⊑ ∃advises.Student; Professor ⊓ Student ⊑ ⊥ |
RDFS — RDF Schema — adds the vocabulary of types: it lets you declare that Professor and Researcher are classes, that one is a subclass of the other via rdfs:subClassOf, and that the property advises has a domain and range — the classes a reasoner will infer its subject and object to belong to. Read that carefully, because it is the single most common RDFS misconception: domain and range are inference rules, not validation constraints. Under RDFS semantics, asserting advises(alice, bob) with advises's domain set to Person entails the new fact that alice is a Person; it never rejects or flags data for violating a constraint. That already captures the concept hierarchy Professor ⊑ Researcher ⊑ Person, where ⊑ reads "is a subclass of." But RDFS stops there. It cannot say a professor must advise something, cannot say two classes are disjoint, and cannot define a relation as the composition of two others. OWL — the Web Ontology Language — adds precisely those logical constructors [3], and with them a graph stops being a mere record and becomes a formal ontology: a theory whose axioms entail new facts. The price of that power is complexity — reasoning in OWL 2 DL is decidable but worst-case doubly exponential (N2ExpTime-complete), whereas the OWL 2 EL profile our academic world lives in gives up some constructors to keep reasoning polynomial [3], the trade the later EL chapters cash in.
The knowledge stack on one world: RDF gives every triple a global IRI, RDFS adds classes and a subclass hierarchy, and OWL adds the logical constructors that turn the academic graph into a formal ontology any standard reasoner can classify identically.
Original diagram by the authors, created with AI assistance.
The four constructors that turn a graph into an ontology
Four OWL constructors carry almost all the weight in the academic world. Take each with the exact axiom it expresses and its owlready2 rendering, so the abstract notation and the runnable code sit side by side.
Subclass. The plainest axiom, already within RDFS, is the general concept inclusion (GCI) that one class sits under another:
owlready2 renders a named subclass as ordinary Python inheritance — class Professor(Researcher) is the axiom Professor ⊑ Researcher (reasoners.py line 50).
Existential restriction. The first genuinely OWL move is to require that a class relate to something of a given kind. Decoder before symbols: "every professor advises at least one thing that is a student."
Here ∃ reads "there exists," and is the existential restriction "related by role to some member of ." RDFS cannot state this; OWL can, as Professor.is_a.append(advises.some(Student)) (reasoners.py line 68).
Disjointness. OWL can also forbid overlap. Using the bottom concept ⊥ (the empty, impossible class), disjointness says a shared member would have to be impossible:
where ⊓ reads "and" (a member of both) and ⊥ reads "nothing." owlready2 writes it AllDisjoint([Professor, Student]) (reasoners.py line 73). This is the axiom that earns its keep: it is what makes the deliberately broken concept TenuredStudent (declared a professor and a student) come out unsatisfiable.
Property chain. Finally, OWL can define a role as the composition of two roles — the role chain from the last chapter, now a first-class axiom:
where ∘ reads "composed with" (follow the first role, then the second). owlready2 attaches it to the target property: grandAdvisor.property_chain.append(PropertyChain([advises, advises])) (reasoners.py line 75). The two-hop path you could only trace in a bare graph is now an edge a reasoner will derive.
The fourteen axioms, rebuilt in OWL
The companion proves the mapping is faithful by rebuilding all fourteen TBox axioms in owlready2, axiom for axiom, in build_ontology (reasoners.py lines 42–91). The named concepts come first, and the subclass axioms fall straight out of Python's class syntax — each numbered comment ties the line back to the axiom in ontology.TBOX (reasoners.py lines 47–57):
# Concept names (declared so the hierarchy is explicit).
class Person(Thing): pass
class Researcher(Person): pass # (3) Researcher ⊑ Person
class Professor(Researcher): pass # (1) Professor ⊑ Researcher
class Student(Researcher): pass # (2) Student ⊑ Researcher
class Paper(Thing): pass
class Institution(Thing): pass
class Topic(Thing): pass
class Dean(Professor): pass # (8) Dean ⊑ Professor
class TenuredStudent(Thing): pass
class TenuredStudentAdvisor(Thing): pass
Every class descends from Thing — owlready2's name for the top concept ⊤ (owl:Thing), the class every individual belongs to. The six roles are declared just as plainly, each as an ObjectProperty (an object property being a relation between two individuals; reasoners.py lines 60–65). The logical axioms that RDFS could not express are then attached one by one (reasoners.py lines 67–88):
# (4) Professor ⊑ ∃advises.Student
Professor.is_a.append(advises.some(Student))
# (5) ∃advises.⊤ ⊑ Researcher
gca5 = GeneralClassAxiom(advises.some(Thing))
gca5.is_a.append(Researcher)
# (6) Professor ⊓ Student ⊑ ⊥ (disjointness)
AllDisjoint([Professor, Student])
# (7) advises ∘ advises ⊑ grandAdvisor
grandAdvisor.property_chain.append(PropertyChain([advises, advises]))
Two of these show OWL reaching past a simple subclass. Axiom (5), ∃advises.⊤ ⊑ Researcher ("anyone who advises anything is a researcher"), has a compound expression on the left, which a plain is_a cannot carry; owlready2 wraps it in a GeneralClassAxiom — the direct OWL encoding of a GCI whose left side is not a bare name. The same tool expresses axiom (14), Person ⊓ ∃authored.Paper ⊑ Researcher, using owlready2's & for conjunction: GeneralClassAxiom(Person & authored.some(Paper)) (reasoners.py line 87). Running the source of truth prints the world's dimensions, and it is these fourteen axioms the OWL build mirrors (python3 ontology.py):
10 named concepts, 6 roles, 14 TBox axioms; ABox: 13 concept assertions, 18 role assertions over 13 individuals.
From DL notation to OWL: a dictionary
The whole translation fits in one table. Each row is a textbook description-logic construct, its meaning, the OWL 2 / owlready2 form the companion uses, and the academic-world axiom it encodes. This is the Rosetta stone for reading the rest of the volume against real code.
| Textbook DL | Meaning | OWL 2 / owlready2 form | Academic-world axiom |
|---|---|---|---|
| subclass / GCI | class C(D) or C.is_a.append(D) | Professor ⊑ Researcher | |
| existential restriction | r.some(C) | Professor ⊑ ∃advises.Student | |
| conjunction | C & D | Person ⊓ ∃authored.Paper ⊑ Researcher | |
| disjointness | AllDisjoint([C, D]) | Professor ⊓ Student ⊑ ⊥ | |
| property (role) chain | PropertyChain([r, s]) | advises ∘ advises ⊑ grandAdvisor | |
| , compound | general concept inclusion | GeneralClassAxiom(L) | ∃advises.⊤ ⊑ Researcher |
| ⊤ / ⊥ | top / bottom concept | Thing / Nothing | Thing is the root of every class |
Read the table both ways. Left to right, it says how to write a piece of description logic in a real ontology tool. Right to left, it says how to read any OWL ontology — including SNOMED CT or the Gene Ontology — back into the crisp ⊑, ∃, ⊓ notation the reasoners of this volume actually operate on. The notation and the file are two views of one object.
Why standardize: one file, many reasoners
The payoff of putting all this on a shared standard is that the ontology is no longer welded to the program that built it. Any reasoner that speaks OWL can load the same file and classify it. The companion demonstrates this with the strongest possible check: it rebuilds the academic world in owlready2 and runs HermiT, a complete OWL 2 DL reasoner, over it, then asserts that HermiT's inferred hierarchy and its set of unsatisfiable classes match the from-scratch EL completion entry for entry (reasoners.py lines 145–152). HermiT decides OWL 2 DL, a strict superset of OWL 2 EL, so agreement is decisive; the EL-specialised ELK would give the identical classification for this EL++ ontology. The committed cross-check output:
Reasoner (HermiT via owlready2) vs. from-scratch EL completion
from-scratch subsumptions : 8
HermiT subsumptions : 8
from-scratch unsatisfiable: ['TenuredStudent', 'TenuredStudentAdvisor']
HermiT unsatisfiable : ['TenuredStudent', 'TenuredStudentAdvisor']
subsumptions agree : True
unsatisfiable agree: True
AGREEMENT CONFIRMED — the from-scratch reasoner matches HermiT.
Two independent engines — a hand-written EL completion and an industrial OWL 2 DL reasoner — read the same fourteen axioms and reach identical conclusions: eight subsumptions among the named concepts, and the same two concepts (TenuredStudent, TenuredStudentAdvisor) flagged unsatisfiable. That is what "standard" buys. Write your knowledge once, in OWL, and you inherit an ecosystem of interchangeable reasoners, editors, and validators — none of which needs to know how the others work.
The unsolved part
The layer cake looks seamless, but there is a fracture line in it. RDF was designed for total freedom — anything can be the subject of any triple, including a class itself, so you can write triples about Professor as though it were an ordinary individual. OWL's logical constructors, by contrast, need discipline to stay decidable: the moment you let classes be treated as individuals and mix the two freely (the dialect called OWL Full), reasoning becomes undecidable — no algorithm can be guaranteed to terminate on every ontology [3]. To recover a decidable logic, OWL DL forbids exactly those unrestricted RDF patterns, insisting that the vocabulary of classes and the vocabulary of individuals stay cleanly separated. So the honest limitation is that the neat RDF → RDFS → OWL stack does not compose for free at the top: full generality and decidable reasoning cannot both be had, and every serious ontology quietly chooses the disciplined side of the line.
And that discipline has a name. Keeping the schema (which classes exist, how they relate) apart from the data (which individuals exist, what they are) is not a stylistic preference; it is what makes the whole apparatus reason. Our fourteen axioms are all schema; the thirteen concept assertions and eighteen role assertions are all data. The next chapter gives that split its formal names — the TBox and the ABox — and shows why the boundary is where a reasoner's power actually comes from.
Why it matters
Everything neuro-symbolic downstream assumes a shared, machine-readable knowledge format, and OWL-over-RDF is that format. When Volume 3 embeds a knowledge graph, the graph it embeds is an RDF graph; when a later hybrid system checks a neural prediction against a logical constraint, the constraint is written as an OWL axiom. Standardization is what lets the exact half and the robust half of the field even point at the same object: a professor's advises edge means the same thing to a theorem prover, an embedding model, and a validator only because an IRI and an OWL axiom pinned it down. The single most practical habit this chapter teaches is to see any ontology — SNOMED CT's hundreds of thousands of classes, the Gene Ontology's biological hierarchy — as nothing more exotic than the academic world scaled up: IRIs for names, RDFS for the hierarchy, OWL constructors for the rules, and a reasoner that reads them all.
Key terms
- RDF (Resource Description Framework) — the W3C standard data model: knowledge as a set of globally named triples .
- IRI (Internationalized Resource Identifier) — a globally unique name for a node or edge, drawn from the web's address space, so two graphs can agree on meaning.
- RDFS (RDF Schema) — the layer that adds classes,
rdfs:subClassOf, and property domains and ranges (inference rules a reasoner uses to infer the types of what a property links, not constraints data must satisfy); enough for a subclass hierarchy, not enough for the logical constructors. - OWL (Web Ontology Language) — the layer that adds existential restrictions, conjunction, disjointness (via ⊥), and property chains, turning a graph into a formal ontology with entailments.
- Existential restriction — "related by role to some member of "; owlready2
r.some(C), e.g. Professor ⊑ ∃advises.Student. - Disjointness — , "nothing is both"; owlready2
AllDisjoint([C, D]), the axiom that makesTenuredStudentunsatisfiable. - Property (role) chain — ; owlready2
PropertyChain([r, s]), turning a two-hop path into a derivable edge (advises ∘ advises ⊑ grandAdvisor). - General concept inclusion (GCI) — any axiom ; when is compound, owlready2 encodes it as a
GeneralClassAxiom. - OWL DL vs OWL Full — the disciplined, decidable dialect that separates classes from individuals, versus the fully general, undecidable one that lets them mix.
Where this leads
RDF named the world, RDFS gave it a hierarchy, and OWL gave it logic — but the chapter closed on a split it did not yet name: the fourteen axioms are the schema, the thirty-one assertions are the data, and keeping them apart is what makes reasoning decidable. The next chapter, TBox and ABox, formalizes exactly that division — the TBox of terminological axioms and the ABox of assertional facts — and shows how a reasoner uses one to complete the other. It is the same academic world once more, now cut along the seam that every description-logic system is built around.