[rules-users] Problem with updated facts

thomas moncieu thomas.moncieu at gmail.com
Tue Mar 17 09:40:19 EDT 2009


Excuse me for losing the beginning of the thread, I'm a new user of this
mailing list ...
I solved my problem in separating my ruleflow in two because some rules
should be fired many times and so no-loop was not the solution I needed.

So I do the following thing :

            workingMemory.startProcess("RG_A");
            workingMemory.fireAllRules();
            FactHandle f = workingMemory.getFactHandle(_bill);
            workingMemory.update(f, _bill);
            workingMemory.startProcess("RG_T");
            workingMemory.fireAllRules();
            workingMemory.dispose();

Is lock-on-active efficient only in a ruleflow-group or for all the rules ?

2009/3/16 David Sinclair <dsinclair at chariotsolutions.com>

> You lost the rest of the thread, i.e. original questions, Thomas. What was
> the original problem again? Also, Which ruleflow-group comes first, A or T?
>
> And if u don't want the same rule to re-activate itself, you no-loop true.
> If u don't want a rule within the same ruleflow-group to re-activate
> others, use lock-on-active true
>
> 2009/3/16 thomas moncieu <thomas.moncieu at gmail.com>
>
> Hi, these are the rules :
>>
>> Rule A :
>>
>> rule "ID_15202"
>> ruleflow-group "RG_A"
>> when
>> i : Item(name=="cheese")
>> t : Bill(anItem==i);
>> then
>> t.setAmount(t.getAmount() - 100);
>> update(t);
>> end
>>
>> Rule B:
>>
>> rule "ID_15203"
>> ruleflow-group "RG_T"
>> when
>> t : Bill($amount : totalAmount,  totalAmount > (new
>> Double(150.0).doubleValue()));
>> then
>> System.out.println("tot : " + $tot);
>> end
>>
>> It gives the correct result if shadow proxy is turned on.
>>
>> But all the rules are re-evaluated with the update(t). Is there another
>> way that no-loop or lock-on-active that prevents from re-evaluating all the
>> rules  ?
>>
>> Thanks for your interest
>>
>> 2009/3/12 surya_n2007 <surya_n2007 at yahoo.co.in>
>>
>>>
>>> Please post the complete rule where you are updating fact.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Problem-with-updated-facts-tp22458416p22477032.html
>>> Sent from the drools - user mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>> Hi,
>> I have a problem when updating fields in rules :
>>
>> Here's the rule :
>>
>> when
>> t : Bill($amount : totalAmount,  totalAmount > (new
>> Double(150.0).doubleValue()));
>> then
>> System.out.println("tot : " + $tot);
>> end
>>
>> The original totalAmount  is 200.
>> A fact update sets the totalAmount at 100 (with an update of the
>> facthandle that I can see in the debugger of the working memory) so the
>> condition of the rule does not be true.
>> Nevertheless, the System.out is made and prints 100.
>>
>> I use Statefull session and set shadow facts to true.
>>
>> Thanks for helping me !
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> 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/20090317/4e8f2340/attachment.html 


More information about the rules-users mailing list