<br>&nbsp;&nbsp;&nbsp; Geoffrey,<br><br>&nbsp;&nbsp;&nbsp; I don&#39;t think you need multiple patterns for this specific use case:<br><br>rule &quot;multipleQueensHorizontal&quot;<br>when<br>&nbsp;&nbsp;&nbsp;&nbsp; Queen($id : id, $y : y)<br>
&nbsp;&nbsp;&nbsp;&nbsp; Number( $multipleQueensHorizontal : intValue )<br>&nbsp;&nbsp;&nbsp;&nbsp; from accumulate( $q : Queen(id &gt; $id, y == $y), count($q) );<br>then<br>&nbsp;&nbsp;&nbsp; // do something<br>end<br><br>&nbsp;&nbsp; Am I misunderstanding your use case?<br><br>&nbsp;&nbsp; []s
<br>&nbsp;&nbsp; Edson<br><br><br><div><span class="gmail_quote">2007/7/28, Geoffrey De Smet &lt;<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I &#39;d like to get the number of queens which have the same y.<br><br>I used to do this with a query:<br>&nbsp;&nbsp;&nbsp;&nbsp;query &quot;multipleQueensHorizontal&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Queen($id : id, $y : y);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Queen(id &gt; $id, y == $y);
<br>&nbsp;&nbsp;&nbsp;&nbsp;end<br>And then ask the size() of it.<br><br>But now I should be able to do this with the accumulate function:<br>&nbsp;&nbsp;&nbsp;&nbsp; $multipleQueensHorizontal : Integer()<br>&nbsp;&nbsp;&nbsp;&nbsp; from accumulate(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $q1 : Queen($id : id, $y : y);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Queen(id &gt; $id, y == $y);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , count($q1)<br>&nbsp;&nbsp;&nbsp;&nbsp; );<br><br>However, I get a parsing error on it:<br>&nbsp;&nbsp; Caused by: org.drools.rule.InvalidRulePackage: [31,37]: unknown:31:37<br>Unexpected token &#39;;&#39;[33,6]: unknown:33:6 mismatched token:
<br>[@123,814:814=&#39;,&#39;,&lt;12&gt;,33:6]; expecting type THEN<br><br>Apparently the ; in of &quot;$q1 : Queen($id : id, $y : y);&quot; is inacceptable?<br><br>--<br>With kind regards,<br>Geoffrey De Smet<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>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ 
<a href="http://www.jboss.com">www.jboss.com</a>