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

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

add_value/2 can either be used to augment lists or to increment numbers.<br />

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

The Slot should either be a compound term of the form<br />

@(Attribute,Frame) or it is the name of a global variable, in which case<br />

the name of the frame to be used is global.<br />

If there is an existing slot then it is augmented with Value. Otherwise, a<br />

new slot is created.<br />

Example<br />

all_rules( -Names )<br />

add_value( @(colour,flag), [red,blue,cyan,white] ).<br />

Find the names of all rules in the workspace.<br />

Example<br />

?- all_rules( N ).<br />

N = [prescribe_lomotil,fill_B_from_A]<br />

ancestor(+Frame,-Ancestor)<br />

Ancestor is an ancestor of Frame in the hierarchy, i.e. Ancestor is the<br />

Frame itself, or a parent frame, or a grandparent frame, or a greatgrandparent<br />

frame, etc.<br />

Example<br />

?- ancestor( moby_dick, A ).<br />

A = moby_dick<br />

A = whale<br />

A = mammal<br />

A = animal<br />

A = ocean_dweller<br />

answer(+Name,-Value)<br />

Retrieve the answer given to the question Name. If the question has not yet<br />

been asked, then the call to answer/2 will automatically invoke the<br />

corresponding call to ask/1 to ask the question and obtain an answer.<br />

Examples<br />

?- answer( starter, X ).<br />

X = soup<br />

<strong>flex</strong> toolkit

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

Saved successfully!

Ooh no, something went wrong!