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.

7. Knowledge Specification Language 103<br />

the type of the answer, using the KSL keywords such that.<br />

The following example expects an integer greater than 18 for the age. Error<br />

messages will be given if the input does not comply with these conditions.<br />

question age_of_applicant<br />

Please enter your age ;<br />

input X such that integer( X ) and X > 18 .<br />

User Defined Questions<br />

Groups<br />

The <strong>flex</strong> programmer may define alternative ways of getting information<br />

from the user. The KSL keywords<br />

answer is ... such that<br />

may be used to specify another routine which will provide the necessary<br />

information. This routine may be a <strong>flex</strong> relation, a <strong>flex</strong> action or a<br />

Prolog program, probably one which presents a customised dialog into<br />

which the user will enter data.<br />

The general format of a user-defined question is as follows.<br />

question question_name<br />

answer is Value<br />

such that directive .<br />

Example<br />

question wine<br />

answer is X such that get_wine_from_user( X ) .<br />

The get_wine_from_user/1 routine will be defined elsewhere and will<br />

return in X the wine chosen by the user.<br />

A group is a means of gathering several names under one collective<br />

heading. The basic format of a group is:<br />

group group_name<br />

first_item, second_item, .., last_item .<br />

A group may simply be a set of items grouped together for convenience, for<br />

use in a question.<br />

Example<br />

group wall_colours<br />

magnolia, coffee, apple_white, barley, buttermilk .<br />

<strong>flex</strong> toolkit

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

Saved successfully!

Ooh no, something went wrong!