I cannot reproduce this error.<br><br>Do NOT rely on the automatic substitution of getters for simple field accesses on a rule's right hand side, at least not for 5.2.0 CR.<br><br>Moreover, I cannot compile the constraint<br>
"jones" memberOf authors<br>This should be written as<br> authors contains "jones".<br><br>For further analysis full workable code reproducing the issue would be required.<br><br>-W<br><br><br><div class="gmail_quote">
On 3 June 2011 22:47, Simon Chen <span dir="ltr"><<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Can I maybe do a for loop in the "then" part? Is there a documentation<br>
regarding what is possible/impossible in the "then" part?<br>
<br>
Thanks.<br>
<font color="#888888">-Simon<br>
</font><div><div></div><div class="h5"><br>
On Fri, Jun 3, 2011 at 3:23 PM, Simon Chen <<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>> wrote:<br>
> No, this doesn't work...<br>
><br>
> Drools-5.2 doesn't help either :-(<br>
><br>
> 2011/6/2 Joe White <<a href="mailto:Joe.White@recondotech.com">Joe.White@recondotech.com</a>>:<br>
>> If you cast $b on the RHS it will probably work. We’ve had to do this in the<br>
>> past for rules like this.<br>
>><br>
>><br>
>><br>
>> ….<br>
>><br>
>> then:<br>
>> Test fact = new Test();<br>
>><br>
>> Book rhsBook = (Book)$b;<br>
>> fact.getList().addAll( rhsBook.authors );<br>
>> insert(fact);<br>
>> end<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
>> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Mark Proctor<br>
>> Sent: Thursday, June 02, 2011 8:52 AM<br>
>> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> Subject: Re: [rules-users] list operations in "then" part<br>
>><br>
>><br>
>><br>
>> On 02/06/2011 08:14, Wolfgang Laun wrote:<br>
>><br>
>> On 1 June 2011 21:43, Simon Chen <<a href="mailto:simonchennj@gmail.com">simonchennj@gmail.com</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> I am always confused about what we can do in the "then" part of the rule.<br>
>><br>
>> In particular, I have problem duplicate a list. For example:<br>
>><br>
>> when:<br>
>> $b: Book( "james" memberOf authors )<br>
>> then:<br>
>> Test fact = new Test();<br>
>> fact.getList().addAll( $b.authors );<br>
>> insert(fact);<br>
>> end<br>
>><br>
>> The error message reads like this:<br>
>><br>
>> BuildError: Unable to build expression for 'consequence': [Error:<br>
>> Failed to compile: 2 compilation error(s):<br>
>> - (1,7) unqualified type in strict mode for: $b<br>
>> - (1,12) unqualified type in strict mode for: authors]<br>
>><br>
>> What is the right way to do this?<br>
>><br>
>> Granted - the error message is a puzzle in itself, but basically, the RHS<br>
>> must be written according to Java rules. Hence, if $b is an object of type<br>
>> Book, $b.authors depends on the (Java!) visibility of member authors. If it<br>
>> isn't public, you must use the getter.<br>
>><br>
>> I believe he's using "mvel" judging by the error.<br>
>><br>
>> mark<br>
>><br>
>><br>
>> -W<br>
>><br>
>><br>
>> Thanks.<br>
>> -Simon<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>><br>
>> rules-users mailing list<br>
>><br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
>><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
>><br>
><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>