Dear all,
I found a retracted fact can still fire other rules, it is really
strange. From the log, fact f-2 was retracted. But rule 'retract_B f-2,
f-3, f-1
' still fire.
I did more testing, and found this may be caused by template containing
multislot and declared as 'slot-specific'. I mark two line code as
'place 1' and 'place 2'. If comment the code either in 'place 1' or
'place 2', the rule can fire correctly.
Does this bug occur when a template declared as 'slot-specific', and its
multi-slot appear on the LHS of a rule? My Jess version is 7.0
11/1/2006.
Thanks
=====================Log Start====================
Jess, the Rule Engine for the Java Platform
Copyright (C) 2006 Sandia Corporation
Jess Version 7.0 11/1/2006
==> f-1 (MAIN::Template_A (has_B "BID") (names "name1" "name2") (times
0))
==> f-2 (MAIN::Template_B (id "BID"))
==> f-3 (MAIN::Template_C (has_B "BID") (id "C1"))
==> Activation: MAIN::retract_B : f-2, f-3, f-1
==> f-4 (MAIN::Template_C (has_B "BID") (id "C2"))
==> Activation: MAIN::retract_B : f-2, f-4, f-1
<=> f-1 (MAIN::Template_A (has_B "BID") (names "name1" "name2") (times
1))
FIRE 1 MAIN::retract_B f-2, f-4, f-1
<== f-2 (MAIN::Template_B (id "BID"))
FIRE 2 MAIN::retract_B f-2, f-3, f-1
<== Focus MAIN
====================Log End=======================
====================Code Start=====================
(deftemplate MAIN::Template_A
(declare (slot-specific TRUE)) ; place 1
(slot has_B)
(multislot names)
(slot times))
(deftemplate MAIN::Template_B
(slot id))
(deftemplate MAIN::Template_C
(slot has_B)
(slot id))
(defrule retract_B
?factB <-(Template_B
(id ?bid))
(Template_C
(has_B ?bid))
(Template_A
(has_B ?bid)
(names $?names) ;place 2
)
=>
(retract ?factB))
(reset)
(watch all)
(bind ?factA (assert (MAIN::Template_A (has_B "BID")(names (create$
"name1" "name2"))(times 0))))
(assert (MAIN::Template_B (id "BID")))
(assert (MAIN::Template_C (id "C1")(has_B "BID")))
(assert (MAIN::Template_C (id "C2")(has_B "BID")))
(modify ?factA (times 1))
(run)
====================Code End======================