24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2. Frames and Inheritance 27<br />

Example<br />

frame tiger .<br />

frame human .<br />

relation can_hunt( tiger, human ) .<br />

tiger<br />

can_hunt<br />

human<br />

In its present form, the extension of the can_hunt/2 relation contains only<br />

a single tuple, namely the pair . If we were to pose the<br />

Prolog query …<br />

?- prove( can_hunt( X, Y ) ) .<br />

there would be a single solution which binds the indentifier tiger to the<br />

variable X, and binds the indentifier human to the variable Y. (prove/1 is a<br />

built-in <strong>flex</strong> predicate, described later.)<br />

Now consider two particular instances of tiger and human.<br />

Example<br />

instance shere_khan is a tiger .<br />

instance mowgli is a human .<br />

tiger<br />

can_hunt<br />

human<br />

shere_khan<br />

mowgli<br />

The answers to our query above will remain the same, namely only a single<br />

solution. This is because the underlying logic only allows unification between<br />

objects which have the same name (i.e. pattern-matching). The query<br />

?- prove( can_hunt( shere_khan, mowgli ) ) .<br />

would fail because shere_khan does not match tiger, and furthermore<br />

because mowgli does not match human.<br />

<strong>flex</strong> toolkit

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

Saved successfully!

Ooh no, something went wrong!