<!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.3603" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2>If you are checking for class in the LHS would it not be
better to define a separate rule for the subclass?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2>I assume you're doing something like:-</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face="Courier New"
color=#0000ff size=2>rule "current"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>MyClass(class ==
MySubClassOfMyClass.class)</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>//Something specific to the
subclass</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>end</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2>When something like this might be more
suited?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face="Courier New"
color=#0000ff size=2>rule "super"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when </FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>MyClass()</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>//Do generic stuff</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>end</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face="Courier New"
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face="Courier New"
color=#0000ff size=2>rule "sub"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>when</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>MySubClassOfMyClass()</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>then</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT
color=#0000ff size=2>//Do something more specific</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT
face="Courier New"> <FONT color=#0000ff
size=2>end</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=493355116-12112009><FONT face=Arial
color=#0000ff size=2>I don't know whether this would cause two activations or
whether the more generic would swallow the Fact in the first ObjectType node in
the RETE network; Edson?</FONT></SPAN></DIV>
<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>Wolfgang
Laun<BR><B>Sent:</B> 12 November 2009 16:48<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> Re: [rules-users] Java beans
inheritance<BR></FONT><BR></DIV>
<DIV></DIV>Are you using MVEL at all in this rule?<BR><BR>Anyway, better would
be<BR><BR> class == SomeClass.class<BR><BR>which avoids string
handling.<BR><BR>-W<BR><BR><BR>
<DIV class=gmail_quote>On Thu, Nov 12, 2009 at 3:25 PM, Zohar Etzioni <SPAN
dir=ltr><<A href="mailto:zohar.etzioni@gmail.com"
target=_blank>zohar.etzioni@gmail.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hi,<BR><BR>I
have a class hierarchy of objects that I'm inserting as facts. Lets<BR>say
X, Y extends X and Z extends Y. I have a rule that is defined on X<BR>and
therefore applies to all of them, however in the rule I want to<BR>ask about
the class name and I'm referring to it as<BR><A href="http://class.name"
target=_blank>class.name</A>=="some.class". This should work as far as I
understand coz<BR>it keeps the java beans format, however it is not directly
defined in<BR>the class X but rather in Object. The error I'm getting is
"Error:<BR>could not access: name". Any idea what I'm doing
wrong?<BR><BR>Thanks,<BR>Dawg<BR>_______________________________________________<BR>rules-users
mailing list<BR><A href="mailto:rules-users@lists.jboss.org"
target=_blank>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></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>