I tried this in my working copy, and it works correctly. Looking back over my notes since the 7.0b6 release, I see there actually *was* a bug fix that seems relevant, originally reported by ace bug reporter Shan Ming Woo. I promise 7.0b7 will be out next week, and you should find your problem is resolved in that release.
I think Felix Bachmann wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Ok, here a simple example. The problem occurs after a fact that matched > the accumulate statement was deleted. Accumulate recognizes the deleted > fact. Here the example: > > > (deftemplate Responsibilities > (slot id (type STRING)) > (slot name (type STRING)) > (slot description (type STRING)) > (slot source (type SYMBOL)) > ) > (deftemplate P_CostOfChange > (slot value (type FLOAT)) > (slot owner (type OBJECT)) ;Id of the owner of the property > (slot source (type SYMBOL)) ;Origin of the property value: ArchE, User > (slot status (type SYMBOL)) ;Indicators for the property:nil, conflict > ) > (deftemplate AskQuestion > (slot questionId (type SYMBOL)) ;id of the question text to use > (slot questionGroup (type INTEGER)) ;the ID to enable grouping > (slot parent (type OBJECT)) ;The element that triggered the question > (multislot affectedFacts) ;List of facts where this question should > be shown > (multislot parameters) > (multislot options) ;objects among which the user can choose > (multislot default) ;the default answers > (multislot answer) ;the answers the user gave > (slot answerAvailable (type SYMBOL)) ;Describes if an answer from > the user is available > (slot log (type SYMBOL)) ;When set the Q/A fact will be logged and > then removed > ) > (deftemplate ResponsibilityRefinementRelation > (slot id (type STRING)) ;Unique id for a relation > (slot source (type SYMBOL)) ;Documents who inserted this relation > (ArchE/User) > (slot parent (type OBJECT)) ;Id of the parent in this relation > (slot child (type OBJECT)) ;Id of the child in this relation > ) > > (reset) > > (defrule RemoveCostOfChange > (declare (auto-focus TRUE)) > ?pc <- (P_CostOfChange (owner ?r)) > (ResponsibilityRefinementRelation (parent ?r)) > => > (retract ?pc) > ) > (defrule __AskcostOfChangeQuestion__ > (declare (salience 500)) > ?rr <- (accumulate > (bind ?res (create$)) > (bind ?res (insert$ ?res 1 ?_20_own)) > ?res > (P_CostOfChange (value 0.0) (owner ?_20_own) (source ArchE))) > (test (> (length$ ?rr) 0)) > (not (AskQuestion (questionId costOfChange) (answerAvailable nil))) > => > (printout t ?rr crlf) > (bind ?def (create$)) > (foreach ?r ?rr (bind ?def (insert$ ?def 1 "0.0"))) > (assert (AskQuestion (questionId costOfChange) (questionGroup nil) > (parent nil) (affectedFacts ?rr) (parameters ) (options ?rr) (default > ?def) (answer ) (answerAvailable nil) (log nil)))) > > (bind ?r1 (assert (Responsibilities (name "EBB")))) > (bind ?r2 (assert (Responsibilities (name "EBA")))) > (bind ?r3 (assert (Responsibilities (name "EB")))) > > (assert (P_CostOfChange (value 2.0) (owner ?r1) (source ArchE))) > (assert (P_CostOfChange (value 0.0) (owner ?r2) (source ArchE))) > (assert (P_CostOfChange (value 6.0) (owner ?r3) (source ArchE))) > > ------------------------------------- > now, if you follow the procedure below, the error will happen. Hope this > helps. > Jess> (run) > Jess> FIRE 1 MAIN::__AskcostOfChangeQuestion__ f-0, f--2,, > (<Fact-2>) > ==> f-7 (MAIN::AskQuestion (questionId costOfChange) (questionGroup > nil) (parent nil) (affectedFacts <Fact-2>) (parameters ) (options > <Fact-2>) (default "0.0") (answer ) (answerAvailable nil) (log nil)) > 1 > Jess> > > Jess> (assert (ResponsibilityRefinementRelation (parent (fact-id 1)) > (child (fact-id 3)))) > Jess> ==> f-8 (MAIN::ResponsibilityRefinementRelation (id nil) (source > nil) (parent <Fact-1>) (child <Fact-3>)) > ==> Activation: MAIN::RemoveCostOfChange : f-4, f-8 > <Fact-8> > Jess> > > Jess> (run) > Jess> FIRE 1 MAIN::RemoveCostOfChange f-4, f-8 > <== f-4 (MAIN::P_CostOfChange (value 2.0) (owner <Fact-1>) (source > ArchE) (status nil)) > 1 > Jess> > > Jess> (retract 7) > Jess> <== f-7 (MAIN::AskQuestion (questionId costOfChange) > (questionGroup nil) (parent nil) (affectedFacts <Fact-2>) (parameters ) > (options <Fact-2>) (default "0.0") (answer ) (answerAvailable nil) (log > nil)) > ==> Activation: MAIN::__AskcostOfChangeQuestion__ : f-0,,, > TRUE > Jess> > > Jess> (run) > Jess> FIRE 1 MAIN::__AskcostOfChangeQuestion__ f-0, f--2,, > (<Fact-2> <Fact-1>) > ==> f-9 (MAIN::AskQuestion (questionId costOfChange) (questionGroup > nil) (parent nil) (affectedFacts <Fact-2> <Fact-1>) (parameters ) > (options <Fact-2> <Fact-1>) (default "0.0" "0.0") (answer ) > (answerAvailable nil) (log nil)) > 1 > Jess> > Jess> (facts *) > Jess> f-0 (MAIN::initial-fact) > f-1 (MAIN::Responsibilities (id nil) (name "EBB") (description nil) > (source nil)) > f-2 (MAIN::Responsibilities (id nil) (name "EBA") (description nil) > (source nil)) > f-3 (MAIN::Responsibilities (id nil) (name "EB") (description nil) > (source nil)) > f-5 (MAIN::P_CostOfChange (value 0.0) (owner <Fact-2>) (source ArchE) > (status nil)) > f-6 (MAIN::P_CostOfChange (value 6.0) (owner <Fact-3>) (source ArchE) > (status nil)) > f-8 (MAIN::ResponsibilityRefinementRelation (id nil) (source nil) > (parent <Fact-1>) (child <Fact-3>)) > f-9 (MAIN::AskQuestion (questionId costOfChange) (questionGroup nil) > (parent nil) (affectedFacts <Fact-2> <Fact-1>) (parameters ) (options > <Fact-2> <Fact-1>) (default "0.0" "0.0") (answer ) (answerAvailable nil) > (log nil)) > For a total of 8 facts in all modules. > Jess> > > Felix Bachmann wrote: > > > I did a little bit more research to try to find out what is going on. > > > > I printed the fact id of all the facts that match the accumulate CE, > > and there fact id's show up from facts that are already deleted. Here > > is the rule that actually does the deletion: > > > > (defrule RemoveCostOfChange > > (declare (auto-focus TRUE)) > > ?pc <- (ModifiabilityReasoningFrameworks::P_CostOfChange (owner ?r)) > > (MAIN::ResponsibilityRefinementRelation (parent ?r)) > > => > > (retract ?pc) > > ) > > > > Looks like something is going terribly wrong. > > > > Facts in the program are either inserted by calling assertFact from > > java or the usual assert/modify/retract commands from Jess. > > > > Not sure that this helps > > > > Felix > > > > [EMAIL PROTECTED] wrote: > > > >> I can't reproduce the problem with a simple program, so it's more > >> complex than just what we can see here. There have been a few patches > >> to "accumulate" over the last few releases, but none of them dealing > >> with anything like this. What this looks like to me is working memory > >> corruption due to out-of-band data changes -- for example, setting > >> slots value in a Fact directly rather than using "modify", or using > >> instances of a class with a mutable hashCode as slot data without > >> using set-nonvalue-class. > >> > >> In the next release, by the way, the "value class" default is going to > >> be reversed, so that the slow, safe mode is the default, and the fast > >> but breakable mode is an option you must turn on explicitly. > >> > >> I think Felix Bachmann wrote: > >> [Charset iso-8859-1 unsupported, filtering to ASCII...] > >> > >> > >>> I have a little problem with the accumulate CE. I try to collect a > >>> slot value of a set of facts in a list with the following accumulate > >>> statement (produced with (ppdefrule). The interesting slot is the > >>> "owner" slot. I provided a list of facts (Fact-246 - Fact-259) that > >>> match the CE of the accumulate. As a result of this rule a fact is > >>> inserted (MAIN::AskQuestion), which should contain the collected > >>> list in slot (affectedFacts ?rr). The resulting fact Fact-466 > >>> contains duplicates and values that are not even in the matching facts. > >>> > >>> Is this a bug, or what am I doing wrong here? > >>> > >>> Kind regards > >>> > >>> Felix Bachmann > >>> > >>> --------------------------------- rule ----------------------- > >>> (defrule ImpactAnalysis::__AskcostOfChangeQuestion__ > >>> (declare (salience 500)) > >>> (MAIN::initial-fact) > >>> ?rr <- (accumulate > >>> (bind ?res (create$)) > >>> (bind ?res (insert$ ?res 1 ?_20_own)) > >>> ?res > >>> (ModifiabilityReasoningFrameworks::P_CostOfChange (value 0.0) > >>> (owner ?_20_own) (source ArchE))) > >>> (test (> (length$ ?rr) 0)) > >>> (not (MAIN::AskQuestion (questionId costOfChange) (answerAvailable > >>> nil))) > >>> => > >>> (bind ?def (create$)) > >>> (foreach ?r ?rr (bind ?def (insert$ ?def 1 \"0.0\"))) > >>> (assert (MAIN::AskQuestion (questionId costOfChange) > >>> (questionGroup nil) (parent nil) (affectedFacts ?rr) (parameters ) > >>> (options ?rr) (default ?def) (answer ) (answerAvailable nil) (log > >>> nil)))) > >>> ------------------ rule fires --------------------- > >>> Jess> FIRE 1 ImpactAnalysis::__AskcostOfChangeQuestion__ f-0, f--2,, > >>> ------------------ facts immediately after this rule ----------------- > >>> f-246 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-106>) (source ArchE) (status nil)) > >>> f-247 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-105>) (source ArchE) (status nil)) > >>> f-249 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-103>) (source ArchE) (status nil)) > >>> f-251 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-101>) (source ArchE) (status nil)) > >>> f-252 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-100>) (source ArchE) (status nil)) > >>> f-253 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-99>) (source ArchE) (status nil)) > >>> f-254 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-98>) (source ArchE) (status nil)) > >>> f-255 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-97>) (source ArchE) (status nil)) > >>> f-256 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-96>) (source ArchE) (status nil)) > >>> f-257 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-95>) (source ArchE) (status nil)) > >>> f-259 (ModifiabilityReasoningFrameworks::P_CostOfChange (value > >>> 0.0) (owner <Fact-93>) (source ArchE) (status nil)) > >>> .... > >>> f-466 (MAIN::AskQuestion (questionId costOfChange) (questionGroup > >>> nil) (parent nil) (affectedFacts <Fact-93> <Fact-106> <Fact-94> > >>> <Fact-94> <Fact-95> <Fact-96> <Fact-97> <Fact-98> <Fact-99> > >>> <Fact-100> <Fact-101> <Fact-102> <Fact-102> <Fact-103> <Fact-104> > >>> <Fact-91> <Fact-91> <Fact-104> <Fact-92> <Fact-92> <Fact-105>) > >>> (parameters ) (options <Fact-93> <Fact-106> <Fact-94> <Fact-94> > >>> <Fact-95> <Fact-96> <Fact-97> <Fact-98> <Fact-99> <Fact-100> > >>> <Fact-101> <Fact-102> <Fact-102> <Fact-103> <Fact-104> <Fact-91> > >>> <Fact-91> <Fact-104> <Fact-92> <Fact-92> <Fact-105>) (default "0.0" > >>> "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" > >>> "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0") (answer ) > >>> (answerAvailable nil) (log nil)) > >>> > >>> > >>> > >> > >> > >> [Attachment, skipping...] > >> > >> > >> > >> --------------------------------------------------------- > >> Ernest Friedman-Hill Advanced Software Research Phone: > >> (925) 294-2154 > >> Sandia National Labs FAX: (925) 294-2234 > >> PO Box 969, MS 9012 [EMAIL PROTECTED] > >> Livermore, CA 94550 http://herzberg.ca.sandia.gov > >> > >> -------------------------------------------------------------------- > >> 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] > >> -------------------------------------------------------------------- > >> > >> > >> > > > >------------------------------------------------------------------------ > > > >begin:vcard > >fn:Felix Bachmann > >n:Bachmann;Felix > >org:Software Engineering Institute - Carnegie Mellon University;SEI-PLS > >adr;dom:;;4500 5th Avenue;Pittsburgh;PA;15213 > >email;internet:[EMAIL PROTECTED] > >tel;work:+1 (412) 268 6194 > >tel;fax:+1 (412) 268 5758 > >url:http://www.sei.cmu.edu > >version:2.1 > >end:vcard > > > > > > > [Attachment, skipping...] --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- 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] --------------------------------------------------------------------
