U-III Knowledge Representation
U-III Knowledge Representation
• Traffic signs are the silent speakers on the road. Be it the person
behind the wheel or a pedestrian, having sound knowledge about road
safety is necessary for all before hitting the streets. Road Safety Signs
are primarily of three types:
• Mandatory Signs – These traffic signs are used to ensure free
movement of traffic and make the road users cognizant of specific
laws and regulations, restrictions and prohibitions. Violation of these
road safety signs is an offence, as per law.
• Cautionary Signs – These traffic signs make road users conscious of
hazardous conditions on the road beforehand. The drivers,
accordingly, take necessary actions to handle the situation.
• Informatory Signs – These traffic signs guide road users about
destinations, distances, alternative routes, and prominent locations like
food joints, public toilets, nearby hospitals, etc.
KNOWLEDGE REPRESENTATION
Knowledge Representation
• Knowledge Representation is an important issue in both Cognitive Science
and AI.
• In Cognitive Science it is concerned with the way in which information is
stored and processed by humans.
• In AI, the main focus is on storing knowledge or information in such a
manner that programs can process it and achieve human intelligence.
• Traditionally, Knowledge Representation was concerned with the ways in
which knowledge was stored in an information system to accomplish a
given task.
• The fundamental goal of knowledge representation is to represent
knowledge in a manner that facilitates the process of inferencing from it.
• Several Programming Languages oriented for KR.
• In Prolog(1972) knowledge is represented in the form of rules and facts.
• Knowledge Representation has possess following Properties:
• 1) Learning-Acquires new knowledge, behaviors, Understanding and
Classification etc.
• 2) Efficiency in acquisition-Acquire new knowledge using automatic
methods.
• 3)Representational adequacy-Ability to represent required knowledge.
• 4)Inferential adequacy-Ability to manipulate knowledge to produce new
knowledge .
• Knowledge Representation is a core component of number of
applications such as expert system, Machine translation systems,
Computer aided maintaince systems, information retrieval systems etc.
• In Expert systems there are various ways of representing knowledge
such as Predicate Logic, Semantic Networks, Frames, Conceptual
dependency etc.
• An Expert System that incorporates knowledge in the form of rules
and facts is called a rule-based expert system.
Approaches to KNOWLEDGE REPRESENTATION
1. Relational Knowledge
2. Knowledge represented as Logic
3. Procedural Logic
1.Relational Knowledge
• It comprises objects consisting of attributes and associated values.
• The simplest way of storing facts is to use a relational method.
• In this, each fact is stored in a row of a relational table as done in
relational database.
• A table is defined as a set of data values that is organized using a
model of horizontal rows and vertical columns.
• Ex: A fact “John is a male whose age is 38 years and who is a graduate
with a salary of Rs.20000
NAME AGE GENDER QUALIFICA SALARY
TION
JOHN 38 M GRADUATE 20000
MIKE 25 M UNDERGRA 15000
DUATE
MARY 30 F PhD 25000
JAMES 29 M GRADUATE 18000
mother age
Sue john 5
wi
age fe
father
hu
sba
nd mother(john,sue)
34 Max age(john,5)
age
wife(sue,max)
age(max,34)
...
17
Semantic Network
• In a semantic network, the knowledge is represented by a directed graph.
• Nodes represent Objects
•In each node, a concept is defined by
–Concept (object) name;
–Attributes; and
–Attribute values.
•An edge defines the relation between two concepts.
• Links or Arcs represent Relationships
• “instance of” - set membership
• “is a” - inheritance
• “ has a” - attribute descriptors
• “part of” - aggregation
• Other Relations such as {can, has.colour,height} are known as property relations.
Is a
Has a
Part-of
Instance of
Inheritance in Semantic Net
Inheritance Rules in Prolog
Extended Semantic Networks for KR
• Logic and Semantic Networks are two different formalisms that can be used for KR.
• Simple Semantic Network is represented as directed graph whose nodes represent
concepts or objects.
• Arcs represent relationships between concepts or objects.
• It can only express collection of variable-free assertions.
• The English Sentences “ John gives an apple to mike and john and mike are human”.
From the figure we can expressed in Clausal form of logic as follows:
Object(E, apple)
Action(E, give)
Actor(E, john)
Recipient(E, mike)
isa(john, human)
isa(mike, human)
• Predicate relations corresponding to labels on the arcs of semantic networks always have
two arguments.
• For example, in the sentence john gave an apple to mike in the kitchen. It is easy to
add location(E, kitchen) to the set of facts given above.
• In the first predicate logic, predicate relation can have n arguments, where n≥1.
• For example, the sentence john gives an apple to mike is easily represented in predicate
logic by give(john, mike,apple).
• Here john, mike and apple are arguments, while give represents a predicate relation.
• For example, the sentence john gives an apple to everyone he likes is expressed in
predicate logic by the clause as follows.
• In conventional semantic network, we cannot express casual form of logic.
• To overcome this R.Kowalski and his colleagues(1979) proposed an Extended Semantic
Network( ESNet) which combines the advantages of both logic and semantic networks.
• ESNet can be interpreted as a variant syntax for the clasual form of logic.
• It also incorporates the advantage of using binary relation as in semantic network rather
than n-ary relations of logic.
• In ESNet, the terms are represented by nodes similar to as done in conventional semantic
network.
• Binary predicate symbols in clausal logic are represented by labels on arcs of ESNet.
Inference Rules
Deduction in Extended Semantic Networks
• There are two types of inference mechanisms, namely
• 1) Forward Reasoning Inference Mechanism
• 2) Backward Reasoning Inference Mechanism
• Forward reasoning inference mechanism( also called bottom-up approach) in this
mechanism we start with the given assertions and derive new assertions using clausal rule.
• Backward Reasoning Inference mechanism (Top-Down Approach) we prove the query
from the set of clauses using resolution refutation method.
Examples for Illustrating Inferencing
Methods
• Consider the following example, represented in clausal form:
isa(john,man)
Forward Reasoning Inference
• The new assertion john is a living_thing can be inferred.
Backward Reasoning Inference
• Let us solve a query isa(john,living_thing)
• Let us consider another example. The sentences, “Anyone who gives
something he likes to a person likes that person also. John gives an apple to
Mike. John likes an apple” can be represented in both binary clausal form
and ESNet representation as given below:
• Clausal Representation:
likes(X,Z)<-action(E,give),object(E,Y),actor(E,X),recipient(E,Z),likes(X,Y)
action(e,give)
object(e,apple)
actor(e,john)
recipient(e,mike)
likes(john,apple)
ESNet Representation
Forward Reasoning Inference
Backward Reasoning Inference
• Let us now prove likes(john,mike)
Inheritance
isa(X,living_thing) <- isa(X,animate)
isa(X,animate) <- isa(X,human)
isa(X,human) <- isa(X,man)
isa(john,man)
Part_of(human,two_legs)
We can show using ESNet that john inherits the property of having
two_legs from human
Implementation
• Implementation of ESNet can be done in any programming language or using a
tool which facilitates implementation of semantic networks.
• The clauses can be represented either explicitly, by adding them to the network or
implicitly by using Structure-Sharing method.
• The resolvents may be represented either explicitly or implicitly and by pointers
to their parents along with a record of the matching substitutions.
• The difference between semantic network and ESNet is conventional semantic
networks, procedures are generally written in the host programming language,
whereas in ESNet, procedures are integrated with the rest of the database and are
executed by the same general-purpose mechanism.
Knowledge Representation using Frames
• Frames are regarded as an extension to semantic nets; each node of a
semantic net is represented by a frame.
• A frame is defined as a data structure that is used for representing
stereotyped representation.
• It consists of a collection of attributes or slots and associated values
that describe some real world entity.
• There are several types of information attached to each frame.
• Frame systems form a powerful way of encoding information that
supports reasoning.
• Frames are slightly similar to concept of class of object_oriented
model.
• Class also contains attributes and methods.
• In frames, it consists of attributes or slots, slots are described with
attribute-value pairs<slot-name,value>
• Slots are generally complex structures that have facets(or fillers)
describing their properties.
• The value of slot is text string, integer or any other.
Structure of a Frame
frame name
Slot_filler
default_values
constraints on values within the slots of a frame
pointers to other frames
ako(a-kind-of or subclass)
inst
instantiation procedure
inheritance procedure
default inference procedure
triggers
Facet Name Description
value Value of the slot
default Default value of the slot and it may be redefined by lower classes
range The range of integer or values
demons Procedural attachments such as if_needed, if_added, if_deleted
etc
other May contain rules, other frames, semantic net or any type of
other information
Inheritance in frames
• Inheritance is defined as a mechanism which is utilized for passing knowledge
from one frame to other frame.
• It leads to cognitive economy, where information is only stored in one place,
while it can be retrieved from different parts of the network.
• Attachment of Demons(Rules)
• if_needed may be used for monitoring the behavior of the system.
• Ex: Calculating salary information available with each doctor instances.
• if_added may be used to validate data when data is added in the value slot
• Ex: age is specified range or not
Implementation of Frame Knowledge
• Frames can be easily implemented using object-oriented programming
language.
• Slots can be defined as variables and procedural attachment as methods.
• Inheritance is inbuilt in these languages.
Representation of Frames in Prolog:
• Frame(hospital,[nil,country(default(india)), phone(default(91112156),
address(nil),labs(labs), wards(ward), doctors(doctor)])
Inheritance Rules in Prolog
• find(x, y):-frame(X,Z),search(Y, Z)