Jess Information

Jess Home
Jess 7 Features
Download Now!
Online Demo

Mailing List
Jess Wiki

More information Related Web Sites
User Contributions
JSR94 Info
Developer's Log
About This Site

JESS ®, the Rule Engine for the JavaTM Platform

Jess Wiki: Cant Bind To Slot If Pattern Contains Not

Cant Bind To Slot If Pattern Contains Not

This example is derived from a recent post to the Jess list server. - JM

(defrule try-to-print-z-if-foo-and-not-bar
    (foo (x ?x))
    (not (bar (y ?x) (z ?z))
    (printout t "z =" ?z crlf))

Seems harmless enough. Two facts that share one slot value. If we match that, we print a slot value from the second fact.


Jess rightly reports an error in the printout because the "not" CE checks for the absence of a fact. You cannot bind to a fact's slots if the fact is not present in working memory. Thus, the reference to ?z generates a runtime error.

CommonBeginnerMistakes | CannotGetThereFromHere

Front Page | Sandbox | Recent Changes | Powered by Friki | Last Edited: 18 August 2006