<div>Hi,</div> <div>I am new to JBoss rules.</div> <div>My drl file is not resulting in the functionality that I am expecting. </div> <div>I know that I shouldn't be counting on the rules firing in a particular order, but I find that as I debug my code, the 'when' of the 3 rules are evaluated first, and then the 'then's. For eg. the SetWatch gets called after DistanceKm(Rule1), DistanceKm(Rule2) and CountWatching(rule3) are called. I expected SetWatch to get called after DistanceKm of Rule2 got called i.e. I expected the 'when' and the 'then' to get evaluated sequentially. Is my understanding wrong? I tried setting the salience of the 3 rules, but I get the same behaviour. Is there something else I need to do, to get the functionality I need?</div> <div> </div> <div>Thanks</div> <div> </div> <div>The 3 rules in my drl as given below.</div> <div> </div><FONT size=2> <div>rule "Rule1"</div> <div>when</div> <div>$GeoPosition1 :
GeoPosition()</div> <div>$GeoPosition2 : GeoPosition()</div> <div>eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) </div> <div>eval(util.StringEqual($GeoPosition2.getType(), "SI")) </div> <div>eval(util.DistanceKm($GeoPosition1, $GeoPosition2) > 100.0) </div> <div>eval(util.Watching($GeoPosition1, $GeoPosition2))</div> <div>then</div> <div></div> <div>util.ClearWatch($GeoPosition1, $GeoPosition2);</div> <div>end</div> <div> </div> <div>rule "Rule2"</div> <div>when</div> <div>$GeoPosition1 : GeoPosition()</div> <div>$GeoPosition2 : GeoPosition()</div> <div>eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) </div> <div>eval(util.StringEqual($GeoPosition2.getType(), "SI")) </div> <div>eval(util.DistanceKm($GeoPosition1, $GeoPosition2) <= 100.0) </div> <div>eval(! util.Watching($GeoPosition1, $GeoPosition2))</div> <div>then</div> <div></div> <div>util.SetWatch($GeoPosition1, $GeoPosition2);</div> <div>end</div> <div> </div>
<div>rule "Rule3"</div> <div>when</div> <div>$GeoPosition1 : GeoPosition()</div> <div>eval(util.StringEqual($GeoPosition1.getType(), "PRPT")) </div> <div>eval(util.CountWatching($GeoPosition1) >= 1)</div> <div>then</div> <div></div> <div>util.SetThreat($GeoPosition1, 1.0);</div> <div>util.SetColor($GeoPosition1, "red");</div> <div>end</div></FONT><p> 
<hr size=1>Got a little couch potato? <br>
Check out fun <a href="http://us.rd.yahoo.com/evt=48248/*http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz">summer activities for kids.</a>