[rules-users] Simple aggregation problem

Davide Sottara dsotty at gmail.com
Mon Mar 3 06:35:40 EST 2014


Raja,
it is not clear what you are trying to achieve.

The rule might be well written or not, we don't know your requirements.
If "id" is what it should be - an identifier - your accumulate constraint
would match a single object for each Product (the original product itself),
which looks suspicious.

I'll assume that you are doing a performance test and you are not satisfied
with the overall execution time.
The question, however, is: how many facts are you inserting? Are you firing
all rules after the insertion of each fact, or just once at the end?
Last, but not least, which version are you using?

Accumulate should be used carefully in combination with insertLogical,
since the former updates its result every time its fact collection changes.
The latter will generate a new fact, keep track of its dependencies,
and replace it when the accumulation result itself changes.

Of course, if you were inserting 100 facts, the numbers would raise
a warning, but could be reasonable for several thousands, if not
hundred thousands. Citing one of your previous emails:
"I want to test my rules with 10,000 facts to 20,000,000 facts"

Best
Davide


On 03/03/2014 12:10 PM, Raja Sekhar wrote:
> Hi,
> I am using the following rule
> package com.demo;
> import com.sample.model.Product;
> import com.sample.model.Products;
> import java.util.List;
> import java.util.Set;
> dialect "mvel"
>
> rule "Product_0"
> no-loop
> when
> Product(id: hlId) accumulate (e :Product(hlId == id), $sum1 : sum(e.t1) ) 
> then
>  insertLogical("hid=" + id +",T1=" + $sum1);
> end
>
> I am inserting facts (Product objects) into it and firing the rules.
> When i took performance stats from visual vm with JMX. got a time of
> 3832ms. I can you suggest if i am doing any thing wrong with this.
>
> Regards,
> Raja Sekhar 
>
> -- 
> Raja Sekhar Amirapu
> ------------------------------------------------------
> "If any anyone can do it, i can do it. If no one else can do it, i
> must do it"
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140303/b723845c/attachment.html 


More information about the rules-users mailing list