Below is a complete rule program for reproducing the
problem.
Dariush Navabi
----------------------------------
(deftemplate task (slot taskName) (slot parentTask))
(deftemplate hasSubTask (slot taskName) (slot subTaskName))
(deftemplate activeTask (slot taskName))
(deffacts initfacts
(hasSubTask (taskName testTask1) (subTaskName testSubTask1))
(hasSubTask (taskName testTask1) (subTaskName testSubTask2))
)
(defrule init
=>
(assert (task (taskName testTask1)))
(assert (activeTask (taskName testTask1)))
)
;; compound task completion/removal
(defrule task-completion
(declare (salience -1))
?t <- (task (taskName ?theTask))
;?at <- (activeTask (taskName ?theTask))
(hasSubTask (taskName ?theTask) (subTaskName ?theSubTask))
(not (task (parentTask ?theTask)))
=>
(printout t "Removing " ?theTask " from the agenda" crlf)
;(retract ?t ?at)
(retract ?t)
)
;; IF THIS RULE IS COMMENTED OUT THE task-completion rule
;; WILL EXECUTE WITHOUT ANY PROBLEM.
;; compound task deactivation
(defrule deactivate-task
(declare (salience 1))
?at <- (activeTask (taskName ?theTask))
(not (task (taskName ?theTask)))
=>
(printout t "Deactivating" ?theTask crlf)
(retract ?at)
)
-----Original Message-----
From: Ernest Friedman-Hill [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 10, 1999 12:03 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: rule dependency
Which version of Jess are you using? This is quite similar to a bug
that was fixed in the past.
I think Navabi, Dariush wrote:
>
> Hi All,
> I have a Jess rule program which among other rules contains
> "task-completion"
> and "deactivate-task" rules (rule definitions are included below). When I
> run my
> rule program Jess throws the following exception:
>
> Rete Exception in routine NodeNot2::RunTestsVeryLeft while execution
rule
> LHS: ...
> ...while executing defrule task-completion.
> Message: Corrupted Negcnt (< 0) at line ...
>
> Now, if I comment out the "deactivate-task" rule, the "task-completion"
rule
> will be executed without any problem.
>
> I would appreciate any hints about this problem.
>
> Thanks,
> Dariush Navabi
>
> Rule Definitions:
> ;; compound task completion/removal
> (defrule task-completion
> (declare (salience -1))
> ?t <- (task (taskName ?theTask))
> ;?at <- (activeTask (taskName ?theTask))
> (hasSubTask (taskName ?theTask) (subTaskName ?theSubTask))
> (not (task (parentTask ?theTask)))
> =>
> (printout t "Removing " ?theTask " from the agenda" crlf)
> ;(retract ?t ?at)
> (retract ?t)
> )
>
> ;; compound task deactivation
> ;;
> (defrule deactivate-task
> (declare (salience 1))
> ?at <- (activeTask (taskName ?theTask))
> (not (task (taskName ?theTask)))
> =>
> (printout t "Deactivating" ?theTask crlf)
> (retract ?at)
> )
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------