Title: Knowledge Representation and Objects
1Knowledge Representation and Objects
2Representing objects
- In the procedural approach objects tend to be
entangled in the algorithm in question and
difficult to extract for use in other
circumstances. - The advantages of re-use are many and this served
as a motivation for the development of an object
oriented approach to both to programming and also
to knowledge representation.
3Objects
- Objects are at the heart of the Object Oriented
Paradigm - What is an object?
4Objects
- We are surrounded by objects.
- In this class room there are desks, blackboards,
lights , chairs and so on. - Each object has specific attributes
- The desk is made of wood. The seat has a blue
cover and so on.
5Objects have associations and relationships with
each other .
- Objects have associations and relationships with
each other . - Seats have desktops attached.
- All are attached to the floor
- Seats are adjacent to other seats.
- They are oriented in the same way.
- Lights are controlled by switches
6Object Roles and Functions
- Each Object in the room has a specific role or
function or behaviour. - Seats are to be sat on.
- Board is to be written on.
- Lights can be turned on and off
- Boards can be moved up and down and seats can be
put up and down.
7Objects can be classified
- Within the room objects can be grouped into
different classes - For example we could have the furniture objects
e.g. chairs, tables, worktop - We could also have the electrical objects.
- Lights, projector, laptop and so on.
8The nature of Objects
- Clearly Objects constitute a complex multi
faceted concept. - Their definition is dependent on many elements-
their attributes , their behaviour, their
classification and as we will see much , much
more - To investigate the nature of objects , it is
helpful to consider an important knowledge
representation scheme which is the basis for
theoretical frameworks of the object oriented
paradigm - This framework is known as semantic networks
9Semantic Nets
- Semantic networks are a popular scheme which
elegantly reflect these ideas. - A network consists of nodes repesenting objects,
concepts and events and links between the nodes
representing their interrelations.
10Example
- Using the example Birds have wings
- a typical semantic net would be
11Origin
- The development of semantic networks had its
origins in psychology. Ross Quillian in 1968
designed two semantic network based systems that
were intended primariliy as psychological models
of associateive memory. - Semantic Networks quickly found application in
AI. B. Raphaels SIR system, also 1968, was one of
the first programs to use this type of
representation scheme. - SIR was a question Answering system and could
answer questions requiring a variety of simple
reasoning tasks and relationships
12Meaning of Semantic Nets
- The semantics of net structures however depends
solely on the program that manipulates them and
there are no fixed conventions about their
meaning. - A wide variety of network based systems have been
implemented that use totally different procedures
for making inferences.
13Another Example
14Evolving Features
- While there are no fixed conventions, a number of
important features of Semantic nets have emerged
, that are widely used. - These have largely emerged because of the
application of Semantic Nets to Object Oriented
Theory.
15Object Definitions
- The central aspect of the object paradigm is how
it defines objects. - The basic mechanism of representation is the
articulation of class hierarchies. - Instances of Objects exist. In turn Objects
belong to classes and these in turn can belong to
other classes
16Example
- Consider Fido ( who is a dog)
- Fido is instance of the object dog.
- Dogs belong to the class pets, which for example
could also include other classes such as cats. - Pets in turn belong to a class animals and so on
17Animals
Pets
Cats
Dogs
Fido
18Labels used in Semantic Nets
- Objects and Instances
- Both Represented by Nodes linked by an
- IS_A link
Fido
Dog
IS_A
Instance
Object
19Labels used in Semantic Nets
- Objects and Classes
- Both Represented by Nodes linked by an
- Subset or a SuperSet link
Dog
Pets
Subset
Object
Class
20SuperSet links
- Objects and Classes
- Both Represented by Nodes linked by an
- SuperSet link
Dog
Pets
Subset
Object
Class
Superset
21Relationships, attributes and associations
- Relationships, attributes and associations
- Represented by a labelled link between objects
etc
Fido
Black and white
colour
22Component Parts
- Object components
- Both Represented by Nodes linked by an
- HAP (has as part) link
- A dog has a tail
Dog
Tail
HAP
Object
Object
23Inheritance
- Attributes of classes are inherited by subclasses
and instances of objects - Because we know dogs have tails and Fido is a dog
we know Fido has a tail since this is inherited
from the parent class
24Inheritance
- A dog has a tail and Fido is a dog
Dog
Tail
HAP
ISA
Object
Object
Fido
25Bigger Example
- Exercise
- What does the following Semantic net represent
26Building
subset
Purpose
Habitation
House
No. Of Storeys
subset
brick
Bungalow
1
Made_of
ISA
Colour
HAP
HAP
My House
Roof
walls
Red
27Advantages of Semantic Nets
- Easy to visualize Graphical in nature easy
for humans to interpret - Expressive power equal to or exceeding that of
First Order Predicate Logic - Formal definitions of semantic networks have been
developed for use - Related knowledge is easily clustered logically
and physically close - Efficient in space requirements
- Objects represented only once
- Relationships handled by pointers
- Other schemes are limited to True or False
answers where as Semantic Nets are more
informative and flexible - Not limited to only binary representation can
also represent action concepts
28Disadvantages of Semantic Nets
- Inheritance (particularly from multiple sources
and when exceptions in inheritance are wanted)
can cause problems such as conflicts - Facts placed inappropriately cause problems
- No standards about node and arc values in spite
of the generic formal definitions
29Frames
- The representation of knowledge about objects and
events typical to specific situations has been
the focus of research into a concept called
frames. - Frames were originally proposed in 1975 by
Minsky, as a basis for understanding visual
perception, natural language dialogues and other
complex behaviours.
30How does a frame work?
- Attached to each frame are several different
kinds of knowledge. - Some knowledge is how to use the frame, some is
about the different elements of the frame, some
is about what to expect in given situations and
some is what to do if the specified conditions do
not materialise. - Frames contain a representation mechanism called
a slot. - Knowledge which is relevant to part of a given
situation can be entered into a slot. thus the
composite pieces of knowledge that go to make up
the larger entity can be represented as slots
within the larger structure of a frame.
31What are slots again?
- A frame is a composite data structure which
consists of a number of slots which correspond to
various aspects of the object being represented.
For example slots in the frame could contain
information such as
32Frame elements
- 1 frame identification information.
- 2 relationship of this frame to other frames.
- 3 descriptors of requirements for frame match.
for example the chair frame might specify a flat
base on four vertical supports with a back
support at 90 degrees to the base.
33More Frame elements
- 4 procedural information on the use of the
structure called demons. - 5 frame default information for example as
default a chair has four legs. - 6 new instance information. Many frame slots are
left unspecified until a particular instance of
the structure is identified. For example the
colour of the chair might not be filled in until
a particular instance is identified.
34Inheritance
- Frames support inheritance
- Class types are represented by frames which omit
the detail of objects of the class, for example
the frame representing a three legged chair
object could inherit the slots of a class frame
representing an abstract chair and augment these
with its own particular detail to describe the
new object. - 8 The big problem with frames is controlling
their invocation particularly when a number of
them are applicable to a situation. e.g. - The man broke a leg when he fell onto the chair.
Would the man frame or the chair frame take
precedence.
35In Summary
- Frames then are data structures for representing
composite entities. - The top levels of a frame are fixed and represent
things that are always true about a supposed
situation. The top levels therefore give a high
level abstract view of the situation. Only the
details are missing. - The lower levels have many slots that must be
filled by specific instances or data. That is the
details of the specific situation can be added at
these levels.
36Adding new knowledge
- The slot mechanism is a modular concept. New
knowledge pertaining to a frame can be added
simply by creating new slots. - Conversely redundant knowledge may be deleted by
removing slots from a frame.
37Static versus variable slots
- The idea of having fixed higher and variable
lower levels is entirely suitable for
representing different versions of the one
context. - This is so because different instances of the
same context differ only in detail. - For example any room has walls, a ceiling and a
floor but one instance of a room differs from
another in what it contains and how these
contents are arranged i.e. in the specific
details of that room.
38Demons
- Procedures called demons can be attached to slots
of a frame. - Thus algorithmic knowledge (or Behaviour) can be
incorporated into a frame based system. - One interesting function of these demons is to
activate other appropriate frames.
39Frames and stereotyped situations
- Many everyday situations are stereotyped or
conform to a familiar pattern. waking or opening
a door are examples of stereotyped situations. - Most of the events associated with these
situations are expected. The slots of a frame
are therefore filled with default values to
mirror these expected events. - However if we are trying to represent new or
uncertain situations then default values tend not
to work very well. More sophisticated inference
is generally needed. - The notion of using stereotypes would reflect
thinking among psychologists that we use previous
experiences to deal with situations that we have
never met before.
40Problems
- There are three major problems involved in the
use of frames. - 1 When should a frame be activated i.e. when
does it become relevant. - 2 When should a frame be de-activated i.e. when
does it become irrelevant. - 3 What happens if a situation arises in which no
frames are relevant.
41Applications of Frames
- When Minsky first published his ideas on frames,
it started a flurry of research into its use. - A side development but one that is very similar
is the development of Object Oriented Orogramming
Paradigms a huge area in its own right. - Modern AI research is considering the notion of
flavors i.e. a frame based structure which
introduces concepts by presenting a stereotypical
flavor of it. - One major applications Minsky proposed for frame
based structures is the idea of scripts.
42Scripts
- A script is a structured representation
describing a stereotyped sequence of events in a
particular context. The script was originally
deigned by Schank and Ableson 1977. - A typical script is the restaraunt script.
- The customer recognizes the restaraunt by a sign
on the door. They are met at the door and
directed to an appropriate table by the waiter. - They are brought menus. They order the meal which
is brought by the waiter. They eat the meal, pay
and leave. -
- This is fairly typical scenario and comfortably
describes the average trip to restaurant.
43Script Representation
- To represent scenarios like this a script has a
number of components. - 1 Entry Conditions or descriptors of the world
thaty must be true for the script to be called.
In a restaraunt script these might be for example
a restaurant that is open and a customer who is
hungry. - 2 Results or facts that are true when the script
has terminated, for example the customer is full
and the money has been paid. - 3 Props or the things that make up the content
of the script including cast for example menu,
money, tables, waiters, customers and so on.
44More
- 4 Roles are the actions that the individual
participants perform, for example the waiter
shows the customer to their seat, brings the menu
and food and accepts the money at the end. - 5 Scenes These provide a temporal partitioning
of the script for example in the restaurant the
scenes and their order might be entering,
ordering, eating, paying , leaving.
45Applications of scripts
- Scripts can be used to answer questions about
particular situations. For example it would be
easy to answer questions like Who brought the
food, With what did the customer pay etc. - They can be used to resolve referential
ambiguities because each prop has a specific role.
46- Of the disadvantages of scripts the biggest
problem is when two or more scripts are
applicable to a given situation. - Consider for example the text
- "John visited his favourite restaurant on the way
to the concert. He was pleased by the bill
because he liked Mozart" - In this case which should take precedence a
concert script or a restaurant script.
47Ambiguity in Natural Language
- Exact meaning can still present problems because
of the idiosyncratic ambiguities in English. - For example the following text will present
problems. - "John was eating dinner at his favourite
restaraunt when a large piece of plaster fell
from the ceiling and landed on his date" - Was the date on his plate or was he gazing into
her eyes.