Knowledge
Representation
methods
1
Introduction
• Real knowledge representation and reasoning systems come
in several major varieties.
• They all based on FOL but departing from it in different ways
• These differ in their intended use, degree of formal semantics,
expressive power, practical considerations, features,
limitations, etc.
• Some major families of reasoning systems are
– Theorem provers
– Logic programming languages
– Rule-based or production systems
– Semantic networks
– Frame-based representation languages
– Databases (deductive, relational, object-oriented, etc.)
– Constraint reasoning systems
– Truth maintenance systems
– Description logics
2
Four general representation types
• Logical representation
• Semantic Networks
• Production rules
• Frames
3
Logical representation
What is a logic?
• A language that lay down some concrete communication
rules in order to give information to agents with out errors
in communication (or fewer).
• Every sentence is translated into logical language.
• Almost equal expressive power compared to natural
language (e.g. English)
• Not to be confused with logical reasoning; it is a process,
not a language.
4
Syntax and semantics of logics
• Syntax:
– How we can construct legal sentences in the logic
– Which symbols we can use (English: lettres, punctuation)
– How we are allowed to write down those symbols
• Semantics:
– How we interpret (read) sentences in the sentence
– Describes what the meaning of the sentence is
5
Propositional logic
• Syntax:
– Propositions such as P meaning “it is wet”
– Connectives: and ,or, not, implies, equavalent
˄ ˅ ˺ → ↔
- Brackets, T(true), F(false)
• Semantics:
• How to work the truth of a sentence
• Need to know how connectives affect truth
• E.g. “P ˄ Q” is true iff P is true and Q is true
6
First Order Logic
• More expressive than Propositional
• Syntax allows:
– Constants, variables, predicates, functions, and quantifiers
• Semantics:
– Working out of the truth of statement
7
Production Systems (forward-chaining)
• The notion of a “production system” was invented in 1943 by
Post to describe re-write rules for symbol strings
• Used as the basis for many rule-based expert systems
• Most widely used KB formulation in practice
• A production is a rule of the form:
C1, C2, … Cn => A1 A2 …Am
Left hand side (LHS) Right hand side (RHS)
Conditions/antecedents Conclusion/consequence
Condition which must hold Actions to be performed or conclusions
before the rule can be applied to be drawn when the rule is applied
• Consists of <condition, action> pairs
• Agent looks if a condition holds
•If so, the production rule “fires” and the action is carried out
•E.g. bird(x) => fly(x) ==if x is bird then x can fly.
8
Semantic Networks
• Structured representations (semantic networks and frame
systems)
– Put structures into KB (capture the interrelations between pieces of
knowledge
– Center around object/classes
– More for what it is than what to do
• History of semantics networks (Quillian, 1968)
– To represent semantics of natural language words by dictionary-
like definitions in a graphic form
– Defining the meaning of a word in terms of its relations with other
words
– Semantic networks were very popular in the 60’s and 70’s and
enjoy a much more limited use today.
– The graphical depiction associated with a semantic network is a
big reason for their popularity.
9
machine
is a pilot
can do
airplane fly
used for operated by
used for
move cargo move people pilot
is a
Boeing 747
– Nodes for words
– Directed links for relations/associations between words
– Each link has its own meaning
– You know the meaning (semantics) of a word if you know the
meaning of all nodes that are used to define the word and the
meaning of the associated links
– Otherwise, follow the links to the definitions of related words
10
Semantic Networks
• A semantic (or associative) network is a simple
representation scheme which uses a graph of labeled nodes
and labeled, directed arcs to encode knowledge.
– Labeled nodes: objects/classes/concepts.
– Labeled links: relations/associations between nodes
– Labels define the semantics of nodes and links
– Large # of node labels (there are many distinct objects/classes)
Small # of link labels (types of associations can be merged into a few)
buy, sale, give, steal, confiscation, etc., can all be represented as a
single relation of “transfer ownership” between recipient and donor
– Usually used to represent static, taxonomic, concept dictionaries
• Semantic networks are typically used with a special set of
accessing procedures which perform “reasoning” 11
– e.g., inheritance of values and relationships
• often much less expressive than other KR formalisms
Nodes and Arcs
• Nodes denote objects/classes
• arcs define binary relationships between objects.
mother age
Sue john 5
wi
age fe
hus father mother(john,sue)
ban
d age(john,5)
34 Max wife(sue,max)
age
age(sue,34)
...
12
ISA hierarchy
• The ISA (is a) or AKO (a
kind of) relation is often
used to link a class and its Animal
superclass.
• And sometimes an instance isa
and it’s class. hasPart
• Some links (e.g. has-part) Bird
are inherited along ISA
paths. isa Wings
• The semantics of a semantic Robin
net can be relatively
informal or very formal isa isa
– often defined at the
implementation level
Rusty Red
13
Individuals and Classes
Genus
• Many semantic Animal
networks distinguish
subclass instance
– nodes representing
individuals and those hasPart
representing classes
Bird
– the “subclass” relation subclass Wing
from the “instance-of”
relation Robin
instance instance
Rusty Red
14
Inference by Inheritance
• One of the main types of reasoning done in a semantic
net is the inheritance of values (properties) along the
subclass and instance links.
• Semantic Networks differ in how they handle the case
of inheriting multiple different values.
– All possible properties are inherited
– Only the “lowest” value or values are inherited
15
Multiple inheritance
• A node can have any number of superclasses that contain it,
enabling a node to inherit properties from multiple "parent"
nodes and their ancestors in the network.
• Conflict or inconsistent properties can be inherited from
different ancestors
• Rules are used to determine inheritance in such "tangled"
networks where multiple inheritance is allowed:
– if X A B and both A and B have property P (possibly
with different variable instantiations), then X inherits A’s
property P instance (closer ancestors override far away ones).
– If X A and X B but neither A B nor B A and both A
and B have property P with different and inconsistent values,
then X will not inherit property P at all; or X will present both
instances of P (from A and B) to the user
16
From Semantic Nets to Frames
• Semantic networks morphed into Frame Representation
Languages in the 70’s and 80’s.
• A Frame is a lot like the notion of an object in OOP, but has
more meta-data.
• A frame represents a stereotypical/expected/default view
of an object
• Frame system can be viewed as adding additional structure
into semantic network, a frame includes the object node and
all other nodes which directly related to that object,
organized in a record like structure
• A frame has a set of slots, each represents a relation to
another frame (or value).
• A slot has one or more facets, each represents some aspect
of the relation
17
Facets
• A slot in a frame holds more than a value.
• Other facets might include:
– current fillers (e.g., values)
– default fillers
– minimum and maximum number of fillers
– type restriction on fillers (usually expressed as another frame
object)
– attached procedures (if-needed, if-added, if-removed)
– salience measure
– attached constraints or axioms
– pointer or name of another frame
18
19
Exercise
• Constructing new fact which follows from a knowledge
base represented using a semantic network is by applying:
A. Association rules
B. Inference rules
C. Inheritance
D. B&C
20
• How could the information in this network be represented in predicate
logic?
• Consider the following additional facts are inserted into the system:
– All mammals can move;
– Platypus lays eggs ;
– Platypus can fly;
– Only platypus has wings among mammals;
– Cow has four legs.
• Show the representation of additional facts in semantic net.
• Show the complete representation of facts using frame.
21
Building a knowledge base
• We have seen that first order logic is a powerful tool for
knowledge representation and reasoning.
• Logic does not offer guidance as to what facts should be
expressed, nor does it give a guide on what vocabulary should
be used to express them.
• Process of building a knowledge base is called knowledge
engineering.
Knowledge engineer
• A person who
– Investigates a particular domain
– Determines what concepts are important in the domain
– Creates a formal representation of objects and relations in the domain
– Is trained in representation but is not an expert
– Usually interviews the real experts to become educated about the domain
and to get the required knowledge (process of knowledge acquisition)
• Interviewing occurs before or along with the process of
creating formal representation
• One does not become proficient knowledge engineer just by
studying the syntax and semantics of a representation
language. It takes practice and exposure.
Criteria of good knowledge bases
• A knowledge base should be clear and correct
• The representation language in the knowledge base
should be expressive, concise, unambiguous, and
effective
• Relations should be relevant
• Knowledge base and inference procedure should be
clearly maintained/separated
• What ever language you use to represent the
knowledge, the inference procedure should provide
the same answer.
Common mistake in the knowledge base
• Common mistake is to choose predicate names that are
meaningful to the human reader and to assume that the name
would be meaningful to the inference procedure as well
• Eg. Pooh is a type of bear who has a very small brain
BearofVerySmallbrain (pooh)