<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff size=2>Oana,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff 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 face=Arial
color=#0000ff 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 face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff 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 face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff 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 face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff size=2>Here are two ways you might deal with this.
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff 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 face=Arial
color=#0000ff size=2></FONT></SPAN><SPAN class=670324520-16022007><FONT
face=Arial color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff 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 face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=670324520-16022007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<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>
<P>
<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></BODY></HTML>