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