Ernest,
here is the smallest piece of code I've compiled for you that causes the
error. I use Jess Version 6.1a4 8/30/2002.
(defmodule PERSONALITY_PROBLEMS)
(deftemplate PERSONALITY_PROBLEMS::personality_problems
(slot troubling)
(slot personality_problems)
(slot idx (default 0))
(do-backward-chaining PERSONALITY_PROBLEMS::personality_problems)
(defrule PERSONALITY_PROBLEMS::need_1_troubling
(declare (auto-focus TRUE))
(exists (PERSONALITY_PROBLEMS::need-personality_problems (troubling
~~nil) ) )
(exists (PERSONALITY_PROBLEMS::need-personality_problems
(personality_problems ~nil)))
?factid <- (explicit (PERSONALITY_PROBLEMS::personality_problems
(troubling nil) ))
=>
(store factid ?factid)
; (ask "Have you ever been troubled by inner feelings ? yes/no")
)
(defrule PERSONALITY_PROBLEMS::need_1_troubling_answered
(declare (auto-focus TRUE))
(PERSONALITY_PROBLEMS::answered troubling)
?f <- (PERSONALITY_PROBLEMS::need-personality_problems (troubling ~nil))
=>
(retract ?f))
(deffacts MAIN::start
(PERSONALITY_PROBLEMS::need-personality_problems (personality_problems
yes))
(PERSONALITY_PROBLEMS::need-personality_problems (personality_problems
no))
(PERSONALITY_PROBLEMS::need-personality_problems (troubling yes))
(PERSONALITY_PROBLEMS::need-personality_problems (troubling no) )
(PERSONALITY_PROBLEMS::personality_problems)
)
I do reset, run, and the rule PERSONALITY_PROBLEMS::need_1_troubling fires.
Given the user answered the question, I assert fact
(PERSONALITY_PROBLEMS::answered troubling) which activates twice the rule
PERSONALITY_PROBLEMS::need_1_troubling_answered. I execute run command
again, the two need-facts are retracted, and directly after the second one
is retracted, then the error is thrown (at least this is what follows from
'watching at all', see below).
If in the former rule the first pattern (exists
(PERSONALITY_PROBLEMS::need-personality_problems (troubling ~nil))) is
commented out, the error does not occur!
Can you guess something out of it?
Thank you in advance,
Waldek
==> f-6 (PERSONALITY_PROBLEMS::answered troubling)
==> Activation: PERSONALITY_PROBLEMS::need_1_troubling_answered : f-6, f-3,
<== Focus MAIN
==> Focus PERSONALITY_PROBLEMS
==> Activation: PERSONALITY_PROBLEMS::need_1_troubling_answered : f-6, f-4,
FIRE 1 PERSONALITY_PROBLEMS::need_1_troubling_answered f-6, f-4,
<== f-4 (PERSONALITY_PROBLEMS::need-personality_problems (troubling no)
(personality_problems nil) (idx 0))
FIRE 2 PERSONALITY_PROBLEMS::need_1_troubling_answered f-6, f-3,
<== f-3 (PERSONALITY_PROBLEMS::need-personality_problems (troubling yes)
(personality_problems nil) (idx 0))
Message : Corrupted Negcnt (< 0)
Program text : ( run )
Routine : NodeNot2.RunTestsVaryLeft
Data :
Jess reported an error in routine NodeNot2.RunTestsVaryLeft
while executing rule LHS (Node2)
while executing rule LHS (Node2)
while executing rule LHS (Node2)
while executing rule LHS (Node2)
while executing rule LHS (Node2)
while executing rule LHS (TNEQ)
while executing rule LHS (TECT)
while executing (retract ?f)
while executing defrule PERSONALITY_PROBLEMS::need_1_troubling_answered
while executing (run).
Message: Corrupted Negcnt (< 0) .
Program text: ( run ) at line 4.
at jess.NodeNot2.doRunTestsVaryLeft(NodeNot2.java:146)
at jess.NodeNot2.doRunTestsVaryLeft(NodeNot2.java:108)
at jess.Node2.runTestsVaryLeft(Node2.java:382)
at jess.Node2.callNodeRight(Node2.java:245)
at jess.Node1LTR.passAlong(Node1LTR.java:26)
at jess.Node1LTR.callNodeLeft(Node1LTR.java:15)
at jess.NodeTest.passAlong(NodeTest.java:212)
at jess.Node2.doRunTestsVaryRight(Node2.java:345)
at jess.Node2.doRunTestsVaryRight(Node2.java:320)
at jess.Node2.runTestsVaryRight(Node2.java:307)
at jess.Node2.callNodeLeft(Node2.java:192)
at jess.NodeTest.passAlong(NodeTest.java:212)
at jess.NodeNot2.doRunTestsVaryLeft(NodeNot2.java:131)
at jess.NodeNot2.doRunTestsVaryLeft(NodeNot2.java:108)
at jess.Node2.runTestsVaryLeft(Node2.java:382)
at jess.Node2.callNodeRight(Node2.java:240)
at jess.Node1LTR.passAlong(Node1LTR.java:26)
at jess.Node1LTR.callNodeLeft(Node1LTR.java:15)
at jess.NodeTest.passAlong(NodeTest.java:212)
at jess.NodeNot2.doRunTestsVaryLeft(NodeNot2.java:141)
at jess.NodeNot2.doRunTestsVaryLeft(NodeNot2.java:108)
at jess.Node2.runTestsVaryLeft(Node2.java:382)
at jess.Node2.callNodeRight(Node2.java:245)
at jess.Node1LTR.passAlong(Node1LTR.java:26)
at jess.Node1LTR.callNodeLeft(Node1LTR.java:15)
at jess.NodeTest.passAlong(NodeTest.java:212)
at jess.Node2.doRunTestsVaryLeft(Node2.java:418)
at jess.Node2.doRunTestsVaryLeft(Node2.java:392)
at jess.Node2.runTestsVaryLeft(Node2.java:382)
at jess.Node2.callNodeRight(Node2.java:245)
at jess.Node1.passAlong(Node1.java:60)
at jess.Node1TNEQ.callNodeRight(Node1TNEQ.java:48)
at jess.Node1.passAlong(Node1.java:60)
at jess.Node1TECT.callNodeRight(Node1TECT.java:43)
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------