<br> Chris,<br><br> Thanks for reporting this.<br><br> I fixed a bug in 4.0.0 (released in 4.0.1) that causes you to see the correct value for "TestEval1" in 4.0.1 and later versions. Although, at that time I missed the memberOf scenario. I know why it happens (shadow fact related), but now I need to figure out a way to fix it.
<br><br> May I ask you to open a ticket for that?<br><br> Thanks,<br> Edson<br><br><br><div><span class="gmail_quote">2007/9/18, Chris West <<a href="mailto:crayzfishr@gmail.com">crayzfishr@gmail.com</a>>:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">All,<br><br>I'm having a problem using memberOf combined with a collect statement. My test includes 3 rules each written to output the same results (I think), but I get different results (depending on which version of Drools I use).
<br><br>The rules are:<br><br><br>rule "TestMemberOf"<br> salience 10<br> when<br> $messages: ArrayList() from collect (Message(status == 100))<br> $wrappers: ArrayList() from collect (Wrapper(message memberOf $messages))
<br> then<br> System.out.println("TestMemberOf: " + $wrappers.size());<br>end<br><br>rule "TestEval1"<br> salience 9<br> when<br> $messages: ArrayList() from collect (Message(status == 100))
<br> $wrappers: ArrayList() from collect (Wrapper($message: message, eval($messages.contains($message))))<br> then<br> System.out.println("TestEval1: " + $wrappers.size());<br>end<br><br>rule "TestEval2"
<br> salience 8<br> when<br> $wrappers: ArrayList() from collect (Wrapper($message: message, eval($message.getStatus() == 100)))<br> then<br> System.out.println("TestEval2: " + $wrappers.size());
<br>end<br><br><br><br>The output is (by version):<br><br>4.0.0<br><br>TestMemberOf: 0<br>TestEval1: 0<br>TestEval2: 2<br><br>4.0.1<br><br>TestMemberOf: 0<br>TestEval1: 2<br>TestEval2: 2<br><br>4.0.2.SNAPSHOT (taken 9/18/07)
<br><br>TestMemberOf: 0<br>TestEval1: 2<br>TestEval2: 2<br><br><br>The correct output should be:<br><br>TestMemberOf: 2<br>
TestEval1: 2<br>
TestEval2: 2<br><br><br>Am I using memberOf correctly? Is there some issue using an eval to test conditions on a list created by a collect?<br><br>Any help would be appreciated.<br><br>Attached is the full example.<br><br>
Thanks,<br><span class="sg">-Chris West<br>
<br><br>
</span><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br clear="all"></blockquote>
</div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>