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

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

AT = fail<br />

is_known( +Slot )<br />

The call succeeds only if there exists a current or default value for the Slot.<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 />

lookup( +Attribute,+Frame,-Value )<br />

Retrieve the current Value for an Attribute of a Frame as in<br />

isa_slot/3. Only if there is no current value will the default Value be<br />

returned instead (as in isa_default/3).<br />

If there is neither a current nor a default Value for the Attribute of the<br />

Frame, then the frame hierarchy is searched. The search finishes whenever<br />

an ancestor frame can be found which does have either a current or a<br />

default Value.<br />

The lookup/3 procedure is used whenever dereferencing <strong>flex</strong> objects.<br />

Examples<br />

?- lookup( colour, moby_dick, V ).<br />

V = white<br />

?- lookup( habitat, moby_dick, V ).<br />

V = [atlantic,arctic]<br />

?- lookup( habitat, whale, V ).<br />

V = land<br />

lookup( +Attribute,+Frame,-Value,-Ancestor )<br />

The lookup/4 procedure behaves as lookup/3 except that an additional<br />

piece of information, Ancestor, is returned. This indicates where exactly in<br />

the frame hierarchy the Value came from.<br />

Examples<br />

misfire( +Name )<br />

?- lookup( colour, moby_dick, V, A ).<br />

V = white, A = albino<br />

?- lookup( habitat, moby_dick, V, A ).<br />

V = [atlantic,arctic], A = moby_dick<br />

?- lookup( habitat, whale, V, A ).<br />

V = land, A = ocean_dweller

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

Saved successfully!

Ooh no, something went wrong!