Neil,<br><br>Thank you for your answer. <br>You had right. My mistake was that I was calling modify(fact) each time <br>after I set the theft assessment.<br><br>Best regards,<br> Oana <br><br><b><i>Neil Goldman <ngoldman@teknowledge.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <meta content="MSHTML 6.00.5730.11" name="GENERATOR"> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2">Oana,</font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"> Although your example used a superclass/subclass relationship, the problem is not due to that
relationship, You could just as well have written two CAR rules :</font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"> "if a car's price is <20000, then risk of theft is low"</font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"> "if a car has the stealth radar avoidance option, then risk of theft is high"</font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2">You might be upset by the infinite loop, but there is no way to know how you would like to assess the theft risk of
a car that satisfies BOTH conditions.</font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2">Here are two ways you might deal with this. </font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2">a) maybe neither of these conditions is really sufficient to determine the theft risk, but simply to influence that risk. The "then" part of the rule should just increment/decrement a value the accumulates the net risk. But don't have the increment/decrement also tell drools that the CAR was modified. </font></span></div> <div dir="ltr"
align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2">b) maybe the rules are TOTALLY ORDERED in your analytical model, and the first rule that applies is the only one that matters. You can use SALIENCE in drools to capture ordering. If all the rules are in a single activation group, then only the highest salience match will actually run (at least, that is my understanding). Again, you must not tell drools that the CAR has been modified just because you set its theft assessment.</font></span></div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font
color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div> <div dir="ltr" align="left"><span class="670324520-16022007"><font color="#0000ff" face="Arial" size="2"></font></span> </div><br> <div class="OutlookMessageHeader" dir="ltr" align="left" lang="en-us"> <hr tabindex="-1"> <font face="Tahoma" size="2"><b>From:</b> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] <b>On Behalf Of </b>nicolae oana<br><b>Sent:</b> Friday, February 16, 2007 2:11 AM<br><b>To:</b> rules-users@lists.jboss.org<br><b>Subject:</b> [rules-users] Subclasses matche superclasses problem.<br></font><br></div> <div></div>Hi everybody,<br><br>I have a class Car which is superclass for class ConvertibleCar, two rules (described below) and a ConvertibleCar fact in working memory that causes both rules to fire, resulting this
way an unwanted change to the car`s attribute and an infinite loop. <br><br>How do I evitate this problem: the specialization class fact to not match its superclass column in a rule? <br><br>ConvertibleCar car =new ConvertibleCar(10000);<br><br>rule "rule-1"<br> when <br> $car:Convertible()<br> then<br> $car.setPotentialTheftRating("high");<br>end<br><br>rule "rule-2"<br> when <br> $car:Car(price<20000)<br> then<br> $car.setPotentialTheftRating("low");<br>end<br><br>Best regards, Oana<br><br><br> <div> </div><hr size="1"> The fish are biting.<br><a href="http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50">Get more visitors</a> on your site using <a
href="http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50">Yahoo! Search Marketing.</a>_______________________________________________<br>rules-users mailing list<br>rules-users@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote><br><p> 
<hr size=1>
Don't get soaked. Take a<a href="
http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news"> quick peak at the forecast </a><br> with the<a href="
http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news">Yahoo! Search weather shortcut.</a>