24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2. Frames and Inheritance 16<br />

<strong>flex</strong> toolkit<br />

frame animal .<br />

frame carnivore .<br />

frame mammal is an animal<br />

default blood is warm and<br />

default habitat is land .<br />

frame rodent is a kind of mammal<br />

default habitat is sewer .<br />

frame feline is a mammal, carnivore .<br />

There are three kinds of isa links used in this example hierarchy.<br />

A single connection between the parent-frame and the child-frame, i.e. one-to-one.<br />

An example of this is the link between animal and mammal, and is the usual<br />

kind of link to be found in hierarchies.<br />

Links from a parent-frame to more than one child-frame, i.e. multiple children.<br />

An example of this is the link between mammal and its two sub-classes, rodent<br />

and feline. In this case both rodent and feline are types of mammal, and<br />

share some characteristics (like warm blood), but not necessarily all<br />

characteristics.<br />

Links from a child-frame to more than one parent-frame, i.e. multiple parents. An<br />

example of this is the linkage from mammal and carnivore to the class<br />

feline. In this case a feline has some of the characteristics of a mammal<br />

and some of the characteristics of a carnivore. Here, the ordering of the<br />

parenthood is important, as it affects the order for which inherited values are<br />

returned by the inheritance search algorithm. This capability to have more than<br />

one parent is sometimes referred to as multiple inheritance.<br />

By inheritance from mammals, all felines and all rodents are warm-blooded.<br />

However, whilst all felines live on land, the locally declared default for a<br />

rodent's habitat will override the inherited default from mammals, with the<br />

result that rodents are deemed to live in sewers. If we now defined, say, a<br />

squirrel as a kind of rodent, then the default value for their habitat attribute<br />

would be a sewer.<br />

Creating an Instance of a Frame<br />

So far we have discussed the use of frames to represent general (static)<br />

objects such as mammals, felines and rodents. However, frames may also<br />

represent specific (dynamic) instances of objects such as Sylvester (a wellknown<br />

cat) or Sammy (my cat).<br />

In formal terms there is very little to distinguish a frame representing a class<br />

of objects from an instance representing a specific instance of the frame.<br />

Instances appear as leaf nodes in the frame hierarchy and can have only one

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!