<br>&nbsp;&nbsp; The answer to your question is not simple.<br>&nbsp;&nbsp; Basically, the constraint evaluation will follow a priority order, in the following way:<br><br>1) all alpha constraints are evaluated<br>2) all beta indexable constraints are evaluated
<br>3) all beta non indexable constraints are evaluated<br><br>&nbsp;&nbsp; Inside each of the categories above, the constraints are evaluated in the order they are written in the patterns.<br>&nbsp;&nbsp; At any time a constraint fails, they will short circuit and not evaluate later constraints.
<br>&nbsp;&nbsp; The above ordering is made so that the engine executes them in
&quot;optimal&quot; order for performance. Obviously, this may not be the &quot;best&quot;
order, but it is the best the engine can infer. <br>
<br>&nbsp;&nbsp; So, I guess what is happening in your use case is that the constraint you want to evaluate later is falling in a previous category, so that is the reason it is being evaluated out of your desired order.<br><br>&nbsp;&nbsp; Having said that, &quot;timeRight == true&quot; is an alpha constraint, so it &quot;should&quot; be executing first. Can you please get a self contained test that shows this case? I will take a look in it and check if we have a bug or not. There are workarounds, but I would like to investigate this one.
<br><br>&nbsp;&nbsp; Regards,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><br><div><span class="gmail_quote">2007/4/5, Rahul Phadnis &lt;<a href="mailto:rahul.phadnis@fatspaniel.com">rahul.phadnis@fatspaniel.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have the following rule in my DRL file<br><br>rule &quot;inverteroff-evaluate-based-on-pvpower&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;# the if part<br>&nbsp;&nbsp;&nbsp;&nbsp;when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alertDefinition : Alert<br>($configID:alertConfigID)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alertCondition: AlertCondition(name ==
<br>&quot;InverterOff&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context: EvaluationContext (<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timeRight == true,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pvPower!= null,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pvPower &lt;= 0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>&nbsp;&nbsp;&nbsp;&nbsp;then
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# what do we do if the rule evaluates to true<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log(&quot;Triggered inverteroff alert for<br>alertConfigID&quot; + $configID);<br><br>alertDefinition.setState(AlertState.TRIGGERED);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log(&quot;Context info:&quot; + context);
<br>end<br><br>I would like to know if I assert an EvaluationContext<br>for which timeRight == false, will the getPvPower()<br>method still be called ? (logically it shouldn&#39;t be<br>called since the &quot;,&quot; separated conditions are &quot;AND&quot;
<br>conditions)<br><br>&gt;From my tests it seems like the getPvPower method is<br>called irrespective of the value of timeRight.<br><br>If that is the expected behaviour how can I improve my<br>rule definition to ensure that getPvPower isn&#39;t called
<br>if it is not necessary.<br><br>Thank you,<br><br>Rahul Phadnis<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer
<br>&nbsp;&nbsp;Office: +55 11 3124-6000<br>&nbsp;&nbsp;Mobile: +55 11 9218-4151<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>