[rules-users] URGENT - using lock-on-active or not

Michael Anstis michael.anstis at gmail.com
Thu Sep 16 04:38:09 EDT 2010


I suspect "Note that in the update method I am updating the working memory
by retracting the old log and inserting the new one." is not doing you any
favours as I believe the newly inserted object is not leading to any
activations with the new object due to your use of lock-on-active. Have you
tried updating the existing CaseLog rather than deleting and inserting?

2010/9/16 Yaniv Itzhaki <iyaniv at gmail.com>

> Hi All,
>
>
>
> I have an urgent problem which I hope someone can explain it to me and how
> it can be solved.
>
>
>
> I created 2 rules "Update 1" and "Update 2", basically the rules are the
> same, get all the CaseLog objects according to "Category" and "Value" and
> update the Case, which holds a list of CaseLogs, with a new object.
>
>
>
> Note that in the update method I am updating the working memory by
> retracting the old log and inserting the new one.
>
>
>
> Now for the problem:
>
>
> The problem is that on one hand, when I insert a new log line all rules
> without lock-on-active re-fire. On the other hand, rules with lock-on-active
> seem to disregard the addition of the new object and fire only on the lines
> that were present when their group was activated.
>
>
>
> Please see the rules below
>
>
>
> Thanks
>
> Yaniv
>
> * *
>
> *rule* "Update 1"
>
>       *salience* 4
>
>       *ruleflow-group* "group1"
>
>       *lock-on-active*
>
>       *when*
>
>             $case : Case()
>
>             $myLog : CaseLog( myClass == "Category",
>
>                   myValue == "1" )
>
>       *then*
>
>             System.out.println("Logic: Update 1");
>
>             $case.update($myLog,40.0,*null*);
>
> *end*
>
> *rule* "Update 2"
>
>       *salience* 0
>
>       *ruleflow-group* "group1"
>
>       *lock-on-active*
>
>       *when*
>
>             $case : Case()
>
>             $myLog : CaseLog( myClass == "Category",
>
>                   myValue == "1", $score : myScore )
>
>       *then*
>
>             System.out.println("Logic: Update 2 " + $score + 5.0);
>
>             $case.update($myLog,$score + 5,*null*);
>
> *end*
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100916/1e009e39/attachment.html 


More information about the rules-users mailing list