[rules-users] Multipattern collect

Mark Proctor mproctor at codehaus.org
Sat Nov 17 12:15:34 EST 2007


Geoffrey De Smet wrote:
> Is a multipattern collect supported?
no.
>
> I have a rule which finds all 2 topics and all the students they share 
> if there is at least 1 such student:
>
> rule "calculateTopicConflict"
>     when
>         $leftTopic : Topic($id : id);
>         $rightTopic : Topic(id > $id);
>         $studentSet : HashSet( size > 0 )
>             from collect(
>                 $student : Student(),
>                 $leftTopic.studentList contains $student,
>                 $rightTopic.studentList contains $student
>             );
>     then
>         insertLogical(new TopicConflict($leftTopic , $rightTopic , 
> $studentSet));
> end
>
>
> This won't compile:
> Caused by: org.drools.rule.InvalidRulePackage: [29,36]: unknown:29:36 
> mismatched token: [@370,1504:1504=',',<11>,29:36]; expecting type 
> RIGHT_PAREN[30,39]: unknown:30:39 mismatched token: 
> [@376,1545:1552='contains',<49>,30:39]; expecting type 
> LEFT_PAREN[30,48]: unknown:30:48 Unexpected token '$student'
>     at org.drools.rule.Package.checkValidity(Package.java:424)
>
>
> Is a multipattern collect supported?
>
> Thanks for your help :)
>




More information about the rules-users mailing list