:ADD-RULE

Purpose

Creates a new rule that will trigger when a subclass or instance of a given class is modified or queried.

Parameters

class
The class associated with the rules. For efficiency purposes, be as specific as possible.
rule*
Rules to be associated with the class. See the rule syntax definition.

Examples

  (:ADD-RULE Trucks ((engine ?truck ?engine)
                     (size   ?engine ?engine-size)
                     (:test (:LISP (> ?engine-size 400)))
                     ->
                     (wheel ?truck wheel)
                     (size  wheel  "P195/65R15")))


  (:ADD-RULE Cats   ((likes ?cat petting)
                     <-
                     (age ?cat ?age)
                     (:test (:LISP (< ?age 6)))))

Success criteria

Succeeds if the rule is successfully created.

Failure criteria

Fails if the rule can not be created.

Notes

Be aware that under non-monotonic reasoning (i.e. facts are deleted from the KB) rule continuations may be present, but no longer applicable, and may derive incorrect results after more facts are added.

The class associated with the rules must already exist.

Related commands


Back to...

Algernon commands
Algernon Documentation Central
Algernon home page