[rules-users] Multipattern collect

Geoffrey De Smet ge0ffrey.spam at gmail.com
Sat Nov 17 08:43:09 EST 2007


Is a multipattern collect supported?

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 :)

-- 
With kind regards,
Geoffrey De Smet




More information about the rules-users mailing list