[rules-users] Drools 4.0, Support for multiple pattern in accumulate source pattern

Juergen work_registries at web.de
Tue Aug 21 08:51:56 EDT 2007


It appears as if accumulate does support only a single pattern CE as 
source pattern, e.g.:

Number() from accumulate(
	Cheese(
		price : price
	),
	sum( price )
)

Is it possible to have more than one pattern in the source pattern, e.g.:

Number() from accumulate(
	Cheese(
		price : price,
		type : type
	)
	Person(
		favouriteCheese == type,
		age > 30
	),
	sum( price )
)

The same could be said for collect, but there the problem to specify 
which item of a matching tuple is to be collected, but this could be 
handled recreating collect via accumulate, e.g.:

Collection() from accumulate(
	cheese : Cheese(
		type : type
	)
	Person(
		favouriteCheese == type,
		age > 30
	),
	collect( cheese )
)




More information about the rules-users mailing list