[rules-users] using "from accumulate" with wrong return type

raffi christian.koehler at s2008.tu-chemnitz.de
Sat Nov 24 07:18:06 EST 2012


Hello,

I have a problem with using the /from accumulate/ statement. It is because
I'd like to optmize my code a liitle bit. There are two rules that I like to
merge.

/query "max recomm value for slot 1"
  	accumulate (Recommendation(slot == 1, $recomm_value : recommValue),
   				max	: max($recomm_value))
end/

and

/query "recomms for slot 1"
	recomm	: Recommendation(slot == 1)
end/

So with the first rule I get the maximum of the variable recommValue. The
second rule is for searching exactly this Recommendation-fact with this
value. Now I tried to merge them in the following way:
/
query "recomm for slot 1"
	$recomm : Recommendation() from
					accumulate(Recommendation(
						slot == 1, $recomm_value : recommValue),
						max($recomm_value)
					)
end/

But the returned value always is a double one. Is it because of the usage of
the maximum function? Is it possible to solve this problem with only one
query (getting that Recommendation-fact with the highest recommValue)?

Regards...



--
View this message in context: http://drools.46999.n3.nabble.com/using-from-accumulate-with-wrong-return-type-tp4020957.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list