JESS: Problem with slot-specific?

View: New views
2 Messages — Rating Filter:   Alert me  

JESS: Problem with slot-specific?

by Aaron Novstrup :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm not sure whether this is a bug, or just a misunderstanding on my
part.  With the code below, I expect to have "Boiling!!!" printed to the
console during the second (run) call.  Instead, the detect-boiling rule
fires but the alert-user rule does not.  However, the example works as
expected if I replace the modify on the RHS of detect-boiling with a
retract+assert.

(deftemplate thermometer
    (declare (slot-specific TRUE))
    (slot reading))

(deftemplate water
    (slot state))

(defrule detect-boiling
    (thermometer {reading > 100})
    ?b <- (water (state ~boiling))
    =>
    (modify ?b (state boiling))
    )

(defrule alert-user
    (water (state boiling))
    =>
    (printout t "Boiling!!!" crlf)
    )

(reset)
(watch all)
(assert (water (state cool)))
(bind ?f (assert (thermometer (reading 98))))
(run)

(modify ?f (reading 105))
(run)

Execution trace:
Jess, the Rule Engine for the Java Platform
Copyright (C) 2008 Sandia Corporation
Jess Version 7.1p1 8/6/2008

 ==> f-1 (MAIN::water (state cool))
 ==> f-2 (MAIN::thermometer (reading 98))
 <== Focus MAIN
 <=> f-2 (MAIN::thermometer (reading 105))
==> Activation: MAIN::detect-boiling :  f-2, f-1
FIRE 1 MAIN::detect-boiling f-2, f-1
 <=> f-1 (MAIN::water (state boiling))


begin:vcard
fn:Aaron Novstrup
n:Novstrup;Aaron
org:Stottler Henke Associates Inc.
adr;dom:;;1107 NE 45th St;Seattle;WA;98105
email;internet:anovstrup@...
title:AI Software Engineer
tel;work:206.545.2941
tel;cell:805.701.9786
x-mozilla-html:FALSE
url:www.stottlerhenke.com
version:2.1
end:vcard


Re: JESS: Problem with slot-specific?

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On May 12, 2009, at 3:45 PM, Aaron Novstrup wrote:

> I'm not sure whether this is a bug, or just a misunderstanding on my
> part.

Your code works as expected in 7.1p2, so it might have been a bug.  
Upgrade and see what happens.

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------