[rules-users] Rules with from always loops (Drools 4.0.7)

Michal Bali michalbali at gmail.com
Fri Feb 13 04:46:57 EST 2009


This is what I think is going on:when you call update($fact1) it will first
retract $fact1 which in turn retracts $fact2, the $fact1 is then inserted
again which cause another 'from' evaluation and a NEW $fact2 is pulled ->
no-loop doesn't work because Drools sees it as different data
I am just guessing here ...

On Fri, Feb 13, 2009 at 9:12 AM, Przemysław Różycki <P.Rozycki at amg.net.pl>wrote:

> Hello,
>
> Doesn't really anyone have any logical explanation of why such a rule
> loops?
>
> To remind the rule:
>
> rule "Hello World"
>        no-loop
>        when
>                $fact1 : MyFactBean1(  )
>                $fact2 : MyFactBean2(  ) from $fact1
>        then
>                System.out.println("Fired!!!");
>                update($fact1);
> end
>
> If I don't use 'from' everything is fine.
> I really didn't find in a documentation, that 'from' causes any special
> behaviour of the rule looping.
>
> Best regards,
> --
> Przemysław Różycki
> AMG.net, A Bull Group Company
> ul. Łąkowa 29
> 90-554 Łódź
> www.amg.net.pl
>
>
>
> Przemysław Różycki pisze:
>
>  Thanks for answer, Vikrant, but I don't think so. I have always used
>> no-loop without any additions and it worked (when I didn't use from). BTW,
>> if you comment a condition with from, then the rule does not loop. I also
>> checked with "no-loop true" and result is the same.
>>
>> Best regards,
>> Przemek
>>
>> Vikrant Yagnick pisze:
>>
>>> I have to quickly recheck the documentation by I think you have to write
>>> "no-loop true". Just writing no-loop defaults to false I guess.
>>>
>>> -----Original Message-----
>>> From: rules-users-bounces at lists.jboss.org [mailto:
>>> rules-users-bounces at lists.jboss.org] On Behalf Of Przemyslaw Rózycki
>>> Sent: Tuesday, February 10, 2009 3:24 PM
>>> To: Rules Users List
>>> Subject: [rules-users] Rules with from always loops (Drools 4.0.7)
>>>
>>> Hello,
>>>
>>> why does such a rule always loop? Even if no-loop is used?
>>>
>>> rule "Hello World"
>>>        no-loop
>>>        when
>>>                $fact1 : MyFactBean1(  )
>>>                $fact2 : MyFactBean2(  ) from $fact1
>>>        then
>>>                System.out.println("Fired!!!");
>>>                update($fact1);
>>> end
>>>
>>> The full code of my test application and drl is attached.
>>>
>>> Best regards,
>>> --
>>> Przemysław Różycki
>>> AMG.net, A Bull Group Company
>>> ul. Łąkowa 29
>>> 90-554 Łódź
>>> www.amg.net.pl
>>>
>>>
>>> MASTEK LTD.
>>> Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
>>> In the US, we're called MAJESCOMASTEK
>>>
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> Opinions expressed in this e-mail are those of the individual and not
>>> that of Mastek Limited, unless specifically indicated to that effect. Mastek
>>> Limited does not accept any responsibility or liability for it. This e-mail
>>> and attachments (if any) transmitted with it are confidential and/or
>>> privileged and solely for the use of the intended person or entity to which
>>> it is addressed. Any review, re-transmission, dissemination or other use of
>>> or taking of any action in reliance upon this information by persons or
>>> entities other than the intended recipient is prohibited. This e-mail and
>>> its attachments have been scanned for the presence of computer viruses. It
>>> is the responsibility of the recipient to run the virus check on e-mails and
>>> attachments before opening them. If you have received this e-mail in error,
>>> kindly delete this e-mail from desktop and server.
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> 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/20090213/b2508e77/attachment.html 


More information about the rules-users mailing list