<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META boundary="===============0288281008832748401==" mixed; multipart
Content-Type:>
<META boundary="----=_Part_10511_22025585.1181240349002" multipart Content-Type:
alternative;>
<META http-equiv=Content-Type content="text/html; charset=us-ascii"
Content-Type: ------="_Part_10511_22025585.1181240349002" inline
Content-Disposition: html; text 7bit Content-Transfer-Encoding:>
<META content="MSHTML 6.00.6000.16441" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=672543619-07062007><FONT face=Arial
color=#0000ff size=2>Thanks for the response. This clears things up greatly. I
guess what I am struggling with at this point is the best approach to applying
the rules. I looked over the Conway example I began to use the DSL editor. This
seems to be a "best approach" to defining the rules but still left me puzzled
about the implementation. Should I create a wrapper class around my pojo's that
I can implement business methods on to make applying the rules easier? Or should
I load all the objects into working memory as you stated to represent a
"relational model"? I can see pros and cons for both approaches and I can't seem
to settle on which one would be best. </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>"Edson Tirelli"
<tirelli@post.com><BR><B>Sent:</B> Thursday, June 07, 2007 11:19
AM<BR><B>To:</B> "Rules Users List"
<rules-users@lists.jboss.org><BR><B>Subject:</B> Re: [rules-users]
objects<BR></FONT><BR></DIV>
<DIV></DIV><BR> Chris,<BR><BR> There is quite a few
messages in the list archives about the "issues" of using nested objects.
<BR> Best way is always to work with a "relational model" and assert
all your objects to the working memory. One example would be: <BR><BR>rule
R1<BR>when<BR> $o : Order( requestStatus ==
RequestStatus.ACCEPT )<BR> Message( state ==
MessageState.RELEASING, order == $o )<BR>then<BR> // do
something<BR>end<BR><BR> Having said that, if you don't think
it is justifiable to assert all objects into working memory because of just a
few rules, you can also use the "from" CE: <BR><BR>rule
R2<BR>when<BR> $m : Message( state == MessageState.RELEASING
)<BR> Order( requestStatus == RequestStatus.ACCEPT ) from
$m.getOrder()<BR>then<BR> // do
something<BR>end<BR><BR> Finally, version 4.0 final will allow
you to write the rule the way you wrote:<BR><BR>rule
R3<BR>when<BR> $m : Message( state == MessageState.RELEASING,
order.requestStatus == RequestStatus.ACCEPT )
<BR>then<BR> // do something<BR>end<BR><BR>
But it is important to note that the above will automatically generate an
embedded eval() for you, that is exactly the same as doing:<BR><BR>rule
R4<BR>when<BR> $m : Message( state == MessageState.RELEASING,
eval( order.getRequestStatus() == RequestStatus.ACCEPT ) )
<BR>then<BR> // do something<BR>end<BR><BR>
And eval result needs to be constant over time.<BR><BR> BTW,
syntaxes used in R1, R2 and R4 are already supported in MR2/trunk. Syntax used
in R3 above will be available in Drools 4.0 final release.<BR><BR>
[]s <BR> Edson<BR><BR>
<DIV><SPAN class=gmail_quote>2007/6/6, Chris Mathrusse <<A
href="mailto:christopher.mathrusse@sybase.com">christopher.mathrusse@sybase.com</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I'm
new to the rules syntax and a bit frustrated with trying to learn it.
I've<BR>reviewed the docs but keep running into the same issue. I have a
parent object,<BR>Message, that contains an Order. An Order has a status that
I want to test. So <BR>looking at the documentation and taking my best guess
I've created a rule as<BR>follows:<BR><BR>rule "Order not
Accepted"<BR>when<BR> $m : Message( state ==
MessageState.RELEASING, order.requestStatus == <BR>RequestStatus.ACCEPT
)<BR>then<BR> ...<BR>end<BR><BR>The problem is that when I start my
application I get a compilation error.<BR><BR>Caused
by:<BR>org.drools.rule.InvalidRulePackage: [54,54]: unknown:54:54 mismatched
token: <BR>[@423,1899:1899='.',<69>,54:54]; expecting type
RIGHT_PAREN[54,94]:<BR>unknown:54:94 mismatched token:
[@433,1939:1939=')',<37>,54:94]; expecting
type<BR>LEFT_PAREN<BR> at
org.drools.rule.Package.checkValidity (Package.java:368)<BR><BR><BR>So what am
I missing? I know it has to be something simple with my understanding<BR>of
the syntax.<BR><BR>Thanks for the
help...<BR><BR>_______________________________________________<BR>rules-users
mailing list <BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR> Edson Tirelli<BR> Software Engineer
- JBoss Rules Core Developer<BR> Office: +55 11
3529-6000<BR> Mobile: +55 11 9287-5646<BR> JBoss, a
division of Red Hat @ <A href="http://www.jboss.com">www.jboss.com</A>
_______________________________________________ <BR>rules-users mailing list
<BR>rules-users@lists.jboss.org
<BR>https://lists.jboss.org/mailman/listinfo/rules-users <BR></BODY></HTML>