<br> Geoffrey,<br><br> What you want is simply to constrain the inner pattern:<br><br>rule "calculateTopicConflict"<br> when<br> $leftTopic : Topic($id : id);<br> $rightTopic : Topic(id > $id);
<br> $studentSet : HashSet( size > 0 )<br> from collect(<br> $student : Student( this memberOf $leftTopic.studentList, this memberOf $rightTopic.studentList ) );<br> then<br> insertLogical(new TopicConflict($leftTopic , $rightTopic , $studentSet));
<br>end<br><br> []s<br> Edson<br><br><br><div><span class="gmail_quote">2007/11/17, Geoffrey De Smet <<a href="mailto:ge0ffrey.spam@gmail.com">ge0ffrey.spam@gmail.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;">
Is a multipattern collect supported?<br><br>I have a rule which finds all 2 topics and all the students they share<br>if there is at least 1 such student:<br><br>rule "calculateTopicConflict"<br> when<br> $leftTopic : Topic($id : id);
<br> $rightTopic : Topic(id > $id);<br> $studentSet : HashSet( size > 0 )<br> from collect(<br> $student : Student(),<br> $leftTopic.studentList contains $student,
<br> $rightTopic.studentList contains $student<br> );<br> then<br> insertLogical(new TopicConflict($leftTopic , $rightTopic ,<br>$studentSet));<br>end<br><br><br>This won't compile:
<br>Caused by: org.drools.rule.InvalidRulePackage: [29,36]: unknown:29:36<br>mismatched token: [@370,1504:1504=',',<11>,29:36]; expecting type<br>RIGHT_PAREN[30,39]: unknown:30:39 mismatched token:<br>[@376,1545:1552='contains',<49>,30:39]; expecting type
<br>LEFT_PAREN[30,48]: unknown:30:48 Unexpected token '$student'<br> at org.drools.rule.Package.checkValidity(Package.java:424)<br><br><br>Is a multipattern collect supported?<br><br>Thanks for your help :)
<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> 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>