objects

26
Objects • Objects are at the heart of the Object Oriented Paradigm • What is an object?

Upload: anoki

Post on 18-Feb-2016

66 views

Category:

Documents


0 download

DESCRIPTION

Objects. Objects are at the heart of the Object Oriented Paradigm What is an object?. Objects. We are surrounded by objects. In this class room there are desks, blackboards, lights , chairs and so on. Each object has specific attributes - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Objects

Objects

• Objects are at the heart of the Object Oriented Paradigm

• What is an object?

Page 2: Objects

Objects

• 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.

Page 3: Objects

Objects 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

Page 4: Objects

Object 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.

Page 5: Objects

Objects 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.

Page 6: Objects

The 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

Page 7: Objects

Semantic 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.

Page 8: Objects

Example

• Using the example Birds have wings • a typical semantic net would be

Page 9: Objects

Origin• 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

Page 10: Objects

Meaning 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.

Page 11: Objects

Another Example

Dog bone

likes

Page 12: Objects

Evolving 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.

Page 13: Objects

Object 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

Page 14: Objects

Example

• 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

Page 15: Objects

Fido

Dogs

Pets

Animals

Cats

Page 16: Objects

Labels used in Semantic Nets

• Objects and Instances• Both Represented by Nodes linked by an • IS_A link

Fido DogIS_A

InstanceObject

Page 17: Objects

Labels used in Semantic Nets

• Objects and Classes• Both Represented by Nodes linked by an • Subset or a SuperSet link

Dog PetsSubset

ObjectClass

Page 18: Objects

SuperSet links

• Objects and Classes• Both Represented by Nodes linked by an • SuperSet link

Dog PetsSubset

ObjectClassSuperset

Page 19: Objects

Relationships, attributes and associations

Relationships, attributes and associationsRepresented by a labelled link between

objects etc

Fido Black and white

colour

Page 20: Objects

Component Parts

• Object components• Both Represented by Nodes linked by an • HAP (has as part) link• A dog has a tail

Dog TailHAP

ObjectObject

Page 21: Objects

Inheritance

• 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

Page 22: Objects

Inheritance

• A dog has a tail and Fido is a dog

Dog TailHAP

ObjectObject

Fido

ISA

Page 23: Objects

Bigger Example

• Exercise• What does the following Semantic net

represent

Page 24: Objects

My House

Bungalow

House

Building

Roof

1brick

wallsRed

Habitation

No. Of Storeys

Purpose

Colour HAP HAP

subset

subset

ISAMade_of

Page 25: Objects

Advantages 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

Page 26: Objects

Disadvantages 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