<br> The answer to your question is not simple.<br> 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> Inside each of the categories above, the constraints are evaluated in the order they are written in the patterns.<br> At any time a constraint fails, they will short circuit and not evaluate later constraints.
<br> The above ordering is made so that the engine executes them in
"optimal" order for performance. Obviously, this may not be the "best"
order, but it is the best the engine can infer. <br>
<br> 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> Having said that, "timeRight == true" is an alpha constraint, so it "should" 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> Regards,<br> Edson<br><br><br><div><span class="gmail_quote">2007/4/5, Rahul Phadnis <<a href="mailto:rahul.phadnis@fatspaniel.com">rahul.phadnis@fatspaniel.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;">
I have the following rule in my DRL file<br><br>rule "inverteroff-evaluate-based-on-pvpower"<br> # the if part<br> when<br> alertDefinition : Alert<br>($configID:alertConfigID)<br> alertCondition: AlertCondition(name ==
<br>"InverterOff")<br> context: EvaluationContext (<br> timeRight == true,<br> pvPower!= null,<br> pvPower <= 0<br> )<br> then
<br> # what do we do if the rule evaluates to true<br> log("Triggered inverteroff alert for<br>alertConfigID" + $configID);<br><br>alertDefinition.setState(AlertState.TRIGGERED);<br> log("Context info:" + 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't be<br>called since the "," separated conditions are "AND"
<br>conditions)<br><br>>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'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> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer
<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>