0% found this document useful (0 votes)
3 views19 pages

3_knowledge_Representation

Knowledge representation (KR) is crucial in cognitive science and artificial intelligence, focusing on how information is stored and processed. Various techniques exist for KR, including predicate logic, semantic networks, and frames, each with unique structures and inheritance mechanisms to manage knowledge efficiently. The document details the representation of knowledge through semantic networks and frames, including coding examples in Prolog.

Uploaded by

saratabassum043
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views19 pages

3_knowledge_Representation

Knowledge representation (KR) is crucial in cognitive science and artificial intelligence, focusing on how information is stored and processed. Various techniques exist for KR, including predicate logic, semantic networks, and frames, each with unique structures and inheritance mechanisms to manage knowledge efficiently. The document details the representation of knowledge through semantic networks and frames, including coding examples in Prolog.

Uploaded by

saratabassum043
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Knowledge Representation

Techniques

Lecture Module - 15
Knowledge Representation
● Knowledge representation (KR) is an important issue in
both cognitive science and artificial intelligence.
− In cognitive science, it is concerned with the way people store
and process information and
− In artificial intelligence (AI), main focus is to store knowledge so
that programs can process it and achieve human intelligence.
● There are different ways of representing knowledge e.g.
− predicate logic,
− semantic networks,
− extended semantic net,
− frames,
− conceptual dependency etc.
● In predicate logic, knowledge is represented in the form
of rules and facts as is done in Prolog.
Semantic Network
• Formalism for representing information about objects,
people, concepts and specific relationship between
them.
• The syntax of semantic net is simple. It is a network of
labeled nodes and links.
− It’s a directed graph with nodes corresponding to concepts,
facts, objects etc. and
− arcs showing relation or association between two concepts.
• The commonly used links in semantic net are of the
following types.
- isa → subclass of entity (e.g., child hospital is subclass of
hospital)
- inst → particular instance of a class (e.g., India is an
instance of country)
- prop → property link (e.g., property of dog is ‘bark)
Representation of Knowledge in Sem Net

“Every human, animal and bird is living thing


who breathe and eat. All birds can fly. All
man and woman are humans who have two
legs. Cat is an animal and has a fur. All
animals have skin and can move. Giraffe is
an animal who is tall and has long legs.
Parrot is a bird and is green in color”.
Representation in Predicate Logic
● Every human, animal and ● Cat is an animal and has
bird is living thing who a fur.
breathe and eat. animal(cat)  has(cat, fur)
X [human(X) → living(X)] ● All animals have skin
X [animal(X) → living(X)] and can move.
X [bird(X) → living(X)] X [animal(X) → has(X,
● All birds are animal and skin)  canmove(X)]
can fly. ● Giraffe is an animal who
X [bird(X)  canfly(X)] is tall and has long legs.
● Every man and woman animal(giraffe)  has(giraffe,
are humans who have two long_legs)  is(giraffe, tall)
legs. ● Parrot is a bird and is
X [man(X)  haslegs(X)] green in color.
X [woman(X)  haslegs(X)] bird(parrot)  has(parrot,
X [human(X)  has(X, legs)] green_colour)
Representation in Semantic Net
Semantic Net
breathe, eat
Living_thing prop
isa isa
two legs isa fly
Human Animal Bird
isa isa inst isa inst
prop green
Man Woman Giraffe Cat Parrot
prop prop prop
inst fur
john skin, move tall, long legs
Inheritance
● Inheritance mechanism allows knowledge to be
stored at the highest possible level of abstraction
which reduces the size of knowledge base.
− It facilitates inferencing of information associated with
semantic nets.
− It is a natural tool for representing taxonomically structured
information and ensures that all the members and sub-
concepts of a concept share common properties.
− It also helps us to maintain the consistency of the
knowledge base by adding new concepts and members of
existing ones.
● Properties attached to a particular object (class) are
to be inherited by all subclasses and members of
that class.
Property Inheritance Algorithm
Input: Object, and property to be found from Semantic
Net;
Output:Yes, if the object has the desired property else
return false;
Procedure:
● Find an object in the semantic net; Found = false;
● While {(object ≠ root) OR Found } DO
{ If there is a a property attribute attached with an object then
{ Found = true; Report ‘Yes’} else
object=inst(object, class) OR isa(object, class)
};
● If Found = False then report ‘No’; Stop
Coding of Semantic Net in Prolog
Isa facts Instance facts Property facts

isa(living_thing, nil). inst(john, man). prop(breathe, living_thing).


isa(human, living_thing). inst(giraffe, animal). prop(eat, living_thing).
isa(animals, living_thing). inst(parrot, bird) prop(two_legs, human).
isa(birds, living_thing). prop(skin, animal).
isa(man, human ). prop(move, animal).
isa(woman, human). prop(fur, bird).
isa(cat, animal). prop(tall, giraffe).
prop(long_legs, giraffe).
prop(tall, animal).
prop(green, parrot).
Inheritance Rules in Prolog
Instance rules:
instance(X, Y) :- inst(X, Y).
instance (X, Y) :- inst(X, Z), subclass(Z,Y).
Subclass rules:
subclass(X, Y) :- isa(X, Y).
subclass(X, Y) :- isa(X, Z), subclass(Z, Y) .
Property rules:
property(X, Y) :- prop(X, Y).
property(X, Y) :- instance(Y,Z), property(X, Z).
property(X, Y) :- subclass(Y, Z), property(X, Z).
Queries
● Is john human? ?- instance(john, humans). Y
● Is parrot a living thing? ?- instance (parrot,
● Is giraffe an aimal? living_thing). Y
● Is woman subclassof ?- instance (giraffe, animal).Y
living thing ?- subclass(woman,
● Does parrot fly? living_things). Y
● Does john breathe? ?- property(fly, parrot). Y
● has parrot fur? ?- property (john, breathe). Y
● Does cat fly? ?- property(fur, parrot). N
?- property(fly, cat). N
Knowledge Representation using Frames
● Frames are more structured form of packaging
knowledge,
− used for representing objects, concepts etc.
● Frames are organized into hierarchies or network of
frames.
● Lower level frames can inherit information from upper
level frames in network.
● Nodes are connected using links viz.,
− ako / subc (links two class frames, one of which is subclass of
other e.g., science_faculty class is ako of faculty class),
− is_a / inst ( connects a particular instance of a class frame
e.g., Renuka is_a science_faculty)
− a_part_of (connects two class frames one of which is
contained in other e.g., faculty class is_part_of department
class).
− Property link of semantic net is replaced by SLOT fields.
Cont…
● A frame may have any number of slots needed for
describing object. e.g.,
− faculty frame may have name, age, address, qualification etc
as slot names.
● Each frame includes two basic elements : slots and
facets.
− Each slot may contain one or more facets (called fillers)
which may take many forms such as:
▪ value (value of the slot),
▪ default (default value of the slot),
▪ range (indicates the range of integer or enumerated values, a
slot can have),
▪ demons (procedural attachments such as if_needed,
if_deleted, if_added etc.) and
▪ other (may contain rules, other frames, semantic net or any
type of other information).
Frame Network - Example
university

a_part_of

department hostel

a_part_of is_a

faculty nilgiri hostel

ako

science_faculty

is_a

renuka
Detailed Representation of Frame
Network
frame0

f_name: university
phone: (default: - 011686971)
address : (default - IIT Delhi)

frame1 frame2

f_name : department f_name : hostel


a_part_of : frame0 a_part_of : frame0
programme : [Btech, Mtech, Ph.D] room : (default - 100)

frame11 frame21

f_name: faculty f_name : nilgiri


a_part_of : frame1 is_a : frame2
age : range (25 - 60) phone : 0116862345
nationality: (default - Indian)
qual: (default - Post graduate)

frame12 frame13

f_name : science faculty f_name : renuka


ako : frame11 is_a : frame12
qual : (default - M.Sc) qual : Ph.D
age: 45
adrress: Janak Puri
Description of Frames
● Each frame represents either a class or an
instance.
● Class frame represents a general concept whereas
instance frame represents a specific occurrence of
the class instance.
● Class frame generally have default values which
can be redefined at lower levels.
● If class frame has actual value facet then decedent
frames can not modify that value.
● Value remains unchanged for subclasses and
instances.
Inheritance in Frames
● Suppose we want to know nationality or phone of an
instance-frame frame13 of renuka.
● These informations are not given in this frame.
● Search will start from frame13 in upward direction till
we get our answer or have reached root frame.
● The frames can be easily represented in prolog by
choosing predicate name as frame with two
arguments.
● First argument is the name of the frame and second
argument is a list of slot - facet pair.
Coding of frames in Prolog
frame(university, [phone (default, 011686971),
address (default, IIT Delhi)]).
frame(deaprtment, [a_part_of (university),
programme ([Btech, Mtech, Ph.d]))]).
frame(hostel, [a_part_of (university), room(default, 100)]).
frame(faculty, [a_part_of (department), age(range,25,60),
nationality(default, indian), qual(default, postgraduate)]).
frame(nilgiri, [is_a (hostel), phone(011686234)]).
frame(science_faculty, [ako (faculty),qual(default, M.Sc.)]).
frame(renuka, [is_a (science_faculty), qual(Ph.D.),
age(45), address(janakpuri)]).
Inheritance Program in Prolog
find(X, Y) :- frame(X, Z), search(Z, Y), !.
find(X, Y) :- frame(X, [is_a(Z),_]), find(Z, Y), !.
find(X, Y) :- frame(X, [ako(Z), _]), find(Z, Y), !.
find(X, Y) :- frame(X, [a_part_of(Z), _]), find(Z, Y).

● Predicate search will basically retrieve the list of


slots-facet pair and will try to match Y for slot.
● If match is found then its facet value is retrieved
otherwise process is continued till we reach to root
frame

You might also like