<br> Michal is correct. Every time a "from" expression is executed, Drools does not know if a result for the expression is new or not and it creates a new fact handle, bypassing the no-loop.<br><br> []s<br>
Edson<br><br><div class="gmail_quote">2009/2/13 Michal Bali <span dir="ltr"><<a href="mailto:michalbali@gmail.com">michalbali@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is what I think is going on:<div>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</div>
<div>I am just guessing here ...<div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Fri, Feb 13, 2009 at 9:12 AM, Przemysław Różycki <span dir="ltr"><<a href="mailto:P.Rozycki@amg.net.pl" target="_blank">P.Rozycki@amg.net.pl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br>
<br>
Doesn't really anyone have any logical explanation of why such a rule loops?<br>
<br>
To remind the rule:<div><br>
<br>
rule "Hello World"<br>
no-loop<br>
when<br>
$fact1 : MyFactBean1( )<br>
$fact2 : MyFactBean2( ) from $fact1<br>
then<br>
System.out.println("Fired!!!");<br>
update($fact1);<br>
end<br>
<br></div>
If I don't use 'from' everything is fine.<br>
I really didn't find in a documentation, that 'from' causes any special behaviour of the rule looping.<div><br>
<br>
Best regards,<br>
-- <br>
Przemysław Różycki<br>
AMG.net, A Bull Group Company<br>
ul. Ł±kowa 29<br>
90-554 ŁódĽ<br>
<a href="http://www.amg.net.pl" target="_blank">www.amg.net.pl</a><br>
<br>
<br>
<br></div><font color="#888888">
Przemysław Różycki pisze:</font><div><div></div><div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.<br>
<br>
Best regards,<br>
Przemek<br>
<br>
Vikrant Yagnick pisze:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Przemyslaw Rózycki<br>
Sent: Tuesday, February 10, 2009 3:24 PM<br>
To: Rules Users List<br>
Subject: [rules-users] Rules with from always loops (Drools 4.0.7)<br>
<br>
Hello,<br>
<br>
why does such a rule always loop? Even if no-loop is used?<br>
<br>
rule "Hello World"<br>
no-loop<br>
when<br>
$fact1 : MyFactBean1( )<br>
$fact2 : MyFactBean2( ) from $fact1<br>
then<br>
System.out.println("Fired!!!");<br>
update($fact1);<br>
end<br>
<br>
The full code of my test application and drl is attached.<br>
<br>
Best regards,<br>
-- <br>
Przemysław Różycki<br>
AMG.net, A Bull Group Company<br>
ul. Ł±kowa 29<br>
90-554 ŁódĽ<br>
<a href="http://www.amg.net.pl" target="_blank">www.amg.net.pl</a><br>
<br>
<br>
MASTEK LTD.<br>
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.<br>
In the US, we're called MAJESCOMASTEK<br>
<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <br>
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.<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
</blockquote>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
</blockquote>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>