<br>   Greg, I believe I fixed this bug in trunk a few weeks ago. Although I confess I did not understood the intent of your rules... :)<br><br>   Barry, you can certainly go either way. Rete is very efficient on filtering fact types, but of course there is some overhead on fact handle creation. If performance is acceptable for you by just inserting events and letting the engine discard them automatically when not used, I would not worry about. If you are having performance problems due to the volumes of non-interesting events and you want to try pre-filtering, I can give you some pointers on how to find the fact types used by your rules/queries. In this case, we might even make a feature of that and have the &quot;pre-filter&quot; being executed by the engine... ;)<br>
<br>   Edson<br><br><div class="gmail_quote">2009/11/24 Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Well, I was about to say &quot;you could do this using rule inheritance&quot; but there is a caveat, and possibly a bug.  It almost works. :)<br>
<br>
Try this:<br>
<br>
rule &quot;BaseStream1Criteria&quot;<br>
        enabled false<br>
        when<br>
                m : Message( foo == &quot;BAR&quot; ) from entry-point &quot;Stream1&quot;<br>
        then<br>
                System.out.println( &quot;BaseStream1Criteria&quot; );<br>
end<br>
<br>
rule &quot;SubRule1&quot; extends &quot;BaseStream1Criteria&quot;<br>
        when<br>
                Message( status == Message.HELLO ) from m;<br>
        then<br>
                System.out.println( &quot;SubRule1 &quot; );<br>
end<br>
<br>
rule &quot;BaseStream2Criteria&quot;<br>
        enabled false<br>
        when<br>
                m : Message( foo == &quot;BAS&quot; ) from entry-point &quot;Stream2&quot;<br>
        then<br>
                System.out.println( &quot;BaseStream2Criteria&quot; );<br>
end<br>
<br>
rule &quot;SubRule2&quot; extends &quot;BaseStream2Criteria&quot;<br>
        when<br>
                Message( status == Message.HELLO ) from m;<br>
        then<br>
                System.out.println( &quot;SubRule2 &quot; );<br>
end<br>
<br>
Basically, define one rule for each entry point that has the global criteria for that entry point.  Then extend that rule.<br>
<br>
The caveat is that it seems you can&#39;t use the events matched in the super-rule in the RHS of the subrule. (Try putting the object &quot;m&quot; matched into the action of either of the subrules.  It neither validates in eclipse nor compiles at runtime, drools 5.0.1.)  If this isn&#39;t fixed in trunk (I can&#39;t check at the moment) I&#39;ll open a jira.<br>

<br>
Code attached.  When you run it, this should be the output:<br>
<br>
SubRule2<br>
SubRule1<br>
<br>
--- On Mon, 11/23/09, Barry Kaplan &lt;<a href="mailto:groups1@memelet.com">groups1@memelet.com</a>&gt; wrote:<br>
<br>
&gt; From: Barry Kaplan &lt;<a href="mailto:groups1@memelet.com">groups1@memelet.com</a>&gt;<br>
&gt; Subject: [rules-users]  Does Session effeciently filter unused facts, or...<br>
&gt; To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; Date: Monday, November 23, 2009, 9:12 PM<br>
<div><div></div><div class="h5">&gt;<br>
&gt; ... should I put a filter before insert().<br>
&gt;<br>
&gt; I will have lots of events coming from hardware devices,<br>
&gt; only some of which<br>
&gt; be applicable to a given session instance. I&#39;ve tried<br>
&gt; extracting the<br>
&gt; declared types from the packages, but that doesn&#39;t include<br>
&gt; classes used in<br>
&gt; patterns which where only imported. So determine the actual<br>
&gt; set of event<br>
&gt; classes used by a given set of packages seems not to be so<br>
&gt; easy.<br>
&gt;<br>
&gt; I&#39;ve drilled down to EntryPointNode.assertObject......<br>
&gt; --<br>
&gt; View this message in context: <a href="http://old.nabble.com/Does-Session-effeciently-filter-unused-facts%2C-or...-tp26489782p26489782.html" target="_blank">http://old.nabble.com/Does-Session-effeciently-filter-unused-facts%2C-or...-tp26489782p26489782.html</a><br>

&gt; Sent from the drools - user mailing list archive at<br>
&gt; Nabble.com.<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
<br>
<br>
      </div></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>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>