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.

Appendix A - Examples 166<br />

Appendix A - Examples<br />

This appendix includes two examples used to illustrate some of the<br />

techniques involved in writing <strong>flex</strong> programs.<br />

Example 1 is an animal taxonomy, which is used to demonstrate some of<br />

the features of the frame system of <strong>flex</strong>.<br />

Example 2 is a forward chaining solution to the Water Jugs problem, which<br />

demonstrates the use of rule transition networks to update the rule agenda<br />

used in forward chaining.<br />

Example 1 - Analysing a Taxonomy<br />

The purpose of this example is to illustrate most of the concepts within the<br />

frame sub-system of <strong>flex</strong>. This involves the representation (using constructs<br />

from the Knowledge Specification Language) of a taxonomy for the animal<br />

kingdom, together with an algorithm for identifying species. We then give a<br />

couple of example questions that can be posed.<br />

As in the rest of this manual, in the following examples the KSL keywords<br />

are emboldened for clarity (they should not be distinguished in source texts).<br />

The Animal Kingdom<br />

The animal kingdom can be split into three main groups, namely mammal,<br />

fish and bird. Each of these main groups has its own set of characteristics<br />

which separate it from the others. The following KSL statements describe<br />

this frame hierarchy, together with the associated default values.<br />

frame animal<br />

default blood is warm .<br />

frame mammal is an animal<br />

default skin is fur and<br />

default habitat is the land and<br />

default motions are walk .<br />

frame fish is an animal<br />

default skin is scale and<br />

default habitat is water and<br />

default motions are { swim } and<br />

6<br />

<strong>flex</strong> toolkit

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

Saved successfully!

Ooh no, something went wrong!