<br>int nFired = kSession.fireAllRules( 1 );<br>boolean success = nFired == 1;<br><br>-W<br><br><div class="gmail_quote">2011/5/19 Martin, Matthias <span dir="ltr"><<a href="mailto:martin@adesso.de">martin@adesso.de</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="DE"><div><p class="MsoNormal">Hello,</p><p class="MsoNormal">
</p><p class="MsoNormal"><span lang="EN-US">in our project we’ve to know, which rules have already been checked, regardless whether or not the rule gets activated and hence put on the agenda. Is there any possibility to affect the order, in which the drools engine reads and checks the LHS of rules? I suppose the assignment of a salience value has no effect on the load order and is rather a mechanism for conflict resolving, when a rule is about to be fired. </span><span style="font-size: 8pt;" lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US">Background for this demand explained in an nutshell:</span></p><p class="MsoNormal"><span lang="EN-US">We use salience for conflict resolving. The conflicting rule with the highest salience value should be fired, but the others with minor salience values mustn’t! In our scenario it can occur, that two (or more) rules might conflict at runtime. Therefore we want to perceive, which rule for which fact has already been checked, actually if it gets never activated on the agenda.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">Example:</span></p><p class="MsoNormal"><span lang="EN-US">rule “morespecific”</span></p><p class="MsoNormal"><span lang="EN-US">salience 100</span></p>
<p class="MsoNormal"><span lang="EN-US">when myObj(variant = Variants.SPECIFIC_1 && fee < 10)</span></p><p class="MsoNormal"><span lang="EN-US">then….</span></p><p class="MsoNormal"><span lang="EN-US">end</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">rule “general”</span></p><p class="MsoNormal"><span lang="EN-US">salience 30</span></p><p class="MsoNormal"><span lang="EN-US">when myObj(fee < 100)</span></p>
<p class="MsoNormal"><span lang="EN-US">then….</span></p><p class="MsoNormal"><span lang="EN-US">end</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">If I set the value for variant to Variants.SPECIFIC_1 and the fee value to 30, for example, the first rule will never make it to the agenda but the second one does and is actually getting fired because it doesn’t care about the variants value and 30 is less 100. </span></p>
<p class="MsoNormal"><span lang="EN-US">We want to perceive the already performed check for “morespecific” for a specific object und halt the execution of “general”.</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Any suggestions are welcome!</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">Regards,</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p>
<font color="#888888"><p class="MsoNormal"><span lang="EN-US">Matthias Martin</span></p></font></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>