<!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.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2>Facts are simply POJO's so you can only achieve in a rule
that you could in Java.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2>I assume (given the presumably simplified example below)
that you have a super class Shape and subclasses Rectangle and Cube that extend
Shape.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2>Therefore I think your separate "twodimensional" and
"threedimensional" rules should reference the subclasses and not the super class
(as a call to Shape.getVolume() would fail in Java).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=503581509-06022008><FONT face=Arial
color=#0000ff size=2>I don't think Drools performs subclass conversion on LHS
patterns!?!?!</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<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>Jai
Vasanth<BR><B>Sent:</B> 06 February 2008 00:14<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> [rules-users] missing parameters in the fact
object<BR></FONT><BR></DIV>
<DIV></DIV>Hi,<BR><BR> I am using agenda groups to pick sets of
rules to fire based on an attribute value. The presence or absence of other
attributes is dependent on the value of this attribute based on which I
select a particular agenda group.<BR><BR>Here is an example<BR><BR>rule
"ABC"<BR> when <BR> Shape( type = "rectangle"
)<BR> then <BR>
drools.setFocus("twodimensional")<BR>end<BR><BR><BR>rule "PQR"<BR>
when <BR> Shape( type = "cube" )<BR> then
<BR> drools.setFocus("threedimensional")<BR>end<BR><BR>rule
"area threshold"<BR>agenda-group "twodimensional"<BR> when
<BR> Shape( area > 20 )<BR> then
<BR> System.out.println ("large object"
);<BR>end<BR> <BR>rule "volume threshold"<BR>agenda-group
"threedimensional"<BR> when <BR> Shape( volume
> 20 )<BR> then <BR> System.out.println
("large object" );<BR>end<BR> <BR><BR>Suppose if my shape object is a
rectangle, then it wouldnt have the volume attribute. In this case when we try
to run these rules it would throw a NoSuchElementException.<BR><BR>Is
there a way to avoid this? Agenda groups help us fire the RHSs conditionally,
Is there a way by which I can conditionally fire LHS of certain sets of rules
?<BR><BR><BR>Thanks <BR><BR><BR>Jai <BR></BLOCKQUOTE></BODY></HTML>