2 - Knowledge Representation
2 - Knowledge Representation
1. KNOWLEDGE REPRESENTATION
One of the assumptions underlying most work in artificial intelligence is that intelligent
behaviour can be achieved through the manipulation of symbolic structures representing bits
of knowledge. For example, we could use the symbol red to denote a particular colour, the
symbol johns-car to denote John’s car, and the symbolic structure red(johns-car) to denote
the fact that John’s car is red. An AI program could use this fact and maybe draw
conclusions about the personality of the owner.
In an expert system, the knowledge base stores the information about the subject domain.
The information is not a collection of records and fields as in a database but rather a symbolic
representation of the knowledge of a human expert. The information is in a format that
allows the inference engine to perform deductions based on the knowledge.
One of the problems with deciding on a method of knowledge representation is that there is a
mismatch between the way a human thinks and the way a computer structures information
internally. The problem is thus one of knowing how to encode knowledge so that it is a faithful
reflection of what a person knows and so that the computer can manipulate it.
1.1 What Is Knowledge?
Before we can discuss the representation of knowledge in a knowledge base we need to have
a clear idea of what knowledge is and how it differs from data or information. Consider the
following definitions:
Information, on the other hand, always has a context. If you say '1000', that is data.
If you say '1000 isobars at noon in Port Elizabeth' you are conveying information.
Knowledge is a guide to informed practise. Knowledge and information are very close to each other
in character, with one major difference; information is processed but knowledge is understood.
John Durkin defines knowledge as “understanding of a subject area” (1994, p. 53). Knowledge is
concerned with using information effectively. Effective use of knowledge can lead to the formation
of plans of action and to deeper understanding.
There exist several types of knowledge. In fact there is even a field of study, called epistemology,
which is a study of knowledge and its nature, structure and origins. Most knowledge can be classified
as one of the following:
Below are some examples to demonstrate the differences between data, information and the
different types of knowledge:
IF YOU CUT A TOMATOE YOU CAN SEE THE SMALL SEEDS INSIDE –
causal knowledge
There are often exceptions or contradictions to the rules. For example, most of us would be able to
identify green tomatoes even though we might say that tomatoes are red.
Knowledge can be absolute or it can be relative or uncertain. If the doctor says that a child has
measles because he is running a high temperature and has spots, he is probably right. We can assign
certainty factors to some knowledge to indicate to what degree we believe the statement. We can
say, for example, that if a child is running a high temperature and he has spots then the chance that
he has measles is 80%. If he has been in contact with someone recently who had measles then that
probability can be increased. If he has had a measles injection as a baby then the chance that he has
measles is decreased.
Humans are able to identify the boundaries or scope of their knowledge fairly quickly although they
might sometimes feel that some aspect is "on the tip of their tongue". If you are asked to look up
the telephone number of the author William Shakespeare you will probably say that this is
impossible and why. The computer, however, unless it knows that telephones were not invented
then could spend some time looking for the telephone number. Computers cannot cater for general
knowledge, and we, as knowledge engineers, should always remember that.
We can measure the quality of knowledge on the following dimensions (Forsyth, 1990):
Scope - what does it cover?
Granularity - how detailed is it?
Uncertainty - how certain or plausible is it?
Completeness - are our conclusions correct even if we get more knowledge?
Consistency - are there contradictions and can we live with them?
Knowledge representation is one of the most central and, in some ways, most familiar concepts in
AI. Knowledge representation for expert systems can be defined as “the method used to encode
knowledge in an expert system’s knowledge base” (Durkin, 1994). This representation must be
capable of being manipulated in order to make deductions and generate new knowledge.
To understand what knowledge representation is, and to better understand some of its
advantages and disadvantages, we will examine the five different roles that a representation
follows and what that means for us as knowledge engineers.
Reasoning is a process that goes on internally, but most things an intelligent being would want to
reason about exist only externally. This fact is a fundamental rational and role for a representation.
Instead of using the “thing” itself in our reasoning processes, we use a representation or a surrogate
(a surrogate is a substitute for the real thing). Thus, in our reasoning process we think about
consequences certain actions on an object would have instead of performing those actions directly
on the object. Unfortunately this representation of an object we use is always less complete than
the object itself. The only completely accurate representation of an object is the object itself. All
other representations are inaccurate; they inevitably contain simplifying assumptions and, possibly,
artefacts (Davis, Shrobe & Szolovits, 1993). This means that regardless of how we choose to
represent knowledge it will always be flawed. A good representation is one that minimizes the
errors for the specific task at hand.
1. the representation typically incorporates only a small part of the beliefs that motivated
it, and
2. this insight or belief is only a small part of the phenomenon of intelligent reasoning in
general.
This “theory” is often implicit but can be made more evident by examining its three components,
namely:
Lastly, knowledge representation is also the means by which we express things about the world and
is thus a medium of human expression.
1.3 Methods of Knowledge Representation
Now that you know what knowledge representation is we can examine how we make use of
it. A number of different representation techniques exist. These include, amongst others:
Rules
Semantic nets
Frames
Object-attribute-value triplets
Scripts
Logic systems
Knowledge representation languages
Conceptual graphs
1.3.1 Rules
One of the most popular ways to represent knowledge in expert systems is by using rules. Rule-
based systems use production rules to encode the knowledge. A rule is defined as “a knowledge
structure that relates some known information to other information that can be concluded or
inferred to be known.” (Durkin, 1994) These rules normally have the following form:
It is important to note that conjunctive (AND) and disjunctive (OR) clauses hold in rules. Examples of
such rules for an expert system that recommends the correct wine to have with your meal are:
Rules can be used to represent many different types of knowledge, for example:
Relationship
IF the battery is dead
Directive
IF the car will not start
Strategy
IF the car will not start
THEN first check out the fuel system then check out the electrical system
Heuristic
IF the car will not start
Rules can also be categorized according to the nature of the problem-solving paradigm:
Interpretation Problem
IF voltage of resistor R1 > 2.0 volts
Diagnosis Problem
IF the main organism is grampus
Design Problem
IF current task is to assign a power supply
Instead of the rule above, it would make more sense to have a rule like this one:
IF X is an employee
(where the X represents a variable that can be instantiated to any employee as needed.)
Semantic networks (also called associative networks) represent objects and the relations between
objects in a domain. They are a method of knowledge representation using a directed graph made
up of nodes and arcs, where the nodes represent objects and the arcs represent the relationships
between the objects (Durkin, 1994).
Figure 3-1: An Example of a Semantic Network
Thus, semantic networks use nodes and arcs to provide a graphical view of a problem’s objects,
properties and relationships. Both nodes and arcs have labels that clearly describe the objects and
relationships represented.
The ISA (Is A) relationship is a term to show when one item is a type of another one. Another type
of relationship is the AKO (A Kind Of ) relationship. We can retrieve information from the above
semantic network such as the fact that birds fly. We can deduce other facts like, Ross is a seagull.
We say Ross ISA seagull, however a seagull is AKO bird. AKO indicates a category instead of a specific
thing. An important characteristic of semantic nets is the fact that they support inheritance. This is
best illustrated by looking at the following diagram.
Semantic networks offer a simple way of representing knowledge but they have a few
problems:
It is difficult to pick the right set of items in the beginning and it is then difficult to
add new items later as one must link them to the existing nodes.
Networks cannot make a distinction between, for example, a particular book, all
books or no books, etc. It is difficult to express knowledge of the sort:
The meaning of nodes and links is often bound up with the retrieval and inference
capabilities of the system. People are not always particular about how they assigned
meanings to nodes.
Searches for knowledge are not knowledge-based. There is nothing to tell you how to
go about searching for the knowledge needed.
Semantic nets are logically inadequate because they cannot define knowledge in a
way that logic can.
1.3.3 Frames
Frames are an extension to semantic networks. Nodes are replaced by more structured groupings of
information. Many frame systems organise the frames in a hierarchical manner so that they can
represent classes and subclasses. Each node in a frame network is a detailed description of what an
object is, for example, a frame about a bird might include knowledge that is has legs and wings, and
how it hunts for food. Frames can be defined as “a data structure for representing stereotypical
knowledge of some concept or object.” (Durkin, 1994) The diagram below gives a simple
hierarchical representation for classifying animals:
NAME:
Breathes:
Colour:
Number of legs:
Number of wings:
Fly:
Size:
NAME: Mammal
AKO: Animal
Breathes:
Number of wings: 0
Fly: No
The AKO slot is used to show that a mammal is a kind of (AKO) animal. The Breathes slot is not
filled in because all animals breathe and the mammal is AKO (a kind of) animal. Therefore, it inherits
all of the attributes of an animal.
NAME: Elephant
AKO: Mammal
Breathes:
Colour: Grey
Number of legs: 4
Number of wings:
Fly:
Size: Large
The fact that it breathes, has no wings and cannot fly is inherited from its relationship to Mammal.
Big Foot, an African Elephant who lived in the Addo Elephant Park would, in turn, inherit all the
attributes of Elephant. We could add slots for him to show where he lived, etc. Dumbo, however, is
a problem. He was an elephant who could fly and elephants cannot fly. Frames allow one to cater
for such contradictions, as shown below:
NAME: Dumbo
ISA: Elephant
Colour:
Number of legs:
Number of wings:
Fly: Yes
Size: Large
All one needs to do is fill in the Fly slot with Yes for Dumbo. Note that the frame system will only try
to get a value by inheritance if the value is not filled in.
We can allow an item to inherit information from more than one parent. Assume that we are
storing information about Quakers religion and Republican political party. This is illustrated below:
: :
Pacifist: Yes Pacifist: No
Now, consider former US President Richard Nixon. He was both a Quaker and a Republican. Should
he inherit the Yes from Quaker or the No from Republican?
:
Pacifist: ???
Some inheritance schemes draw no conclusion if there is conflicting evidence while others allow
multiple conclusions. Thus, be careful that you cater for these in your systems.
Demons are procedures that are attached to the data structures. A demon would perform a function
similar to that of methods in an object-oriented design. As an example, we could have the following
hierarchical representation of polygons:
NAME:
Number of sides:
Length of sides:
Size of angles:
Area:
An algorithm that allows one to calculate the area given the appropriate information could fill
the slot for area. The area slot would then be filled with a demon. The procedure can be
inherited as needed although new demons can be given for rectangles or squares as the
procedure simplifies.
1.3.4 Object-Attribute-Value Triplets
In expert systems, facts are used to help describe parts of frames, semantic networks or rules. They
are also used to describe relationships between more complex knowledge structures and to control
the use of these structures during problem solving. A fact, in both expert systems and general AI, is
often called a proposition. A proposition is a statement that is either true or false, for example, “it is
raining.” In an expert system we assert in the working memory the Boolean truth value of this
statement and then use it in processing other knowledge.
One object can also have multiple attributes and values, as shown below:
Figure 3-6: An Example of an O-A-V Diagram with Multiple Attributes and Values
1.3.5 Scripts
Scripts are another object-oriented approach (Black, 1986). It is thought that understanding
requires not only a conceptual memory but also higher-level memory structures. They contain
sequences of typical events organised around particular human activities. Going to a restaurant
might, for example, include the following actions:
paying, and
leaving.
“John went to a restaurant. The waiter came to him. He ordered lobster. When the cheque
came, John paid it and left a large tip. He then left the restaurant.”
Given the above story, we can infer that "John ate lobster". This is called script instantiation where
the system tries to instantiate all the variables used in the script and make plausible inferences from
this. Note that syntactic rules are also necessary to determine, for example, who "He" is in the story.
Logic is a powerful tool in an AI researcher's hands. Logic languages are used to represent
information and to reason with that information. At the lowest levels logic systems form the basis of
all computer science.
In order to evaluate whether or not the book is on the table we now have to determine whether the
symbolic variable P is true or false. The atomic propositions can be combined using logical
connectives to form complex statements called sentences or well-formed formulas (wffs). The
connectives used include:
Operator Symbol
AND
OR
NOT
IMPLIES ,
EQUIVALENCE
John is a human
therefore
John is mortal.
In logic, this would be expressed in one of the following forms:
P P
therefore Q Q
Truth tables define the semantics of sentences. For example, consider the following:
(P Q) == ~(~P ~Q) The book is on the table OR the cup is on the table is equivalent to...
The second is difficult to describe in words. We can draw a truth table to determine the
validity of the statement, however.
T T T F F F T
T F T F T F T
F T T T F F T
F F F T T T F
Propositional calculus allows one to represent knowledge in a complete and sound method. It
has a sound mathematical background for reasoning. It has some limitations, however. We
cannot capture generalisations and relationships between propositions, for example “most of
the class received A’s.”
1.3.6.2 Predicate Calculus
Predicate calculus addresses some of the limitations of propositional calculus (Forsyth, 1990). Facts
are represented as a combination of predicate and argument. Consider the following examples:
Example Meaning
In the first example, on is a predicate name, and book and table are arguments, giving the atomic
statement on(book, table). The last example in the table is a general statement. X may be
“instantiated” or given the value of any object that is on the table. Note that, as with propositional
logic, we can use logical connectives to combine atomic sentences into sentences.
Statements like “Nellie likes apples” are easily expressed in predicate calculus. You simply use the
verb as the predicate name and the nouns as the arguments, to get likes(nellie, apples). A statement
describing a property of an individual, such as “Nellie is large”, can also be easily expressed. The
convention is to make this into a one-argument predicate, such as large(nellie). If Nellie is both large
and hairy, the logical connectivemust be used: large(nellie)hairy(nellie). Similarly, if Nellie
likes both apples and bananas: likes(nellie, apples)likes(nellie, bananas). Note that logical
connectives cannot be used within an argument of a predicate, so likes(nellie, applesbananas) is
invalid.
Statements of the form “if X then Y” can be translated into X Y. So, “If Nellie is hungry then he
eats apples and bananas” could be: hungry(nellie) eats(nellie, apples)eats(nellie, bananas).
And to assert that something is not true, ~ is used: ~likes(nellie, oranges).
Predicate calculus also has two standard quantifiers, called universal and existential:
For example, if P represents “elephants are mammals” we can state the following:
Example Meaning
Quantifiers allow us to make statements about all values of X or to say that at least one X occurs
with a particular property. This is illustrated in the first two of the final examples shown below:
Example Meaning
(x) (on(x,table)) ~heavy(x) For every value of x, if x is on the table then x is not
heavy
(x) (y) (x + y = y + x) For every x and for every y, the sum of x and y
equals the sum of y and x
(x) (person(x) y) loves(x,y)) Every person has something that they love
Table 3-6: Predicate Calculus Examples
Note that a sentence should have all its variables quantified. So, the expression (x) (loves(x,y)) is
not a valid sentence on its own as variable y is not quantified.
Logic has clear semantics. One can determine exactly the meanings of the expressions. One can
also make some very expressive logic statements. However, there are some types of statements
that cannot even be expressed in predicate logic using the universal and existential quantifiers. For
example, the statement ”Most of the class received A’s” cannot be expressed in predicate logic
(where “Most” means more than half). To implement Most, the logic system must provide some
predicates for counting, as in fuzzy logic (discussed later). Another limitation of predicate logic is in
expressing things that are sometimes true but not always true (e.g. “Apples are red”), facts that
involve uncertainty (e.g. “It will probably rain tomorrow”), defaults (e.g. “It normally rains in
Glasgow”), beliefs (e.g. “John believes it will rain”), and time/change (e.g. “It will get wetter and
wetter as you near Glasgow”). Some of these problems can also be solved by fuzzy logic. However,
introducing more complex logic also introduces more complications into the logic system and makes
it more like mathematics.
The following describes the essential differences between structured objects and production rules:
Structured objects represent the world in a more analogical way. Instead of the
knowledge about a domain being scattered among the rules that use it, the knowledge
is packaged in one place.
Objects are viewed in relation to other objects, whereas rules can be created in
isolation and can be added to the knowledge base without regard for the other rules in
the knowledge base.
When building a rule-based system you focus on the rules to solve the problems and
how to group them. When building an object-oriented system you focus on
describing the objects in the expert’s world, their components and their relationships,
not rules and procedures.
Objects are organised with their associated descriptions and procedures. They control
their actions locally. Inferencing in production systems and logic systems are usually
controlled from a global level.
Inferencing in object-oriented systems is by inheritance. Objects belong to classes
and inherit the general characteristics of the classes to which they belong. Default
characteristics can be specified and also overridden to handle exceptions. This type of
inferencing is difficult with production systems and probably impossible with logic
systems.
The following are some of the factors that should be considered when choosing between frames and
logic to represent knowledge:
Everything in a frame system can be translated into predicate logic, but not vice versa.
Frames have a weaker representational adequacy (i.e. the ability to represent all the
knowledge you need to reason with) than logic. However, you gain inferential
efficiency (i.e. the ability to make inferences efficiently) by reasoning with a
restricted subset, so this often make frames worthwhile.
Predicate logic is more powerful than structured objects, but some facts may be less
clear and more difficult to work with.