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 97<br />

is automatically invoked whenever the value for that slot changes.<br />

The directives associated with a demon are executed immediately after the<br />

slot value changes.<br />

A demon can be tailored such that it fires only for given values and/or only<br />

under certain circumstances.<br />

Note that a constraint may be used to perform checks before a slot<br />

value is changed.<br />

The general format of a demon is as follows.<br />

demon demon_name<br />

when Attribute changes<br />

from Expression1<br />

to Expression2<br />

and condition(s)<br />

then directive(s) .<br />

The from and to and the conditions are all optional.<br />

Examples<br />

The first example displays information about the contents of any jug<br />

when its value changes.<br />

demon spy_the_contents<br />

when the contents of any jug changes from X to Y<br />

then write( 'jug change ... ' )<br />

and write( Y - X )<br />

and nl .<br />

The second example checks the changes in temperature value (in any<br />

frame), and takes necessary actions when it rises above boiling point.<br />

demon check_for_melt_down_of_core<br />

when the temperature changes to T<br />

and T is above boiling_point<br />

then remember that danger_level( red )<br />

and shut_down .<br />

Watchdogs<br />

A watchdog checks the access rights to an attribute of a frame. It is<br />

automatically invoked whenever there is a request for the current value (not<br />

the default value) of that slot.<br />

The checks associated with a watchdog are executed immediately before the<br />

value is accessed. If the check fails then the access call also fails.<br />

The general format of a watchdog is as follows.<br />

<strong>flex</strong> toolkit

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

Saved successfully!

Ooh no, something went wrong!