Artificial intelligence • Original RRTutors lesson
Knowledge Representation: Logic, Rules, and Ontologies
Represent facts and relationships explicitly so an AI system can query or infer structured knowledge.
Concept and explanation
Knowledge representation encodes entities, properties, relations, and rules in a form a computer can manipulate. Propositional and predicate logic support formal reasoning; production rules encode conditions and actions; ontologies define shared concepts and relations. Representations differ in expressiveness, uncertainty handling, and computational cost.
How to apply it
Choose a vocabulary, define valid relations and constraints, and decide how incomplete or conflicting facts are handled.
Worked example
A library knowledge graph can represent that a book has an author and belongs to a topic, enabling relationship queries.
Illustrative Python example
facts = {("Ada", "wrote", "Notes")}
query = ("Ada", "wrote", "Notes")
print(query in facts)
Expected result
The fact can be queried exactly because it is explicitly represented.
Limitations and cautions
Rules do not make a knowledge base complete; stale, inconsistent, or missing facts remain possible.
Practice exercise
Represent a small course catalog using entities, relationships, and one rule.
Key takeaway: A reasoning system can only use knowledge that its representation captures.