What Is Knowledge Representation in Symbolic AI? A Beginner's Guide to GOFAI
Knowledge representation (KR) is the foundation of Symbolic AI that encodes human expertise into machine-readable structures—such as rules, frames, and ontologies—enabling computers to perform automated reasoning and decision-making.
In the microsoft/AI-For-Beginners curriculum, knowledge representation is introduced as the cornerstone of classic "good old-fashioned AI" (GOFAI). Unlike statistical machine learning, which finds patterns in data, Symbolic AI explicitly stores facts and relationships in structured formats that an inference engine can manipulate. This approach powers everything from early expert systems to modern semantic web technologies.
The DIKW Pyramid: From Raw Data to Machine Wisdom
Symbolic AI organizes understanding through the DIKW pyramid, a hierarchy that traces how raw symbols become actionable wisdom:
- Data – Raw, unprocessed symbols (e.g., the string "Python").
- Information – Interpreted data with context (e.g., "Python is a programming language").
- Knowledge – Information integrated into models (e.g., "Python executes scripts via an interpreter").
- Wisdom – Meta-knowledge about when to apply that knowledge (e.g., choosing Python for rapid prototyping).
According to the source materials in lessons/2-Symbolic/README.md, the goal of KR is to capture the knowledge layer in a formal structure that inference algorithms can traverse. This transformation turns static facts into dynamic problem-solving capabilities.
Four Core Families of Symbolic Knowledge Representation
The curriculum classifies knowledge representation into four distinct formalisms, each optimized for different types of reasoning tasks.
Network Representations (Semantic Networks)
Network models use graph structures to map interrelated concepts through Object-Attribute-Value (OAV) triplets. These semantic networks represent knowledge as nodes (objects) connected by labeled edges (attributes). For example, the relationship "Python was invented by Guido van Rossum" becomes a triplet linking the object "Python" to the value "Guido van Rossum" via the attribute "invented-by".
Hierarchical Representations (Frames and Ontologies)
Hierarchical systems capture "is-a" and "part-of" relationships using frames (data structures with slots and default values) and ontologies (formal class hierarchies). A frame for "Python" might include slots for paradigm, typing, and creator, inheriting defaults from a parent "Programming Language" frame. This structure enables property inheritance and efficient categorization.
Procedural Representations (Production Rules)
Procedural KR encodes conditional actions through production rules—IF-THEN statements that trigger when specific patterns match. The repository's lessons/2-Symbolic/Animals.ipynb demonstrates this with rules such as: IF an animal eats meat OR has sharp teeth AND claws AND forward-looking eyes, THEN classify it as a carnivore. These rules drive forward and backward chaining reasoning in expert systems.
Logical Representations (Predicate Logic)
Formal logic represents knowledge through mathematically precise statements using predicate logic, Horn clauses, and Description Logics (DL). This approach enables sound inference, guaranteeing that derived conclusions validly follow from premises—a critical requirement for safety-critical AI applications.
Expert Systems in Action: Knowledge Base and Inference Engine
An expert system operationalizes knowledge representation through two core components defined in the curriculum:
- Knowledge Base – A static repository of facts (OAV triplets, frames, or rules) representing domain expertise.
- Inference Engine – A dynamic mechanism that searches the knowledge base to answer queries using forward chaining (data-driven reasoning) or backward chaining (goal-driven reasoning).
The interactive notebook lessons/2-Symbolic/Animals.ipynb provides a concrete implementation, allowing beginners to observe how adding facts triggers rule firings that classify animals into categories like "mammal" or "carnivore."
Code Example: Building a Simple Knowledge Base
The following Python snippets mirror the pedagogical examples found in the Microsoft AI curriculum, demonstrating how to implement OAV triplets and production rules.
# OAV triplets representing programming language knowledge
knowledge = [
("Python", "is", "Untyped-Language"),
("Python", "invented-by", "Guido van Rossum"),
("Python", "syntax", "indentation"),
("Untyped-Language", "has", "no type definitions")
]
# Forward reasoning query function
def find_attribute(obj, attr):
return [value for (subj, pred, value) in knowledge
if subj == obj and pred == attr]
print(find_attribute("Python", "invented-by"))
# → ['Guido van Rossum']
# Production rules for backward chaining animal classification
rules = [
("carnivore",
lambda animal: animal.get("eats") == "meat" or
(animal.get("has_sharp_teeth") and
animal.get("has_claws") and
animal.get("has_forward_eyes")))
]
def infer(animal, goal):
for (conclusion, condition) in rules:
if conclusion == goal and condition(animal):
return True
return False
# Example animal description
lion = {
"eats": "meat",
"has_sharp_teeth": True,
"has_claws": True,
"has_forward_eyes": True
}
print(infer(lion, "carnivore"))
# → True
These examples from lessons/2-Symbolic/Animals.ipynb demonstrate how symbolic AI separates declarative knowledge (the facts) from procedural control (the inference logic).
From Local Expert Systems to the Semantic Web
Beyond isolated expert systems, modern Symbolic AI extends into the Semantic Web, where distributed knowledge graphs share ontologies across the internet. Key technologies include:
- RDF (Resource Description Framework) and OWL (Web Ontology Language) – Standards for encoding triplets as URIs, enabling cross-platform data integration.
- WikiData and Microsoft Concept Graph – Large-scale knowledge bases containing billions of factual relationships.
- Family Ontologies – Domain-specific vocabularies explored in
lessons/2-Symbolic/FamilyOntology.ipynb, which demonstrates querying genealogical relationships using semantic web patterns.
These resources illustrate that knowledge representation is not merely an academic exercise but underpins production systems requiring explainable decisions and heterogeneous data integration.
Summary
- Knowledge representation converts human expertise into machine-readable structures like OAV triplets, frames, rules, and logical predicates.
- The DIKW pyramid clarifies how data becomes wisdom through progressive layers of interpretation and context.
- Expert systems combine static knowledge bases with dynamic inference engines using forward or backward chaining, as implemented in
lessons/2-Symbolic/Animals.ipynb. - Four formalisms dominate Symbolic AI: network representations, hierarchical frames/ontologies, procedural production rules, and logical predicates.
- Modern applications scale these concepts to the Semantic Web using RDF, OWL, and public knowledge graphs like WikiData.
Frequently Asked Questions
What is the difference between data and knowledge in AI?
Data consists of raw, unprocessed symbols without context, whereas knowledge represents interpreted information integrated into structured models that support inference. In the DIKW pyramid framework used in lessons/2-Symbolic/README.md, data becomes knowledge only when organized into relationships (like OAV triplets) that an inference engine can manipulate to derive new conclusions.
How do production rules work in expert systems?
Production rules are conditional IF-THEN statements that trigger when specific patterns match in the knowledge base. The inference engine applies these rules through forward chaining (starting with known facts to reach conclusions) or backward chaining (starting with a hypothesis and verifying supporting facts). The lessons/2-Symbolic/Animals.ipynb notebook demonstrates both approaches for classifying animals based on observable traits.
What file contains the animal classification example in the Microsoft AI curriculum?
The hands-on animal classification expert system resides in lessons/2-Symbolic/Animals.ipynb. This Jupyter notebook implements both forward and backward inference mechanisms, allowing beginners to experiment with how rules fire based on animal characteristics like diet, teeth structure, and movement patterns.
Are expert systems still used today?
Yes, expert systems remain vital in domains requiring transparent, rule-based decision-making such as medical diagnosis, legal reasoning, and hardware configuration. While modern AI often favors neural networks for pattern recognition, symbolic expert systems excel in scenarios demanding explainable AI—where decisions must be traceable to specific rules and facts, as emphasized in the Microsoft curriculum's coverage of knowledge representation.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →