You are using 5.2.0? <br><br>I don&#39;t think that the *greatly simplified* version of your problem fails the way you described.<br><br>However: <a href="https://issues.jboss.org/browse/JBRULES-3111">https://issues.jboss.org/browse/JBRULES-3111</a> describes a very similar issue, a severe regression from 5.1.1.<br>
<br>-W<br><br><div class="gmail_quote">On 19 July 2011 20:59, ChrisG <span dir="ltr">&lt;<a href="mailto:cgibble@excite.com">cgibble@excite.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;">
Apologies if this has been addressed elsewhere: I couldn&#39;t find anything<br>
quite like my issue.<br>
<br>
My (greatly simplified and completely made-up) example:<br>
<br>
Let&#39;s say I have this java class:<br>
<br>
public class BaseballPitcher<br>
{<br>
     public String getName();<br>
     public boolean isRightHanded();<br>
     public boolean isKnuckleBaller();<br>
}<br>
<br>
Multiple instances of this class are created with a variety of combinations<br>
for the name and two boolean parameters.<br>
Now I have a rule:<br>
<br>
rule &quot;Match pitchers: righties or knuckle-ballers&quot;<br>
when<br>
    $kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded == true<br>
||<br>
           $knuckleballer: knuckleBaller == true)<br>
    $kbPitcher2:  BaseballPitcher(name != $name, rightHanded == $righty,<br>
knuckleBaller == $knuckleballer)<br>
then<br>
    // Do something with these two pitchers $kbPitcher1 and $kbPitcher2<br>
end<br>
<br>
I am getting the curious result that this rule fires its conclusion when<br>
$kbPitcher1 is in fact NEITHER right-handed nor a knuckle-baller (i.e.<br>
rightHanded == false &amp;&amp; knuckleBaller == false).<br>
<br>
I&#39;ve worked around this by changing the first condition in either of the<br>
following two ways:<br>
     *// eval() the condition*<br>
    $kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded,<br>
$knuckleballer: knuckleBaller,<br>
          *eval(isRightHanded() == true || isKnuckleBaller() == true)*)<br>
...or....<br>
     *// bind the variables before checking values*<br>
    $kbPitcher1 : BaseballPitcher($name: name, $righty: rightHanded,<br>
$knuckleballer: knuckleBaller,<br>
          *rightHanded == true || knuckleBaller == true*)<br>
<br>
Does this make sense?  Both are easy workarounds, and I believe the second<br>
option (i.e. the one NOT using the eval) is the better solution from a<br>
performance perspective, allowing the engine to index the these facts rather<br>
than dynamically evaluate the condition every time.<br>
<br>
But I&#39;m a little surprised the first approach didn&#39;t work.  Any ideas why<br>
not?<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Unexpected-variable-binding-behavior-and-conditional-logic-tp3183355p3183355.html" target="_blank">http://drools.46999.n3.nabble.com/Unexpected-variable-binding-behavior-and-conditional-logic-tp3183355p3183355.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>