next up previous contents index
Next: Negation and Non-Monotonic Reasoning Up: Special Forms Previous: Declaring Rules

Controlled Retrieval

There are five main controlled-retrieval forms, summarized as follows:

tabular421

(:a  variable form tex2html_wrap_inline1476 )
(:a (variable tex2html_wrap_inline1480 ) form tex2html_wrap_inline1476 )
:a creates new frames to bind to the specified variable(s), and asserts the given path about those frames. (:a generalizes and replaces :create .) For example, (:a ?x (name ?x '(Tom))) will create a new frame, bind ?x to it, and assert the value (Tom) into its name slot. Algernon's naming heuristics may also be able to use the Lisp atom Tom to hold the frame, but this is not guaranteed.

(:forc  variable form tex2html_wrap_inline1480 )
(:forc (variable tex2html_wrap_inline1480 ) form tex2html_wrap_inline1480 )
:forc implements ``find-or-create'' retrieval. :forc first queries the path form tex2html_wrap_inline1480 . If this query succeeds then the :forc succeeds (binding the variable variable tex2html_wrap_inline1480 ). If the path fails then a new frame is created, variable is bound to it, and the path is asserted. (:forc (variable tex2html_wrap_inline1480 ) form tex2html_wrap_inline1480 ) is similar, but allows multiple variables.

One use of :forc is to guarantee that certain slots always hold some value. For example, one might express ``Every car has a steering wheel.'' as:

(:rules cars
 ((steering-wheel ?c ?w) <- (:forc ?w (steering-wheel ?c ?w))))
Care must be taken with such rules, however, as they can easily cause infinite loops (e.g., ``Every man has a father'') -- see [Crawford, 90].

(:the  variable form tex2html_wrap_inline1480 )
(:the (variable tex2html_wrap_inline1480 ) form tex2html_wrap_inline1480 )
:the is just like :forc except that it fails if the query of its path returns multiple bindings for its variables.

It is used for definite descriptions, when a referring phrase is presumed to designate a unique entity.

(:any  form tex2html_wrap_inline1480 )
If there are multiple bindings found when following the path, an arbitrary one is selected and returned. Used to force a unique element, or failure.

(:retrieve  predicate)
:retrieve suppresses the usual application of deduction rules while querying its predicate. It should be used only in queries. :retrieve distributes over functional forms: ((:retrieve (p (f ?x) ?y))) expands to ((:retrieve (f ?x ?$X2)) (:retrieve (p ?$X2 ?y))).


next up previous contents index
Next: Negation and Non-Monotonic Reasoning Up: Special Forms Previous: Declaring Rules

Micheal S. Hewett
Tue Oct 29 11:15:33 CST 1996