[rules-users] Re: accumulate over multiple types

Geoffrey De Smet ge0ffrey.spam at gmail.com
Sat Jul 28 12:08:33 EDT 2007


As a workaround I replaced my query with a rule which does a logical 
assert of a new WorkaroundMultiplePatternAccumulate object.
Then I do an accumulate of counting those.

Because it's dirty code atm (doing some class casting, still using the 
double sum() function, ...),
I expected a noticable performance decrease for TTP.
To my surprise it was a performance increase of about 1%?!?

Can't wait to see MultiplePatternAccumulate implemented :)
Is there a jira issue to watch?

I 'll make a patch for sumInteger() tommorrow.

With kind regards,
Geoffrey De Smet


Mark Proctor wrote:
> 'accumulate' currently can only take a single Pattern, multiple 
> correlated Patterns is scheduled for a future release (hopefully next 
> one). Also don't use semi colons they just aren't needed and in some 
> places break things.
> 
> Mark
> Geoffrey De Smet wrote:
>> I 'd like to get the number of queens which have the same y.
>>
>> I used to do this with a query:
>>    query "multipleQueensHorizontal"
>>        Queen($id : id, $y : y);
>>        Queen(id > $id, y == $y);
>>    end
>> And then ask the size() of it.
>>
>> But now I should be able to do this with the accumulate function:
>>     $multipleQueensHorizontal : Integer()
>>     from accumulate(
>>         $q1 : Queen($id : id, $y : y);
>>         Queen(id > $id, y == $y);
>>       , count($q1)
>>     );
>>
>> However, I get a parsing error on it:
>>   Caused by: org.drools.rule.InvalidRulePackage: [31,37]: 
>> unknown:31:37 Unexpected token ';'[33,6]: unknown:33:6 mismatched 
>> token: [@123,814:814=',',<12>,33:6]; expecting type THEN
>>
>> Apparently the ; in of "$q1 : Queen($id : id, $y : y);" is inacceptable?
>>
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




More information about the rules-users mailing list