<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">Edson Tirelli</b> <<a href="mailto:ed.tirelli@gmail.com">ed.tirelli@gmail.com</a>><br>Date: 26/03/2007 15:06
<br>Subject: Re: [rules-users] syntax question<br>To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br><br></span> <br> Michael,<br><br> You got it right again.
<br> Just adding to your answer, the best way usually is to reorder the patterns as you did, having the collection as the last constraint, but it is also possible to use a predicate, instead of eval(), if you need to bind the collection earlier.
<br> Example:<br><br>Customer( $cars: cars )<br>Manufacturer( $m : name, ( $cars.contains( $m ) ) )<br><br><br> []s<br> Edson<br><br><br><div><span class="gmail_quote">2007/3/26, Anstis, Michael (M.) <<a href="mailto:manstis1@ford.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
manstis1@ford.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span class="e" id="q_1118f6d88970b0d7_1">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Hi Bruce,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">From my experience (with 3.1-M1) you can reference bound
Facts/Columns in subsequent patterns; like:-</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div><span>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">$m : Manufacturer ( name == "Honda" )</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">$c : Car ( manufacturer == $m )</font></span></div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2">$c : Customer (
cars<span> contains $c, </span>age >
18 )</font></div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"></font> </div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"><span>$cars.contains("Honda") requires an eval statement as
your requirement is equivalent to "Customer ( cars.contains("Honda") )" which
does not use a zero-parameter field accessor and is not compliant with the Java
Beans specification).</span></font></div>
<div dir="ltr" align="left"><font color="#0000ff" face="Arial" size="2"></font> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">With kind regards,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Mike</font></span></div>
<div dir="ltr" align="left"></div></span> </div><br>
<blockquote style="margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Bruce
leroy<br><b>Sent:</b> 23 March 2007 18:20<br><b>To:</b>
<a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org</a><br><b>Subject:</b> [rules-users] syntax
question<br></font><br></div><div><span>
<div></div>Hi,<br><br>I have a question regarding rules syntax particularly
with left hand side. Suppose I have the following condition ..<br><br>when
<br> Customer ( $cars : cars, age > 18 )<br>...<br><br>How can
I use the bind variable "$cars" in subsequent statements without using eval(),
like so ... <br><br>when <br> Customer ( $cars : cars, age > 18
)<br> eval( $cars.contains( "Honda" ) )<br>....<br><br><br>Basically I
would like to know what the alternatives for doing something like so this
without having to use eval function. I know this might not be the best example
for this question, but please I'm just learning this system right now.
<br><br><br>Thanks in advance,<br>Bruce.<br>
<br></span></div></blockquote></span></div>
<br>_______________________________________________<br>rules-users mailing list<span class="q"><br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org
</a><br></span><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">www.jboss.com</a>
<br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>