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.

7. Knowledge Specification Language 107<br />

Examples<br />

template on_top_of<br />

block ^ is on top of ^ ;<br />

block ^ is not on top of ^ .<br />

Having defined the on_top_of template, we can then use it in KSL<br />

statements. For example, the following statement<br />

block p is on top of the table<br />

will be converted at compile time to the term<br />

on_top_of( p, table )<br />

The statement<br />

block q is not on top of p<br />

will be converted at compile time to the term<br />

not on_top_of( q, p ).<br />

The following template defines price comparisons of items. The phrase<br />

is more expensive than is the positive template, with is cheaper<br />

than being the negative template.<br />

template price_greater<br />

^ is more expensive than ^ ;<br />

^ is cheaper than ^ .<br />

Thus the expression X is more expensive than Y will translate at<br />

compile time to price_greater( X, Y ), and A is cheaper than<br />

B will translate at compile time to not price_greater( A, B ).<br />

We may define the relation price_greater/2 as follows.<br />

relation Item1 is more expensive than Item2<br />

if the price of Item1<br />

is greater than the price of Item2.<br />

Note that<br />

Item1 is more expensive than Item2<br />

translates at compile time to<br />

price_greater( Item1, Item2 ).<br />

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

7

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

Saved successfully!

Ooh no, something went wrong!