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.

9. Flex Predicates 146<br />

new_synonym( weight_calc, its(volume)*its(density) ) .<br />

new_template(+Name,+Positive,+Negative)<br />

Add the Positive and Negative templates for Name to the workspace.<br />

This will not overwrite any existing templates for that Name, but will append<br />

onto them.<br />

Templates are used as a method of distributing the predicate Name amongst<br />

the arguments of a relation. This will hopefully assist the readability of KSL<br />

sentences.<br />

A template is a non-empty list of partitions, where each partition is a<br />

(possibly empty) list of words. The border between one partition and the<br />

next indicates an argument position. There will always be one more partition<br />

in a template than there are argument positions.<br />

Examples<br />

new_template(ontopof,<br />

[[block],[is,on,top,of,block],[]],<br />

[[block],[is,not,on,top,of,block],[]] )<br />

new_value( +Slot,+Term )<br />

The given Term is first dereferenced down to some Value.<br />

If the Slot is a compound term of the form @(Attribute,Frame) then<br />

the following call is made :<br />

new_slot( Attribute, Frame, Value) .<br />

Otherwise, if the Slot is the name of a global variable then the following<br />

call is made:<br />

new_slot( Slot, global, Value) .<br />

The frame global is a special frame reserved for the value of global<br />

variables.<br />

Example<br />

new_value( @(contents,jugB), @(capacity,jugB) ) .<br />

new_value( temperature, boiling_point) .<br />

new_watchdog( +Name,?Attribute,?Frame,+Context,+Check,+Action )<br />

Create (or update if the Name already exists) a watchdog procedure which<br />

controls the access to a slot (see isa_slot/3).<br />

6<br />

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

The Check (a Prolog call) is performed whenever there is a request for the

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

Saved successfully!

Ooh no, something went wrong!