<br>&nbsp;&nbsp; Sudhir,<br><br>&nbsp;&nbsp; As I said in my previous e-mail, in case 1, it is the expected behavior.<br><br><a href="http://en.wikipedia.org/wiki/First-order_logic">http://en.wikipedia.org/wiki/First-order_logic</a><br><br>&nbsp;&nbsp; If you want to ensure that there is at least one Vehicle AND for all Vehicles the model is bmw, write your rule as:<br>
<br>when<br>&nbsp;&nbsp;&nbsp; exists( Vehicle() )<br>&nbsp;&nbsp;&nbsp; forall( Vehicle( model == &quot;bmw&quot; ) )<br>then<br>&nbsp;&nbsp;&nbsp; // do something...<br>end<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2009/2/3 Sudhir M <span dir="ltr">&lt;<a href="mailto:sudhir.cse@gmail.com">sudhir.cse@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Hi Edson,</div><div><br></div>Thanks for a quick reply.<div><br></div><div>Regarding the second second point I will open&nbsp;an issue in JIRA.</div>
<div><br></div><div>Regarding &nbsp;the first one is that a bug as well? since I haven&#39;t assert any of the vehicle instances &nbsp;I suppose the rule shouldn&#39;t fire right? But the rule is firing always.</div>
<div><br></div><div>Thanks,</div><div>sudhir.<div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Tue, Feb 3, 2009 at 6:49 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>&gt;</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;">
<br>&nbsp;&nbsp;&nbsp; Regarding 1, it is the expected behavior, since there is no vehicle in the wm whose model is not &quot;bmw&quot;.<br><br>&nbsp;&nbsp;&nbsp; Regarding 2, probably a bug. Can you please open a JIRA with a test case?<br><br>&nbsp;&nbsp;&nbsp; []s<br>


&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2009/2/3 Sudhir M <span dir="ltr">&lt;<a href="mailto:sudhir.cse@gmail.com" target="_blank">sudhir.cse@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div>
Hi ALL,<div><br></div><div>We are using drools 4.0.7 &nbsp;for one of our projects. We encountered some issues which I thought are strange.</div><div><br></div><div>1. When using FORALL on an entity for which we haven&#39;t asserted any of the instances in the working memory the rule always fires. I thought this rule should be evaluted to true only if all the asserted instances satisfy the condition and if we don&#39;t insert any of the instances in the working memory it should no fire the rule. Is this the expected behaviour or am I wrong?</div>



<div><br></div><div>&nbsp;&nbsp;ex:&nbsp;rule &quot;rule1&quot;</div><div><span style="white-space: pre;">        </span> when</div><div><span style="white-space: pre;">                </span>forall (</div><div><span style="white-space: pre;">                </span> Vehicle( model == &quot;bmw&quot; )</div>



<div><span style="white-space: pre;">                </span>)</div><div><br></div><div><span style="white-space: pre;">        </span> then</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;in forall&quot;);end</div>
<div><br></div><div>2. When using &#39;contains&#39; operator on array or collection of strings its working fine. But when we use it for an array of primitive type double it gives a classcastexception . Is auto boxing not supported? May be this is fine as it mentioned in the documentation that it works only on Objects. I tried using the array of Double objects, here it doesn&#39;t&nbsp;throw&nbsp;an excpetion but the rule wasn&#39;t firing. The behaviour was same even if I use a collection of Double objects. Is this a bug or am I missing something?</div>



<div><br></div><div>&nbsp;ex:&nbsp;</div><div><span style="font-weight: bold;">using Array</span></div><div><br></div><div>&nbsp;&nbsp; &nbsp;&nbsp;rule &quot;OrderArray&quot;</div><div><span style="white-space: pre;">        </span> when</div>
<div><br></div><div><span style="white-space: pre;">                </span> Order(valueArray contains 0)</div><div><br></div><div><span style="white-space: pre;">        </span> then</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;OrderArray&quot;);<br>



</div><div>end.</div><div><br></div><div><span style="font-weight: bold;">using Collection</span></div><div><span style="font-weight: bold;"><br></span></div><div><span style="font-weight: bold;"><br>
</span></div><div><span style="font-weight: bold;"><span style="font-weight: normal;"><div>&nbsp;rule &quot;OrderList&quot;</div><div><span style="white-space: pre;">        </span>&nbsp;when</div>
<div><br></div><div><span style="white-space: pre;">                </span>&nbsp;Order(valueList contains 0)</div><div><br></div><div><span style="white-space: pre;">        </span>&nbsp;then</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;OrderList&quot;);<br>



</div><div>end.</div><div><br></div><div>May be for collections I can write it as below&nbsp;</div><div><br></div><div><br></div><div><div>rule &quot;OrderList&quot;</div><div><span style="white-space: pre;">        </span> when</div>



<div><br></div><div><span style="white-space: pre;">                </span>$order : Order( $val:valueList)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Double(doubleValue &nbsp; ==0) from $val</div><div><br></div><div><span style="white-space: pre;">        </span> then</div>



<div>&nbsp;&nbsp; &nbsp; &nbsp; System.out.println(&quot;OrderList&quot;);<br></div><div>end. &nbsp;&nbsp;but this working but not&nbsp;intuitive&nbsp;as these rules were maintained later by a business user it will be easy for him if we contains and also if we can directly use array instead of collections it would be a great as current BOM uses arrays everywhere.</div>



<div><br></div><div>Thanks,</div><div>sudhir.</div></div></span></span></div><font color="#888888"><div><br></div><div><br></div><div><br></div><div><br></div>
</font><br></div></div>_______________________________________________<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></div><font color="#888888"><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>


</font><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></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> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>