The first case <br>rule &quot;Remove smaller or non-overriden&quot;<br>&nbsp;&nbsp;&nbsp; dialect &quot;java&quot;<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; L : Response( $r : value &amp;&amp; status != &quot;override&quot; )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Response(&nbsp; value &gt; $r ) or Response( status == &quot;override&quot;))<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; retract( L );&nbsp;&nbsp;&nbsp; <br>end<br><br><br>breaks down to<br><br>rule &quot;Rule1&quot;<br>&nbsp;&nbsp;&nbsp; dialect &quot;java&quot;<br>
&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; L : Response( $r : value &amp;&amp; status != &quot;override&quot; )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Response(&nbsp; value &gt; $r ) <br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; retract( L );&nbsp;&nbsp;&nbsp; <br>end<br><br>and <br><br>rule &quot;Rule2&quot;<br>&nbsp;&nbsp;&nbsp; dialect &quot;java&quot;<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; L : Response( $r : value &amp;&amp; status != &quot;override&quot; )<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Response( status == &quot;override&quot;)<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; retract( L );&nbsp;&nbsp;&nbsp; <br>end<br><br><br>I see that the first rule removes all objects with smaller values and the second one removes all the ones that arent overridden if there exists an object that has an override<br>
<br><br>What I dont understand is, why the second one doesnt have similar behaviour<br><br><br>rule &quot;Remove smaller or non-overriden&quot;<br>
&nbsp;&nbsp;&nbsp; dialect &quot;java&quot;<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; L : Response( $r : value &amp;&amp; status != &quot;override&quot; )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Response(&nbsp; value &gt; $r ||&nbsp; status == &quot;override&quot; )<br>&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; retract( L );&nbsp;&nbsp;&nbsp; <br>
end<br><br>When this rule runs , it should start removing objects with smaller values that are *not* overridden .&nbsp; So if an overridden object exists finally we will be left with 2&nbsp; objects<br><br>Response( maxvalue, non override status ) and Response( somevalue, &quot;override&quot; )<br>
<br>When the rule fires now&nbsp; L will take on the first one and the the other object will match the second one since it has an override even though value&nbsp; &lt;= $r . This L should be extracted and we should just be left with the overridden object.<br>
<br>But&nbsp; I still seem to be left with both the objects.<br><br><br>Jai <br><br><br><br><div class="gmail_quote">On Feb 7, 2008 1:45 PM, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


  

<div bgcolor="#ffffff" text="#000000">
Better still why don&#39;t you say why you think it&#39;s different. Remember
&#39;or&#39; results in two rules being generate, so write out those two rules
separately and it might help you understand. The second one is just
standard logic. And don&#39;t forget you&#39;ll get standard cross products
here, i.e. A x B and B x A.<br><font color="#888888">
<br>
Mark</font><div><div></div><div class="Wj3C7c"><br>
Jai Vasanth wrote:
<blockquote type="cite">Here is the actual reason why I wanted to know the
difference between those 2.<br>
  <br>
  <br>
rule &quot;Remove smaller or non-overriden&quot;<br>
&nbsp;&nbsp;&nbsp; dialect &quot;java&quot;<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; L : Response( $r : value &amp;&amp; status != &quot;override&quot; )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (Response(&nbsp; value &gt; $r ) or Response( status == &quot;override&quot;))<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; retract( L );&nbsp;&nbsp;&nbsp; <br>
end<br>
  <br>
The above rule performs what I intended. It retains the Response with
the largest value or it the one that has an override status (if one
exists)<br>
  <br>
But I am getting a different behaviour for this one<br>
  <br>
rule &quot;Remove smaller or non-overriden&quot;<br>
&nbsp;&nbsp;&nbsp; dialect &quot;java&quot;<br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; L : Response( $r : value &amp;&amp; status != &quot;override&quot; )<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Response(&nbsp; value &gt; $r ||&nbsp; status == &quot;override&quot; )<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; retract( L );&nbsp;&nbsp;&nbsp; <br>
end<br>
  <br>
This rule seems to retain both the objects, the overriden and the
largest value<br>
  <br>
Could you explain to me how they are diffrent.<br>
  <br>
Thanks<br>
  <br>
Jai<br>
  <br>
  <br>
  <div class="gmail_quote">On Feb 6, 2008 4:30 PM, Mark Proctor &lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;
wrote:<br>
  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">
One is a field constraint disjointed connected the other is a
Conditional Element &#39;or&#39;. Details of both are covered in the manual.
Suffice to say the first is like writting if ( stmt1.attrib1 == &quot;X&quot; ||
smt1.attrib1 == &quot;Y&quot; ) whil the ohte results in two separate rules, one
checking &quot;X&quot; and the other checking &quot;Y&quot;, both rules can match and fire.<br>
    <br>
Mark<br>
    <br>
Jai Vasanth wrote:
    <blockquote type="cite">
      <div>
      <div>Hi,<br>
      <br>
&nbsp;What is the difference between the following 2 statements<br>
      <br>
      <br>
stmt1 : FactA( attrib1 == &quot;X&quot; ||&nbsp; attrib1 ==&quot;Y&quot;)&nbsp;&nbsp;&nbsp; <br>
      <br>
      <br>
stmt2: FactA( attrib1 ==&quot;X&quot;) or FactA(attrib1 ==&quot;Y&quot;)<br>
      <br>
      <br>
      <br>
Thanks <br>
      <br>
Jai <br>
      </div>
      </div>
      <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
    </blockquote>
    <br>
    </div>
    <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>
  <pre><hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<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>