<br>&nbsp;&nbsp;&nbsp; This is a regression bug. InitialFact should not be shadowed. Can you please open a JIRA for that?<br><br>&nbsp;&nbsp; Thank you<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><div><span class="gmail_quote">2007/8/15, Anh Vuong &lt;<a href="mailto:anhtvuong@yahoo.com">
anhtvuong@yahoo.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Thanks for your help, Edson. </div>  <div>collect works in my simple test now, but not when I integrate with my code. Is there an easy way to debug LHS to see if collect stmt is evaluated?&nbsp; I notice IllegalAccessError
<br>&nbsp;since my app will load a selected list of jars upfront, so my questions are:</div>  <div>1) Can this error break collect?</div>  <div>2) How can I fix this error still using our own classLoader?</div>  <div>&nbsp;</div>  
<div>Here is the stack trace:</div>  <div>2007 Aug 15, 09:08:13:193&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exception IllegalAccessError<br>java.lang.IllegalAccessError: class org.drools.reteoo.InitialFactImplShadowProxy cannot access its superclass org.drools.reteoo.Init
<br>ialFactImpl<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.defineClass1(Native Method)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.defineClass(Unknown
 Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.rule.MapBackedClassLoader.fastFindClass(MapBackedClassLoader.java:60)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.rule.MapBackedClassLoader.loadClass(MapBackedClassLoader.java:79)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.lang.ClassLoader.loadClass
(Unknown Source)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.reteoo.Rete$ObjectTypeConf.loadOrGenerateProxy(Rete.java:379)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.reteoo.Rete$ObjectTypeConf.defineShadowProxyData(Rete.java:344)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.reteoo.Rete$ObjectTypeConf
.&lt;init&gt;(Rete.java:320)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.reteoo.Rete.assertObject(Rete.java:145)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:190)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 at org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:163)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1241)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:822)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at org.drools.common.AbstractWorkingMemory.insert
(AbstractWorkingMemory.java:623)<br></div>  <div>&nbsp;</div>  <div>Thanks,</div>  <div>-av</div><div><span class="e" id="q_1146a7caf3881683_1">  <div>&nbsp;</div>  <div><br><b><i>Edson Tirelli &lt;<a href="mailto:tirelli@post.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
tirelli@post.com</a>&gt;</i></b> wrote:</div>  </span></div><blockquote style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;"><div><span class="e" id="q_1146a7caf3881683_3"><br>&nbsp;&nbsp; No single simple answer here. You need to check what would better fit
 your use case. <br>&nbsp;&nbsp; The thing is: it is not possible to limit the number of matches to a collect statement... all matching instances WILL match it and be collected. <br><br>&nbsp;&nbsp; No really &quot;clean&quot; way I can think about, but a few possible options (haven&#39;t executed them, but shall work):
<br><br>1. Simply execute the actions multiple times in the consequence:<br><br>  <div>when </div><font size="2"><font size="2">  <div align="left">&nbsp;&nbsp; eventList : LinkedList( $size : size &gt;= 5 ) from collect( Event(text matches &quot;.*rule5.*&quot;
<font size="2"> )) <br></font><b><font color="#960000" size="2">then<br>&nbsp;&nbsp; for( int i = 0; i &lt; $size/5; i++ )<br></font></b></div></font></font><font size="2">  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(<font color="#008000" size="2">
&quot;rule5 is fired &quot;</font><font size="2"> + eventList.size ());</font> <br></div></font>end<br><br>2. Flag used facts:<br><br>  <div>when</div><font size="2"><font size="2">  <div align="left">&nbsp;&nbsp; eventList : LinkedList( size &gt;= 5 ) from collect( Event(text matches &quot;.*rule5.*&quot;, processed == false
<font size="2"> )) <br></font><b><font color="#960000" size="2">then<br></font></b><font size="-0"><font size="2">&nbsp;&nbsp; System.out.println(<font color="#008000" size="2">&quot;rule5 is fired &quot;</font><font size="2"> + eventList.size
());</font> <br></font></font><b><font color="#960000" size="2">&nbsp;&nbsp; for( int i = 0; i &lt; 5; i++ ) {<br><span style="font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Event e = </span></font></b><font size="2"><font size="2"><b><font color="#960000" size="2">
<span style="font-weight: bold;">(Event) eventList.get ( i );</span></font></b></font></font><b><font color="#960000" size="2"><span style="font-weight: bold;"></span><br><span style="font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.setProcessed
( true );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; update( e ); <br></span></font></b></div></font></font><font size="2"> 
 <div>&nbsp;&nbsp; }<br></div></font>end<br><br>2. Retract used facts:<br><br>  <div>when</div><font size="2"><font size="2">  <div align="left">&nbsp;&nbsp; eventList : LinkedList( size &gt;= 5 ) from collect( Event(text matches &quot;.*rule5.*&quot;
<font size="2"> )) <br></font><b><font color="#960000" size="2">then<br></font></b><font size="-0"><font size="2">&nbsp;&nbsp; System.out.println(<font color="#008000" size="2">&quot;rule5 is fired &quot;</font><font size="2"> + eventList.size
());</font> <br></font></font><b><font color="#960000" size="2">&nbsp;&nbsp; for( int i = 0; i &lt; 5; i++ ) {<br><span style="font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Event e = </span></font></b><font size="2"><font size="2"><b><font color="#960000" size="2">
<span style="font-weight: bold;">(Event) eventList.get( i );</span></font></b></font></font> <b><font color="#960000" size="2"><span style="font-weight: bold;"></span><br><span style="font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retract( e );
 <br></span></font></b></div></font></font><font size="2">  <div>&nbsp;&nbsp; }<br></div></font>end<br><br>&nbsp;&nbsp;&nbsp; Hope it helps.<br><br>&nbsp;&nbsp;&nbsp; Edson<br><span class="gmail_quote"></span><br>  <div><span class="gmail_quote">2007/8/10, Anh Vuong &lt;
<a href="mailto:anhtvuong@yahoo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">anhtvuong@yahoo.com</a>&gt;:</span>  <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
  <div>Hi,</div>  <div>I&#39;d like to use keyword collect to do my filtering but its behaviour confused me, please advise. I greatly appreciate your help.</div>  <div>&nbsp;</div>  <div>Problem 1:</div>  <div>&nbsp;</div>  <div>when 
</div><font size="2"><font size="2">  <div align="left">eventList : LinkedList(size == 5)</div>  <div align="left">from collect( Event(text matches </div></font><font color="#008000" size="2">&quot;.*rule5.*&quot;</font><font size="2">
 ))   <div align="left"></div>  <div align="left"></div></font><b><font color="#960000" size="2">then</font></b></font><font size="2">   <div>System.out.println(</div></font><font color="#008000" size="2">&quot;rule5 is fired &quot; 
</font><font size="2">+ eventList.size());</font>   <div><font size="2"></font>&nbsp;</div>  <div><font size="2">I still do not see&nbsp;any log msg after adding 5+ events. Is something wrong with my rule?</font></div>  <div>&nbsp;</div>
  <div>Problem 2:</div>  <div>&nbsp;</div>  <div>when</div>  <div>event: Event(text matches <font color="#008000" size="2">&quot;.*rule5.*&quot;</font><font size="2"> ))</font></div><font size="2"><font size="2">  <div align="left">
eventList : LinkedList(size == 5)</div>  <div align="left">from collect( Event(text == event.text)</div></font><font size="2">  <div align="left"></div>  <div align="left"></div></font><b><font color="#960000" size="2">then 
</font></b></font><font size="2">  <div>System.out.println(</div></font><font color="#008000" size="2">&quot;rule5 is fired &quot;</font><font size="2"> + eventList.size());</font>   <div>&nbsp;</div>  <div><font size="2">After
 adding 5 events, I see&nbsp;5 log msg instead of one as I&#39;d expect. </font></div>  <div>If I add more events, I will see more log. How do I tell LHS&nbsp; to reset the count from 0.</div>  <div>Basically, I want to take 1 event out of 5 similar events (suppressing filtering). So if there are 10 similar events, my RHS should activate 2 times, not 10 times. 
</div>  <div>&nbsp;</div>  <div>Thanks,</div><span>  <div>-av</div></span><span>  <div><font size="2"></font>&nbsp;</div>  <div></div>  <hr size="1">  Ready for the edge of your seat? <a href="http://us.rd.yahoo.com/evt=48220/*http://tv.yahoo.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Check out tonight&#39;s top picks</a> on Yahoo! TV.   <div></div></span><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org </a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br></span></div>&nbsp;&nbsp;JBoss, a division of Red Hat @ 
<a href="http://www.jboss.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">www.jboss.com</a> _______________________________________________<span class="q"><br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></span></blockquote><span class="ad"><br><p> 

      </p><hr size="1">Park yourself in front of a world of choices in alternative vehicles.<br><a href="http://us.rd.yahoo.com/evt=48246/*http://autos.yahoo.com/green_center/;_ylc=X3oDMTE5cDF2bXZzBF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDZ3JlZW4tY2VudGVy" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Visit the Yahoo! Auto Green Center.</a><p></p></span><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ 
<a href="http://www.jboss.com">www.jboss.com</a>