heh, ok :)Heck, yeah, I'm up for it. Rulesfest is over, so I'm bored. :P
--- On Tue, 11/4/08, Edson Tirelli <tirelli@post.com> wrote:From: Edson Tirelli <tirelli@post.com> Subject: Re: [rules-users] Chart notation, update, and infinite loops To: greg_barton@yahoo.com, "Rules Users List" <rules-users@lists.jboss.org> Date: Tuesday, November 4, 2008, 7:54 PM That is an excellent project, but it is deep in the core engine. Great opportunity to learn all about ReteOO and drools internals, but will require some research from your side... we know the general solution, but you may still find some obstacles that need to be removed as you go. If you are willing to take the challenge, lets move the discussion to drools-dev and we can guide you. []s Edson 2008/11/4 Greg Barton <greg_barton@yahoo.com>I thought drools had this. If you point me in theright direction (and youhave the time) I'd be happy to work on that. --- On Tue, 11/4/08, Edson Tirelli<tirelli@post.com> wrote:From: Edson Tirelli <tirelli@post.com> Subject: Re: [rules-users] Chart notation,update, and infinite loopsTo: "Rules Users List"<rules-users@lists.jboss.org>Date: Tuesday, November 4, 2008, 7:06 PM Dan, This is a feature that is in our to-do list.Jess callsit "slot specific updates". We did not had the time yet toimplement itthough. :( []s Edson 2008/11/4 Dan Seaver <dan.seaver@ge.com>Your understanding is very close to whatI'mlooking for. I don't mindhaving multiple rule activations in other areas oftheruleset when the Fact isupdated, I just don't want the currentrule, theone with the updatestatement, to be reactivated. Accumulate plus no-loop works fine for thespecificcase of updatingamounts, but I'd like to have somethinggenericfor more sophisticatedlogic that would be implemented in the"then"clause.Maybe if there was something that lookedspecificallyat each property ofthe update? In this case, the"when" clauseis looking at the "name"property and the "then" clause isupdatingthe "amount" property. As the"name" is not being changed, thenthe updatewouldn't reactivate the rule.Greg Barton wrote:If you have the control fact thathandles the"applied == false"conditionyou wouldn't need to preventreactivation ofthe rule. It would behandled by the condition. I'm thinking Edson's accumulatesuggestion would be best, at this point.If I understand correctly, what youwant is this:1) One rule Fact/Charge activation perChargeinstance, with noreactivation when the Fact is updated. 2) Other Fact dependent ruleactivations when theFact is updated.The problem with making (1) happen isthatyou'd still have the matchedFact being updated once per Charge,which couldlead to reactivation ofthe rules in (2) multiple times, whichyou maynot want. If you useaccumulate in the Fact/Charge rule,plus no-loopto prevent reactivation,you get the best of both worlds: singleactivation of the Fact/Chargerule, with a single update to notifyother rulesthat the Fact haschanged. I think what you're after is somekind of"modify group," where multiplecalls to modify are counted as justone, andrules are notified when thegroup is closed out. I'm not surehow thatwould be implemented, becausehow do you know when the modificationsarefinished? A low priorityrule,possibly? Anyway, it doesn't existindrools, afaik.You could do that kind of thing with anadditional rule that tests forthenonexistence of an unprocessed Charge,then doesthe update. Adding inthe control fact for tracking Charges: rule "Update Amount" when amountFact : Fact(name =="Amount")$charge : Charge() chargeTracker :ChargeTracker(charge ==$charge, applied == false)then Double amount =amountFact.getAmount();Double chargeAmount =charge.getAmount();amountFact.setAmount(amount +chargeAmount);chargeTracker.setApplied(true); update(charge); end rule "Close Facts After ChargesApplied"no-loop false when amountFact : Fact(name =="Amount")not ChargeTracker(applied ==false)then update(amountFact); end You'd probablt also have to preventthe"Close Facts" rule from firingwhen there's just no ChargeTrackersinworking memory, too.Give that a try. --- On Tue, 11/4/08, Dan Seaver<dan.seaver@ge.com> wrote:From: Dan Seaver<dan.seaver@ge.com>Subject: Re: [rules-users] Chartnotation,update, and infinite loopsTo: rules-users@lists.jboss.org Date: Tuesday, November 4, 2008,1:55 PMGreg, 1) Yes, in this case I'mlooking for thecartesianjoin. 2) No, I can't add a propertyto Chargeas it'spart of our corp Object Model. However, I could create a thirdobject thatmanages whetherthe Charge has been processed which works justfine. Unlessthere is asimpler strategy / technique, I'll go with that. Do you know of any way to keep therule frombeing put backon the agenda when amountFact is updated? I wantotherrules to know thatit's been updated, just not the rule thatmade thechange.Dan Greg Barton wrote:1) Do you want to apply allCharges inworking memoryto all "Amount"Facts? I ask because the ruleis acartesian join(i.e. no relationbetween matched objects) andthatsometimes performsin ways users don'texpect. (i.e. all combinationsofobjects that matchthe conditions areaffected by the rule) 2) Can you add a property tothe Chargeobject? Thenyou could use aboolean named"applied" toprevent futurematches.Rule "Update Amount" when amountFact : Fact(name=="Amount")charge : Charge(applied== false)then Double amount =amountFact.getAmount();Double chargeAmount =charge.getAmount();amountFact.setAmount(amount +chargeAmount);update(amountFact); charge.setApplied(true); update(charge); end If a charge could be appliedto multipleFacts youcould maintain an"appliedTo" list ofFacts inthe Charge, andcheck that instead of asimple boolean. --- On Tue, 11/4/08, DanSeaver<dan.seaver@ge.com> wrote:From: Dan Seaver<dan.seaver@ge.com>Subject: [rules-users]Chartnotation, update, andinfinite loopsTo:rules-users@lists.jboss.orgDate: Tuesday, November 4,2008,11:50 AMI'm trying to find agoodtechnique forupdatingspecific facts in working memory. What I'mcurrently doingis somethinglikethis: Rule "UpdateAmount"when amountFact :Fact(name =="Amount")charge : Charge() then Double amount =amountFact.getAmount();Double chargeAmount=charge.getAmount();amountFact.setAmount(amount +chargeAmount);update(amountFact); end The update statementcauses aninfinite loop.I tried using no-loop,which worksif there is 1charge,but not if there are more than one. Any help with solutions orstrategies would bemuchappreciated. -- View this message incontext:http://www.nabble.com/Chart-notation%2C-update%2C-and-infinite-loops-tp20327483p20327483.htmlSent from the drools -user mailinglist archiveatNabble.com._______________________________________________rules-users mailing listrules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing list rules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users-- View this message in context:http://www.nabble.com/Chart-notation%2C-update%2C-and-infinite-loops-tp20327483p20329780.htmlSent from the drools - user mailinglistarchive atNabble.com._______________________________________________rules-users mailing list rules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________rules-users mailing list rules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users-- View this message in context:http://www.nabble.com/Chart-notation%2C-update%2C-and-infinite-loops-tp20327483p20334594.htmlSent from the drools - user mailing listarchive atNabble.com._______________________________________________rules-users mailing list rules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users-- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com _______________________________________________ rules-users mailing list rules-users@lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users-- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com_______________________________________________ rules-dev mailing list rules-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev