Knowledge Representation & Ontologies
How machines store what they know. Semantic networks, ontologies, and RDF triples let an AI hold facts and reason new ones from them.
The machine learning of the last few weeks learns patterns from data but cannot really tell you what it knows. There is an older, complementary tradition in AI: writing knowledge down explicitly, as facts and relationships a machine can store and reason over. This is knowledge representation, and its modern form is the ontology, the technology behind knowledge graphs like the panels you see in Google search. The payoff is that a machine holding structured knowledge can infer new facts it was never directly told, and this page shows exactly how.
Why represent knowledge
There are two broad ways to get knowledge into a machine. One is to learn it from data, as neural networks do; the knowledge ends up buried in millions of weights that no human can read. The other is to write it down explicitly as symbols and relationships the machine can store, share, and reason over. This second approach is knowledge representation, and it is the heart of what is called symbolic AI.
Explicit knowledge has real advantages. It is transparent (you can inspect exactly what the system believes), it is reusable across applications, and crucially it supports reasoning: deriving new facts from known ones by following logical rules. The challenge is designing a structure that captures messy real-world knowledge precisely enough for a computer.
Semantic networks
The simplest and oldest structure is the semantic network: a graph where nodes are concepts and labelled edges are relationships between them. "A dog is a mammal", "a bird has wings", and "Fido is a dog" all become nodes joined by labelled links.
The two most important link types appear again and again:
- is-a links a specific thing to a more general category (Dog is-a Mammal). These build the hierarchy.
- has-a or other property links attach features (Bird has-a Wings).
A related idea is the frame, which packages everything known about one concept into a labelled record of slots and values, like a form: a Dog frame with slots for legs (4), sound (bark), and category (Mammal). Frames and semantic networks describe the same knowledge in different shapes.
Ontologies
An ontology is a formal, shared, and much more rigorous version of a semantic network. It is a precise specification of the concepts in a domain and the relationships between them, agreed so that different systems can use the same vocabulary and mean the same thing. Its building blocks:
- Classes: categories of things, like Animal, Mammal, Dog.
- Instances: specific individuals, like Fido, who belong to a class.
- Properties (or relations): the ways classes and instances connect, like "is a subclass of" or "has legs".
The difference from a loose semantic network is formality. An ontology is written in a strict language (such as OWL) with defined meanings, so a machine can reason over it reliably and two organisations can share it without ambiguity. Ontologies power search knowledge panels, medical terminologies, and the semantic web.
RDF triples
How is this knowledge actually written for a machine? The standard is the RDF triple, and it is wonderfully simple. Every fact is broken into three parts:
A triple is one small statement: a subject, a relationship (the predicate), and an object. Any body of knowledge, however large, is just a huge collection of these three-part facts. Because every fact has the same shape, machines can store, merge, and query billions of them, which is exactly how a knowledge graph is built.
"Tweety is a robin, robins are birds, and Tweety is coloured red." As RDF triples:
Inference and inheritance
Here is the real payoff of representing knowledge properly. A machine can infer facts it was never explicitly told, by following the relationships. The most important example is inheritance down is-a links.
Suppose the ontology contains only these facts: Fido is-a Dog, Dog is-a Mammal, Mammal is-a Animal, and Mammal has-property warm-blooded. No one stated that Fido is an animal or that Fido is warm-blooded. Yet a reasoner can derive both:
This is enormously powerful. You state a property once, high in the hierarchy, and every instance below it inherits that property automatically. Store facts about a few thousand classes and a reasoner can answer millions of questions that were never written down. That is what makes ontologies more than just tidy filing.
Explore a knowledge graph
Below is a small ontology drawn as a graph. Solid arrows are is-a links pointing to more general classes. Click any node to see the facts stated directly about it. Then press "Run inference" to watch the reasoner derive new is-a links (dashed) and inherited properties that were never stated but follow logically.
Click a node to inspect it. Run inference to derive facts nobody stated directly.
Key points and practice
- Knowledge representation writes facts down explicitly so a machine can store and reason over them, unlike opaque learned models.
- A semantic network is a graph of concept nodes joined by labelled relationship edges; frames package a concept's slots and values.
- An ontology is a formal, shared specification of classes, instances, and properties in a domain.
- An RDF triple states one fact as subject, predicate, object; knowledge graphs are built from many of them.
- Inference, especially inheritance down is-a links, lets a reasoner derive facts that were never stated.
- A taxonomy is a plain hierarchy; an ontology adds richer relationships and rules.
A semantic network is a way of representing knowledge as a graph. Its nodes represent concepts or objects, such as Dog or Fido, and its edges are labelled relationships between them, such as is-a or has-a. For example, a node Fido joined by an is-a edge to a node Dog states that Fido is a dog. It captures knowledge as concepts linked by meaningful relationships.
An RDF triple states a single fact in three parts: a subject, a predicate (the relationship), and an object, for example (Fido, is-a, Dog). Knowledge graphs are built from large collections of such triples. A taxonomy is simply a hierarchy of categories connected by is-a links, like a classification tree. An ontology is richer: it formally specifies classes, instances, and many kinds of relationship and rule, not only "is a kind of", so it can represent far more than a taxonomy and support reliable reasoning.
The is-a relationship is transitive, so from "Fido is-a Dog" and "Dog is-a Mammal" the reasoner infers "Fido is-a Mammal". Properties stated on a class are inherited by everything below it in the hierarchy, so because "Mammal has-property warm-blooded" and Fido is a mammal, the reasoner concludes "Fido is warm-blooded", even though this fact was never stated directly. This inheritance of properties down is-a links is a core form of inference in ontologies.
