next up previous contents index
Next: Calling Algernon from Lisp Up: Special Forms Previous: Declaring Slots and their

Declaring Rules

(:rules  fterm rule tex2html_wrap_inline1330 )
(:srules  fterm rule tex2html_wrap_inline1330 )
These two forms add rules, associated with the frame referred to by fterm, to the knowledge-base. The only difference between them is the way in which the rules are indexed (and therefore in the way they will later be accessed). Consider a query of (r frame1 ?x) (assertions are similar). Such a query will access rules from several sources:
  1. It will access slot rules  (rules added using :srules) associated with the slot r.
  2. It will access `normal' rules  (rules added using :rules) associated with any set which frame1 is a member of (i.e., rules associated with any frame f such that (isa frame1 f) is a fact in the knowledge-base).
  3. Finally, it will access slot rules associated with any set that the slot r is known to be a member of.

As an example of a set of slots, consider the set transitive-relations . For this set one might want a rule like:

     (:srules transitive-relations
         ((?r ?x ?z) <- (?r ?x ?y) (?r ?y ?z)))
One could then assert that (isa (:slot less) transitive-relations) and the rule above would enable Algernon to conclude (less frame1 frame3) from (less frame1 frame2) and (less frame2 frame3).

Note that this rule for transitive relations has a variable in the slot position. Such rules are called generic rules  and can be associated with sets of frames or slots (though obviously not with individual slots). Recall that at the time of a query or assertion, both the frame and the slot being accessed are known.



Micheal S. Hewett
Tue Oct 29 11:28:38 CST 1996