<br>&nbsp;&nbsp; Let me say again: this MUST give you a compilation error:<br><br> &nbsp; &nbsp; &nbsp;&nbsp; eval(((Boolean)$itr).booleanValue() == false)<br><br>&nbsp;&nbsp; There is no $itr bound in your rule, so, how is it possible that you are executing your rules? Either there is a bug in the compilation process or you are missing something...<br>
<br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><br><div class="gmail_quote">2008/5/13 sridhar123 &lt;<a href="mailto:sridhar.peddinti@sabre.com">sridhar.peddinti@sabre.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Here is my drl file: It seems LHS of all rules executed first irrespective<br>
of salience or focus. What am i doing wrong? Appreciate your help.<br>
<br>
rule &quot;Eval Window&quot;<br>
 &nbsp; &nbsp;salience 10<br>
 &nbsp; &nbsp;agenda-group &quot;Eval Window&quot;<br>
// &nbsp; &nbsp;activation-group &quot;Eval Window&quot;<br>
 &nbsp; &nbsp;auto-focus true<br>
 &nbsp; &nbsp; &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$data : AirTravelPolicyData($reqDep : fareRequest.requestedDeparture,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$reqRet : fareRequest.requestedReturn,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$itr : itinerary,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$evalWindow : policySettings.evaluationWindow,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$depart : departureFlight.departure,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$retrn : returnFlight.departure<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;eval ((DateUtil.subtractHours((Date)$reqDep,<br>
((Integer)$evalWindow).intValue()))<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.before((Date)$depart))<br>
 &nbsp; &nbsp; &nbsp; then<br>
// modify block sets $itr.discardable to true<br>
 &nbsp; &nbsp; modify($itr) {<br>
 &nbsp; &nbsp; &nbsp;setAsDiscardable()<br>
 &nbsp; &nbsp; }<br>
// &nbsp; &nbsp; update ($data);<br>
 &nbsp; &nbsp; drools.setFocus(&quot;Eval carrier&quot;);<br>
end<br>
<br>
<br>
rule &quot;Eval carrier&quot;<br>
&nbsp;salience 5<br>
&nbsp;agenda-group &quot;Eval carrier&quot;<br>
// activation-group &quot;Eval carrier&quot;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$data : AirTravelPolicyData($prefCarrier : policySettings.preferredCarrier,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$carrier : departureFlight.carrier,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$discard : &nbsp;itinerary.discarded<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)<br>
// &nbsp; Eval Window rule changed discarded flag to true so this condition<br>
should fail but it dose not ???<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;eval(((Boolean)$itr).booleanValue() == false)<br>
 &nbsp; &nbsp; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;// But.. when i print out the discard flag here it show as true.. In that<br>
case how eval condiation is passed?<br>
 &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(&quot;*********Current Itr in Eval carrier: &quot; +<br>
$discard );<br>
<br>
end<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
<br>
Edson Tirelli-3 wrote:<br>
&gt;<br>
&gt; &nbsp; This is wrong:<br>
&gt;<br>
&gt; $data : MyFact( $anotherObj )<br>
&gt;<br>
&gt; &nbsp; &nbsp;Is the parser accepting it without any error???? If so, it is a bug.<br>
&gt; &nbsp; &nbsp;I can&#39;t even imagine what is the parsing result for such expression.<br>
&gt;<br>
&gt; &nbsp; &nbsp;This is also wrong:<br>
&gt;<br>
&gt; &nbsp; eval ($anotherObj.isDiscard() == true)<br>
&gt;<br>
&gt; &nbsp; &nbsp;There is no previous binding for &quot;$anotherObj&quot;. Only possible scenario<br>
&gt; is<br>
&gt; you defined it as a global.<br>
&gt; &nbsp; &nbsp;So, whatever you are doing and seeing, I have no idea how you can<br>
&gt; execute<br>
&gt; rules.<br>
&gt;<br>
&gt; &nbsp; &nbsp;Can you show us the whole DRL file you are using? Can you show the<br>
&gt; snippet of code you are using to execute it?<br>
&gt;<br>
&gt; &nbsp; &nbsp;[]s<br>
&gt; &nbsp; &nbsp;Edson<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2008/5/13 sridhar123 &lt;<a href="mailto:sridhar.peddinti@sabre.com">sridhar.peddinti@sabre.com</a>&gt;:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; It still dosen&#39;t work as desired. Here is my code:<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp;rule A<br>
&gt;&gt; Salience 10<br>
&gt;&gt; when<br>
&gt;&gt; &nbsp;$data : MyFact( $anotherObj )<br>
&gt;&gt; then<br>
&gt;&gt; &nbsp; modify( &nbsp;$anotherObj ) {<br>
&gt;&gt; &nbsp; &nbsp; &nbsp;setDiscard(true)<br>
&gt;&gt; &nbsp; }<br>
&gt;&gt;<br>
&gt;&gt; rule B<br>
&gt;&gt; Salience 5<br>
&gt;&gt; when<br>
&gt;&gt; &nbsp;eval ($anotherObj.isDiscard() == true)<br>
&gt;&gt; then<br>
&gt;&gt; &nbsp;...<br>
&gt;&gt;<br>
&gt;&gt; It seems, all When conditions are executed first irrespective of &quot;then&quot;<br>
&gt;&gt;<br>
&gt;&gt; I also tried with agenda group and having default focus on Rule A and in<br>
&gt;&gt; Then section setting focus to Rule B - still the condition doesnt match.<br>
&gt;&gt; When i inspect fact - after Rule A is executed, i see my flag is set to<br>
&gt;&gt; true<br>
&gt;&gt; - but not visible to Rule B.<br>
&gt;&gt;<br>
&gt;&gt; Do i need to write seperate drl files. Also, i am using eclipse 3.3 and<br>
&gt;&gt; ruleflow seems buggy i can not add any rule flow groups. do i need to use<br>
&gt;&gt; 3.2. I am using Drools 4.0.4<br>
&gt;&gt;<br>
&gt;&gt; thank you<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Alessandro Lazarotti wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; rule A<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp;Salience 10<br>
&gt;&gt; &gt; &nbsp;when<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; $anotherObject: MyFact(discard != true)<br>
&gt;&gt; &gt; &nbsp;then<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; modify($anotherObj){<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;setDiscard(true)<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &quot;Modify&quot; update your fact in the current working memory.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; sridhar123 escreveu:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; It means, I can not fire all rules at once, I need to groups and change<br>
&gt;&gt; &gt; focus in my java code?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I couldn&#39;t find any docs or examples to properly use Salience - could<br>
&gt;&gt; you<br>
&gt;&gt; &gt; please share an example (if you have one)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; thx<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Alessandro Lazarotti wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; You need upate() the fact $anotherObj in Working Memory.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; sridhar123 escreveu:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; &nbsp; rule A<br>
&gt;&gt; &gt; Salience 10<br>
&gt;&gt; &gt; when<br>
&gt;&gt; &gt; &nbsp;$data : MyFact( $anotherObj )<br>
&gt;&gt; &gt; then<br>
&gt;&gt; &gt; &nbsp; $anotherObj.setDiscard(true)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; rule B<br>
&gt;&gt; &gt; Salience 5<br>
&gt;&gt; &gt; when<br>
&gt;&gt; &gt; &nbsp; eval ($anotherObj.isDiscard() == true)<br>
&gt;&gt; &gt; then<br>
&gt;&gt; &gt; &nbsp; &nbsp;...<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I am trying to get Rule A executed before Rule B. So when condition in<br>
&gt;&gt; &gt; Rule<br>
&gt;&gt; &gt; B is valid. However i dont see &quot;Saliene&quot; has any effect. How else i can<br>
&gt;&gt; &gt; do<br>
&gt;&gt; &gt; the above?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; thank you<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; &nbsp; &nbsp; _______________________________________________<br>
&gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://www.nabble.com/Salience-not-working-tp17190028p17217969.html" target="_blank">http://www.nabble.com/Salience-not-working-tp17190028p17217969.html</a><br>
&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Edson Tirelli<br>
&gt; JBoss Drools Core Development<br>
&gt; Office: +55 11 3529-6000<br>
&gt; Mobile: +55 11 9287-5646<br>
&gt; JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/Salience-not-working-tp17190028p17219034.html" target="_blank">http://www.nabble.com/Salience-not-working-tp17190028p17219034.html</a><br>
<div><div></div><div class="Wj3C7c">Sent from the drools - user mailing list archive at Nabble.com.<br>
<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>