Artificial Intelligence and Expert System

Chapter 4
Knowledge Representation and Ontologies

Post Graduate Program in Computer Science Engineering
Artificial Intelligence and Expert System   •   Post Graduate

4. Knowledge Representation and Ontologies

Introduction and Context

Artificial intelligence systems do not reason directly from the physical world. They reason from representations of objects, properties, events, relationships, rules, and constraints. Knowledge representation (KR) is the area of artificial intelligence concerned with constructing formal descriptions of a domain so that a computer can interpret, infer from, and use them. A representation is therefore more than a data structure: it is a deliberate account of what entities exist, how they are related, what is assumed to be true, and what conclusions may be derived.

Knowledge representation became central to symbolic artificial intelligence because intelligent behaviour requires more than search or numerical computation. A diagnostic system must represent symptoms, diseases, and causal relations; a planning system must represent actions, preconditions, and goals; a legal reasoning system must represent statutes, cases, exceptions, and jurisdiction. The quality of reasoning is strongly constrained by the quality of the representation.

This chapter examines major representational approaches, beginning with propositional and first-order logic and progressing through semantic networks, frames, scripts, production rules, knowledge graphs, description logics, taxonomies, and ontologies. These approaches are related, but they are not interchangeable. Each offers a different balance among expressive power, computational efficiency, ease of acquisition, explainability, and tolerance of ambiguity. A postgraduate engineer should therefore be able not only to define each method, but also to select and combine methods for a real application.

Learning Objectives

After studying this chapter, a student should be able to:

1. Explain the purpose, scope, and design issues of knowledge representation.

2. Distinguish propositional logic from first-order logic and construct simple formalizations.

3. Describe semantic networks, frames, scripts, production systems, and knowledge graphs.

4. Explain the role of description logics, taxonomies, and ontologies in structured knowledge.

5. Compare representation methods according to expressiveness, inference, scalability, and maintainability.

6. Design a small ontology for a practical domain and identify its classes, properties, constraints, and instances.

7. Analyse limitations, governance requirements, and ethical risks associated with knowledge-based systems.

What a Representation Must Make Possible

A knowledge representation has at least four interconnected dimensions. Syntax specifies the permitted symbols and forms of expression. Semantics assigns meaning to those expressions. Inference mechanisms determine how new statements can be derived. Pragmatics concerns how the representation is used in a particular task, organization, or decision context.

A representation is useful when it supports the following functions:

  • Knowledge acquisition: domain knowledge can be entered by experts, extracted from documents, or learned from data.
  • Storage and organization: facts and relationships can be managed without unnecessary duplication.
  • Inference: the system can derive implicit conclusions from explicit knowledge.
  • Explanation: conclusions can be traced to rules, facts, or axioms.
  • Revision: incorrect, outdated, or conflicting knowledge can be modified.
  • Interoperability: different systems can exchange and interpret shared concepts.

These requirements often conflict. A highly expressive formalism can describe subtle relationships, but inference may become computationally expensive. A simple rule language may be efficient and understandable, but unable to represent uncertainty, time, or exceptions adequately. Representation design is consequently an engineering decision rather than a purely theoretical exercise.

Open-World and Closed-World Assumptions

A central distinction is whether the absence of a statement is interpreted as false. Under the closed-world assumption, if a database does not contain “Patient P has allergy A,” the system may treat the statement as false. This is common in conventional databases. Under the open-world assumption, absence of a statement means that its truth is unknown. Ontology languages and many semantic-web systems generally use the open-world assumption. Thus, failure to record that a person has an allergy does not justify concluding that the person has no allergy.

Another important distinction is between monotonic and non-monotonic reasoning. In monotonic reasoning, adding facts does not invalidate previous conclusions. In non-monotonic reasoning, a conclusion may be withdrawn when new information appears. Default reasoning such as “birds normally fly” requires an exception mechanism because a later fact may identify an entity as a penguin.

Logic as a Foundation for Formal Knowledge

Propositional Logic

Propositional logic represents knowledge using propositions that are either true or false. A proposition such as `Rain` can be combined with logical connectives:

  • Negation: ¬P
  • Conjunction: P ∧ Q
  • Disjunction: P ∨ Q
  • Implication: P → Q
  • Biconditional: P ↔ Q

For example:

`Rain → WetRoad`

`Rain`

From these statements, modus ponens permits the conclusion `WetRoad`. A knowledge base in propositional logic is commonly evaluated through truth assignments, satisfiability, entailment, or resolution.

Propositional logic is precise and has well-understood inference procedures. Its weakness is that it treats each proposition as an indivisible symbol. If a system must represent that several patients have different diagnoses, separate symbols must be created for every combination, producing a vocabulary explosion and preventing natural expression of objects and relationships.

First-Order Logic

First-order logic (FOL) extends propositional logic with objects, predicates, variables, functions, and quantifiers. A unary predicate can represent a property:

`Doctor(x)`

A binary predicate can represent a relationship:

`Treats(x, y)`

Universal and existential quantifiers allow general statements:

`∀x (Doctor(x) → Professional(x))`

“Every doctor is a professional.”

`∃x (Doctor(x) ∧ Treats(x, Patient1))`

“There exists a doctor who treats Patient1.”

FOL can express relations among objects and general rules much more economically than propositional logic. It supports substitution and unification, which are essential in automated theorem proving and logic programming. However, unrestricted first-order reasoning is computationally demanding, and some problems are undecidable. Practical systems therefore use restricted fragments, indexing, forward or backward chaining, or controlled rule languages.

A formalization must preserve intended meaning. The sentence “Every researcher supervises a student” may mean that each researcher supervises at least one student:

`∀x (Researcher(x) → ∃y (Student(y) ∧ Supervises(x,y)))`

This is different from “There is one student supervised by every researcher”:

`∃y (Student(y) ∧ ∀x (Researcher(x) → Supervises(x,y)))`.

The example illustrates why quantifier scope matters.

Inference and Consistency

An inference engine applies valid rules to a knowledge base. Deduction derives conclusions guaranteed by the premises. Abduction seeks the best explanation for observations, while induction generalizes from examples. Classical logic is primarily deductive, although knowledge-based systems may combine logical rules with probabilistic or machine-learning components.

A knowledge base is satisfiable if there is at least one interpretation in which all its statements are true. If it contains both `Engineer(Asha)` and `¬Engineer(Asha)`, it is inconsistent under classical logic. Inconsistency management is important in integrated systems because information may come from sources with different definitions, times, or levels of reliability.

Structured Representations for Human-Usable Reasoning

Semantic Networks

A semantic network represents concepts as nodes and relationships as labelled links. For example, `Canary` may be connected to `Bird` by an “is-a” link, and `Bird` to `Animal` by another. A property such as `hasWings` may be inherited along the hierarchy.

Semantic networks are intuitive and useful for visualization. They make category membership and associations apparent, and they support inheritance. Nevertheless, early semantic networks often lacked a precise semantics. Different systems could interpret “is-a” as class inclusion, instance membership, or inheritance. Modern ontology languages address this weakness by assigning formal meanings to classes and properties.

Frames

A frame describes a stereotyped entity or situation through named slots and values. A `Vehicle` frame might contain slots such as `manufacturer`, `model`, `fuelType`, and `registrationNumber`. Slots may have default values, cardinality restrictions, or procedural attachments. A subclass frame can inherit slots from a parent frame and specialize them.

Frames are effective for object-centred knowledge and support modularity. They also resemble object-oriented classes, although a frame system is designed for knowledge and inference rather than merely software encapsulation. Defaults make frames convenient, but they introduce non-monotonic behaviour: a default value may need to be overridden by an exceptional fact.

Scripts

A script represents a conventional sequence of events. A restaurant script may include entering, being seated, ordering, eating, paying, and leaving. It contains roles, scenes, entry conditions, and expected actions. Scripts help systems interpret incomplete narratives because an omitted event may be inferred from a familiar pattern.

Scripts are useful in dialogue analysis, workflow support, and activity recognition. Their weakness is rigidity: real situations may omit, reorder, or combine events. Modern systems often use scripts as contextual structures together with probabilistic models or temporal reasoning.

Production Rules

A production rule has the form:

`IF condition(s) THEN action or conclusion`.

For example:

`IF temperature is high AND coolant level is low THEN inspect cooling system.`

A rule engine maintains a working memory and a set of rules. In forward chaining, known facts activate rules and generate new facts. In backward chaining, the engine starts with a goal and searches for rules that could establish it. When several rules are eligible, a conflict-resolution strategy selects one, perhaps using specificity, priority, or recency.

Production systems are transparent and practical for configuration, diagnosis, compliance, and decision support. They can become difficult to maintain when rules interact extensively, when exceptions proliferate, or when the system must represent rich structural relationships. Rule firing may also be sensitive to ordering and conflict-resolution policies.

Knowledge Graphs and the Semantic Web

A knowledge graph represents entities and their relationships as a graph, often using triples of the form:

`subject — predicate — object`

For example:

`CourseA — taughtBy — ProfessorB`

`ProfessorB — memberOf — DepartmentC`.

A graph can integrate information from databases, documents, sensors, and public datasets. Entity identifiers distinguish concepts that may have similar names, while links connect local knowledge to external vocabularies. Query languages such as SPARQL enable pattern-based retrieval over graph data.

Knowledge graphs are valuable for search, recommendation, fraud analysis, enterprise integration, scientific discovery, and question answering. Their practical success depends on entity resolution, provenance, temporal validity, access control, and quality assurance. A graph may contain many links but still be semantically weak if predicates are ambiguous or sources are unreliable.

Knowledge graphs and ontologies serve different roles. A graph usually stores assertions about particular entities; an ontology specifies the conceptual vocabulary, class hierarchy, relations, and constraints that give those assertions meaning. In practice, an ontology may govern a knowledge graph, while the graph supplies domain instances.

Description Logics and Ontology Engineering

Description logics (DLs) are formal languages designed to represent concepts, roles, and individuals while retaining decidable reasoning in carefully chosen fragments. A DL knowledge base generally contains:

  • A TBox, describing terminology, classes, and class relationships.
  • An ABox, describing assertions about individuals.
  • Sometimes an RBox, describing properties and their characteristics.

For example, a TBox may state:

`GraduateStudent ⊑ Student`

`Student ⊑ Person`

`EnrolledIn ⊑ RelatedTo`.

An ABox may state:

`GraduateStudent(Leena)`

`EnrolledIn(Leena, AI_Course)`.

A reasoner can infer that Leena is a student and a person. DLs support important services such as classification, consistency checking, instance retrieval, and satisfiability testing. Web Ontology Language (OWL) is based on description-logic foundations, although different OWL profiles offer different trade-offs between expressiveness and computational cost.

Taxonomies, Thesauri, and Ontologies

A taxonomy organizes concepts primarily through hierarchical relations such as broader-than and narrower-than. A biological taxonomy or product classification scheme is a typical example. A thesaurus adds synonyms, related terms, and associative relationships. An ontology is broader and more formal: it specifies classes, properties, constraints, axioms, and sometimes domain assumptions in a way intended to support shared interpretation and automated reasoning.

Ontology design commonly proceeds through iterative stages:

1. Define the domain, purpose, users, and competency questions.

2. Identify important terms and candidate concepts.

3. Organize classes into a hierarchy.

4. Define object properties, data properties, domains, and ranges.

5. Add constraints, axioms, disjointness, equivalence, and restrictions.

6. Create or link individuals and external vocabularies.

7. Test the ontology with examples and a reasoner.

8. Document provenance, versioning, governance, and change decisions.

A competency question is a question the ontology should help answer, such as “Which laboratories are authorized to test samples from a particular category?” It prevents ontology development from becoming an uncontrolled attempt to model everything.

An ontology should distinguish classes from individuals. `Hospital` may be a class, while `CentralHospital` is an individual. It should also distinguish object properties, which link individuals, from data properties, which link individuals to values such as dates or numbers. Domain and range declarations can support inference, but they should not be used casually because they may create unexpected classifications.

Comparing Representation Approaches

No single formalism is optimal for every problem. Propositional logic is simple and precise but has limited structure. First-order logic is expressive but may be computationally expensive. Semantic networks and frames are intuitive and modular, yet require formal semantics for dependable reasoning. Production rules are effective for operational decisions but can become brittle. Knowledge graphs scale well for integration and exploration, while ontologies provide conceptual discipline and logical interpretation. Description logics offer a particularly useful compromise between expressiveness and decidability.

Selection should be guided by the nature of the task. A configuration adviser with explicit domain rules may favour production rules. A biomedical integration platform may require an ontology, a knowledge graph, provenance metadata, and probabilistic evidence. A natural-language question-answering system may combine a graph with linguistic parsing and statistical ranking. Hybrid architectures are common because symbolic representations offer structure and explanation, while machine learning offers perception, extraction, and pattern recognition.

Applied Case: An Ontology-Enabled University Course Advisory System

Background

The following is an illustrative case. A university wishes to build a course advisory system for postgraduate students. Existing information is distributed across a student information system, departmental catalogues, prerequisite documents, timetable records, and instructor profiles. Students frequently receive incorrect advice because course names differ across departments and prerequisite rules are expressed inconsistently.

Situation and Problem

The system must answer questions such as: “Which courses may a student take next term, given completed courses, programme requirements, delivery mode, timetable constraints, and prerequisites?” A simple keyword search cannot reliably distinguish a course from a topic, represent prerequisite alternatives, or infer that an advanced course is a specialization of a broader subject.

Analysis

The design team identifies several knowledge types. Courses, programmes, departments, instructors, and students are classes. “Requires,” “offeredBy,” “partOfProgramme,” and “scheduledAt” are object properties. Course codes, credits, and dates are data properties. Prerequisite rules require more than a flat taxonomy because some courses require one course, while others accept any course from a specified group.

The team adopts an ontology for stable concepts and a knowledge graph for current instances. A rule component evaluates eligibility and timetable constraints. Provenance records identify the catalogue or regulation from which each assertion was obtained. The open-world assumption is retained for general ontology reasoning, but the advisory application explicitly reports “information unavailable” when a required record is missing rather than treating missing data as permission.

Approach and Solution

The ontology includes `Course`, `Programme`, `Module`, `Student`, `Department`, and `Instructor`. It defines subclass relations such as `ArtificialIntelligenceCourse ⊑ ComputerScienceCourse`. It models `requiresCourse`, `offeredBy`, and `hasPrerequisiteGroup`. Course instances are linked to academic terms and delivery modes.

A student’s completed courses are represented as graph assertions. A reasoner infers class membership and checks consistency. A rule engine then applies operational policies, for example:

`IF Student hasCompleted Prerequisite AND Course isOfferedIn Term THEN Course isCandidate`.

Additional rules remove courses that conflict with the student’s timetable or exceed credit limits. The interface displays each recommendation with an explanation: completed prerequisite, programme relevance, offering period, and any unresolved information.

Outcome

The resulting system provides more consistent advice and makes catalogue relationships searchable across departments. More importantly, academic staff can inspect and revise the ontology and rules separately. A change in the university’s prerequisite policy does not require rewriting the entire software application.

Learning Points

The case demonstrates that an ontology is not simply a database schema. It supplies shared meaning and supports classification, while the graph stores assertions and the rule engine handles policy decisions. It also shows why provenance, temporal validity, exception handling, and explanation must be designed from the beginning.

Challenges, Risks, and Professional Governance

Knowledge acquisition is often the largest practical difficulty. Experts may disagree, documents may use ambiguous terminology, and tacit knowledge may be difficult to articulate. Automated extraction can accelerate construction but may introduce incorrect entities, relations, or confidence estimates. Every important assertion therefore needs validation or provenance.

Semantic ambiguity is another risk. The word “bank” may denote a financial institution or a river edge; “member” may describe employment, association, or group membership. Reusing an external ontology can improve interoperability, but imported concepts may carry assumptions that do not suit the local domain.

Inconsistency can arise from conflicting sources, changes over time, or inappropriate axioms. Excessive detail can make an ontology expensive to maintain, while insufficient detail makes it unhelpful. Overly broad class hierarchies may encourage invalid inheritance. Designers should test competency questions, maintain version histories, and distinguish asserted facts from inferred facts.

Ethical and governance issues are particularly important when representations support high-impact decisions. A medical or educational ontology can encode institutional bias, exclude culturally specific concepts, or make sensitive classifications appear objective. Access controls should protect confidential facts. Decisions should be auditable, and affected users should be able to challenge incorrect data or interpretations. Ontology-driven reasoning does not automatically make a decision fair; the choice of concepts, rules, sources, and thresholds remains a human governance responsibility.

Current Directions and Best Practices

Contemporary systems increasingly combine symbolic and statistical methods. Language models and information-extraction systems can propose ontology terms or graph links, but human review remains necessary for authoritative knowledge. Neuro-symbolic systems use learned representations together with rules or logical constraints. Temporal, probabilistic, and fuzzy extensions are being used where facts are uncertain or change over time.

Effective practice includes:

  • Begin with a clearly bounded purpose and competency questions.
  • Use stable identifiers and document term definitions.
  • Separate the conceptual model from application-specific rules.
  • Record source, time, confidence, and responsible authority for assertions.
  • Reuse established vocabularies where their semantics are appropriate.
  • Test both expected inferences and unintended inferences.
  • Treat missing information differently from confirmed negative information.
  • Establish review, versioning, access, and retirement procedures.
  • Provide explanations that distinguish facts, rules, and inferred conclusions.

Chapter Summary

Knowledge representation provides formal and semi-formal structures through which AI systems store, interpret, and reason about domain knowledge. Propositional logic offers simple truth-functional representation, whereas first-order logic adds objects, predicates, variables, and quantifiers. Semantic networks, frames, scripts, and production rules provide more operational or human-oriented structures. Knowledge graphs represent interconnected entity assertions, while ontologies define shared concepts, properties, constraints, and axioms. Description logics support useful ontology reasoning with controlled computational complexity.

The choice of representation depends on expressiveness, inference requirements, scalability, maintainability, explainability, and the assumptions made about missing information and exceptions. In practical systems, ontologies, graphs, rules, databases, and machine-learning components are often combined. Reliable knowledge engineering requires careful scope definition, provenance, consistency testing, governance, and attention to ethical consequences.

Key Terms

Knowledge representation: The formal or structured encoding of domain knowledge for storage and reasoning.

Semantics: The meaning assigned to symbols and expressions in a representation.

Inference: The derivation of conclusions from known facts and rules.

Propositional logic: A logic in which complete propositions are combined using truth-functional connectives.

First-order logic: A logic with objects, predicates, variables, functions, and quantifiers.

Predicate: A symbolic expression representing a property or relation.

Quantifier: An operator stating whether a formula applies to all or some objects.

Semantic network: A graph-like representation of concepts and labelled relationships.

Frame: A structured representation with slots describing an entity or situation.

Script: A representation of a stereotyped sequence of events.

Production rule: An if–then rule that maps conditions to conclusions or actions.

Knowledge graph: A graph of entities and semantically labelled relationships, often represented as triples.

Taxonomy: A hierarchical organization of concepts, usually by broader and narrower relations.

Ontology: A formal specification of concepts, properties, constraints, and relationships in a domain.

Description logic: A family of decidable logic-based languages for representing concepts, roles, and individuals.

TBox: The terminological component of a description-logic knowledge base.

ABox: The assertional component containing facts about individuals.

Open-world assumption: The principle that absence of a statement does not establish its falsity.

Provenance: Information about the source, history, authority, or time of a knowledge assertion.

Competency question: A domain question used to define and test what an ontology should represent or answer.

Review Questions

Short Answer Questions

1. What are the syntax, semantics, inference, and pragmatics of a knowledge representation?

2. How does first-order logic improve on propositional logic?

3. What is the difference between a taxonomy and an ontology?

4. Explain the open-world assumption with an example.

5. Distinguish a TBox from an ABox.

Long Answer Questions

1. Explain propositional logic and first-order logic, including their expressive capabilities and limitations.

2. Describe semantic networks, frames, scripts, and production rules, and compare their typical uses.

3. Explain the structure and role of knowledge graphs in enterprise or scientific applications.

4. Discuss description logics and their contribution to ontology reasoning.

5. Present a systematic methodology for designing, testing, and governing a domain ontology.

Analytical / Application Questions

1. Design a small ontology for a hospital appointment system. Identify at least five classes, four properties, two constraints, and three example individuals.

2. A rule-based loan advisory system concludes that an applicant is eligible because no adverse credit record is stored. Analyse this conclusion using the open-world and closed-world assumptions.

3. A university integrates course catalogues from three departments that use different meanings for “core course.” Propose a knowledge-representation architecture and explain how it would manage semantics, provenance, conflicts, and updates.

22. Multiple Choice Questions with Answers

Question 1

Which statement best distinguishes an ontology from a knowledge graph?

A. An ontology stores only numerical data, whereas a knowledge graph stores text.

B. An ontology specifies shared concepts and relationships, while a knowledge graph commonly stores assertions about entities using those concepts.

C. An ontology is always informal, whereas a knowledge graph is always expressed in first-order logic.

D. An ontology supports no inference, whereas a knowledge graph supports unlimited inference.

Correct Answer: B. An ontology specifies shared concepts and relationships, while a knowledge graph commonly stores assertions about entities using those concepts.

Question 2

What can first-order logic express that propositional logic cannot express naturally?

A. Truth values

B. Logical conjunction

C. Relationships among objects using variables and quantifiers

D. Negation of a proposition

Correct Answer: C. Relationships among objects using variables and quantifiers

Question 3

Under the open-world assumption, what follows when a knowledge base does not state that a patient has an allergy?

A. The patient definitely has no allergy.

B. The patient definitely has the allergy.

C. The information is unknown unless a separate rule establishes it.

D. The knowledge base is inconsistent.

Correct Answer: C. The information is unknown unless a separate rule establishes it.

Question 4

Which representation is most directly suited to modelling a stereotyped sequence such as entering a restaurant, ordering, eating, and paying?

A. Script

B. Taxonomy

C. Propositional formula

D. ABox

Correct Answer: A. Script

Question 5

In a description-logic knowledge base, which component normally contains assertions about particular individuals?

A. TBox

B. ABox

C. RBox only

D. Taxonomy

Correct Answer: B. ABox

Question 6

A system repeatedly applies rules to facts in working memory and derives additional facts until no applicable rules remain. Which reasoning strategy is this?

A. Forward chaining

B. Backward chaining

C. Entity resolution

D. Abductive parsing

Correct Answer: A. Forward chaining

Question 7

Why is provenance important in a knowledge graph used for academic advising?

A. It guarantees that every inference is probabilistic.

B. It records the source and possibly time or authority of assertions, supporting verification and dispute resolution.

C. It removes the need for ontology design.

D. It converts all graph relations into numerical vectors.

Correct Answer: B. It records the source and possibly time or authority of assertions, supporting verification and dispute resolution.

Question 8

Which design decision is most likely to cause unintended ontology inferences?

A. Using stable identifiers

B. Recording the source of an assertion

C. Declaring broad domains and ranges without checking their implications

D. Testing competency questions

Correct Answer: C. Declaring broad domains and ranges without checking their implications

Question 9

A representation must model that every researcher supervises at least one student. Which formula captures this meaning?

A. ∃y(Student(y) ∧ ∀x(Researcher(x) → Supervises(x,y)))

B. ∀x(Researcher(x) → ∃y(Student(y) ∧ Supervises(x,y)))

C. ∀x(Student(x) → ∃y(Researcher(y) ∧ Supervises(x,y)))

D. ∃x(Researcher(x) ∧ ∀y(Student(y) → Supervises(x,y)))

Correct Answer: B. ∀x(Researcher(x) → ∃y(Student(y) ∧ Supervises(x,y)))

Question 10

Which architecture is most appropriate for a university advisory system requiring shared course meanings, current course instances, and operational eligibility policies?

A. A propositional table alone

B. A semantic network without identifiers or rules

C. An ontology combined with a knowledge graph and a rule component

D. A script containing only the student registration sequence

Correct Answer: C. An ontology combined with a knowledge graph and a rule component

Artificial Intelligence and Expert System
Chapter 4 of 15