<div dir="ltr">Hi <span style="font-family:arial,sans-serif;font-size:13px">Davide,</span><div><span style="font-family:arial,sans-serif;font-size:13px">I am trying to group by Hild. Here first i will get the hlld into id and segregate the results by hild and sum the value t1</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">If you take an sql </span></div><div><span style="font-family:arial,sans-serif;font-size:13px">select sum(t1),hlid from product group by hild</span></div><div>
<span style="font-family:arial,sans-serif;font-size:13px">so i will get</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">if the data is </span></div><div><span style="font-family:arial,sans-serif;font-size:13px">hlid t1</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">1 10 </span></div><div><span style="font-family:arial,sans-serif;font-size:13px">1 10</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">2 10</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">2 10</span></div><div><font face="arial, sans-serif">the result would be</font></div><div><font face="arial, sans-serif">hiid t1</font></div><div><font face="arial, sans-serif">1 20</font></div>
<div><font face="arial, sans-serif">2 20</font></div><div><font face="arial, sans-serif">Hope you understand what i am trying to do here</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Regards,</font></div>
<div><font face="arial, sans-serif">Raja</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Regards,</font></div><div><font face="arial, sans-serif">Raja</font></div><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 3 March 2014 17:05, Davide Sottara <span dir="ltr"><<a href="mailto:dsotty@gmail.com" target="_blank">dsotty@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Raja,<br>
it is not clear what you are trying to achieve.<br>
<br>
The rule might be well written or not, we don't know your
requirements.<br>
If "id" is what it should be - an identifier - your accumulate
constraint<br>
would match a single object for each Product (the original product
itself),<br>
which looks suspicious.<br>
<br>
I'll assume that you are doing a performance test and you are not
satisfied<br>
with the overall execution time.<br>
The question, however, is: how many facts are you inserting? Are
you firing<br>
all rules after the insertion of each fact, or just once at the
end?<br>
Last, but not least, which version are you using?<br>
<br>
Accumulate should be used carefully in combination with
insertLogical,<br>
since the former updates its result every time its fact collection
changes.<br>
The latter will generate a new fact, keep track of its
dependencies,<br>
and replace it when the accumulation result itself changes.<br>
<br>
Of course, if you were inserting 100 facts, the numbers would
raise<br>
a warning, but could be reasonable for several thousands, if not<br>
hundred thousands. Citing one of your previous emails:<br>
"I want to test my rules with 10,000 facts to 20,000,000 facts"<br>
<br>
Best<br>
Davide<div><div class="h5"><br>
<br>
<br>
On 03/03/2014 12:10 PM, Raja Sekhar wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">Hi,
<div>I am using the following rule</div>
<div>
<div>package com.demo;</div>
<div>import com.sample.model.Product;</div>
<div>import com.sample.model.Products;</div>
<div>import java.util.List;</div>
<div>import java.util.Set;</div>
<div>dialect "mvel"</div>
<div><br>
</div>
<div>rule "Product_0"</div>
<div>no-loop</div>
<div>when</div>
<div><span style="white-space:pre-wrap"> </span>Product(id:
hlId) <span style="white-space:pre-wrap"> </span>accumulate
(e :Product(hlId == id), <span style="white-space:pre-wrap"> </span>$sum1 : sum(e.t1) ) </div>
<div>then</div>
<div> insertLogical("hid=" + id +",T1=" + $sum1);</div>
<div>end</div>
<div><br>
</div>
<div>I am inserting facts (Product objects) into it and firing
the rules.</div>
<div>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.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Raja Sekhar </div>
<div><br>
</div>
-- <br>
<div dir="ltr">Raja Sekhar Amirapu<br>
------------------------------------------------------
<div>"If any anyone can do it, i can do it. If no one else
can do it, i must do it"<br>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Raja Sekhar Amirapu<br>
------------------------------------------------------<div>"If any anyone can do it, i can do it. If no one else can do it, i must do it"<br></div></div>
</div>