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

Marco Malziotti marco.malziotti at trs.it
Tue Mar 19 11:09:58 EDT 2013


Try to move 'from' in 'from accumulate'. Pay attention to "and" in 
'from accumulate'.

         $match : PeopleMatch()

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


On Tue, 19 Feb 2013 07:59:21 -0800 (PST), Michiel Vermandel wrote:
> 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
>
> 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


Tecnologie nelle Reti e nei Sistemi T.R.S. SpA
Via della Bufalotta, 378 - 00139 Roma
Tel +39.06.87.28.1.1 - Fax +39.06.87.28.1.550

-------------------------------------------------------
 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazioni contenute in questo messaggio 
sono riservate ed a uso esclusivo del destinatario. Qualora il messaggio in parola Le 
fosse pervenuto per errore, la preghiamo di eliminarlo senza copiarlo e di non inoltrarlo 
a terzi, dandocene gentilmente comunicazione. Grazie.
This message, for the law 196/2003, may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the addressee, you must not 
use, copy, disclose or take any action based on this message or any information herein. 
If you have received this message in error, please advise the sender immediately by reply 
e-mail and delete this message. Thank you for your cooperation.

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

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.




More information about the rules-users mailing list