next up previous contents
Next: The Structure of an Up: Example: FramesAccess Paths, Previous: Example: FramesAccess Paths,

Calling Algernon from Lisp

An Algernon knowledge-base can be regarded as the knowledge about the world possessed by an individual agent. Algernon interacts with the world through a tell/ask (or equivalently, assert/query) interface by which we tell things to Algernon and ask questions of the knowledge-base.

tell path &key :retrieve :eval :collect :comment
ask path &key :retrieve :eval :collect :comment

The functions tell and ask assert or query a given access path in the context of the Algernon knowledge base. These operations may branch on multiple bindings while following the path. If the keyword :retrieve is t, only facts explicitly stored in the KB are retrieved, and no backward-chaining rules are invoked. If no sets of bindings are found, the operation fails and nil is returned.

If the operation succeeds, then the Lisp forms provided for the :eval and :collect keywords are instantiated with values substituted for Algernon variables in each binding found. The :eval forms are evaluated, and the :collect forms are collected and returned. If no :collect form is provided, t is returned after a successful operation. The :comment string may be printed as trace output.



Micheal S. Hewett
Tue Oct 29 10:54:13 CST 1996