[rules-users] How can I select planning-entities in the accumulate source-pattern based on a list of planning-variables?

Michiel Vermandel mvermand at yahoo.com
Tue Feb 19 10:59:21 EST 2013


Hi,

I am kind of stuck in writing a rule :


I have PeopleMatch facts in working memory.
Each PeopleMatch has a number of persons:  PeopleMatch().getPeople = List<Person>


I have planning-entities (Tasks) which have a planning-variable Person.

Now I would like to create a rule to loop over the PeopleMatch objects, gather all Tasks for the people of this match and do some calculation with all tasks.

This is what I have for the moment:

rule "matchPeopleTasks"
   when

        $match : PeopleMatch()
        $people :  List() from $match .people 

        $match: Number( intValue < 0 )
                   from accumulate( $task : Task(handler == $people),
                                    init( Matcher matcher = $match.getMatcher()),
                                    action( matcher.addTask( $task ); ),
                                    reverse( matcher.removeTask( $task ); ),
                                    result( matcher.getMatch() ) );
  then
        ...
end

 
The problem area is of course the "accumulate( $task : ProjectTask(handler == $people),"
How do I select all tasks in the accumulate function, based on a list of people?

Thanks,

Michiel


-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130219/7f8ad467/attachment-0001.html 


More information about the rules-users mailing list