Thanks Edson :)


"memberOf" isn't in the manual index,
It's hidden away under 6.5.2.1.1.3.1. Operators,
maybe the index could be refactored so those operators are listed?
"6.5.2.1. Pattern" contains a lot of useful information, but there's not decent overview of it's content.

I would even go so far to propose splitting "6.5.2. Left Hand Side (when) Conditional Elements" from chapter 6, as it's - imho - a highly critical reference for writing rules, so maybe even a top level chapter.

Just some thoughts, feel free to ignore :)

With kind regards,
Geoffrey De Smet


Edson Tirelli wrote:

   Geoffrey,

   What you want is simply to constrain the inner pattern:

rule "calculateTopicConflict"
     when
         $leftTopic : Topic($id : id);
         $rightTopic : Topic(id > $id);
         $studentSet : HashSet( size > 0 )
             from collect(
$student : Student( this memberOf $leftTopic.studentList, this memberOf $rightTopic.studentList ) );
     then
insertLogical(new TopicConflict($leftTopic , $rightTopic , $studentSet));
end

   []s
   Edson


2007/11/17, Geoffrey De Smet <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:

    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: [EMAIL PROTECTED],1504:1504=',',<11>,29:36]; expecting 
type
    RIGHT_PAREN[30,39]: unknown:30:39 mismatched token:
    [EMAIL PROTECTED],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

    _______________________________________________
    rules-users mailing list
    [email protected] <mailto:[email protected]>
    https://lists.jboss.org/mailman/listinfo/rules-users




--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com <http://www.jboss.com>


------------------------------------------------------------------------

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to