Hi Visu,<br><br>My understanding (also tested) is that activations are created no matter the knowledge base has the rule packages loaded<br>before or after the working memory is filled with facts, but the execution of the rules happens automatically if the working memory is filled in advance.Setting the RuleBaseUpdateHandler to null, prevents the execution of the rules but keeps activations to be created when adding a rule to the kbase.<br>
In this case, it seems the exists CE only creates activations if the rules are loaded before the working memory is populated.<br>But this doesn&#39;t happen if i change the statement : <br><br>  exists ( Foo() ) --&gt; not ( not ( Foo() ) ) <br>
<br>In this case, activations are created no matter whether the kbase is empty or not before populating the WM.<br><br><br><br><br><div class="gmail_quote">2009/7/13 Viswanathan Nageswaran <span dir="ltr">&lt;<a href="mailto:visu.nageswaran@in.ibm.com">visu.nageswaran@in.ibm.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;">Chivotario,<br>
<br>
&gt;From what I understand, the activation of rules happen as facts are<br>
inserted into the working memory; hence it is important for the session to<br>
be begun against a knowledge base that has the rule packages loaded before<br>
the facts are inserted.<br>
<br>
-Visu<br>
<br>
<br>
<br>
<br>
             Chivotario Martin<br>
             &lt;chivotario@gmail<br>
             .com&gt;                                                      To<br>
             Sent by:                  <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
             rules-users-bounc                                          cc<br>
             es@lists.jboss.or<br>
             g                                                     Subject<br>
                                       [rules-users] &quot;Exists&quot; CE behaviour<br>
<br>
             13/07/2009 14:11<br>
<br>
<br>
             Please respond to<br>
             Rules Users List<br>
             &lt;rules-users@list<br>
               <a href="http://s.jboss.org" target="_blank">s.jboss.org</a>&gt;<br>
<div class="im"><br>
<br>
<br>
<br>
<br>
<br>
Hi ,<br>
<br>
I&#39;m trying to use the Exists keyword within my rules with the following<br>
snippet :<br>
<br>
// Create a session<br>
KnowledgeBaseConfiguration config =<br>
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br>
((RuleBaseConfiguration)config).setRuleBaseUpdateHandler( null ); *<br>
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(config);<br>
StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();<br>
<br>
// Add some objects<br>
for (int i=0; i&lt;5; i++) {<br>
}<br>
<br>
</div><div class="im">// Add a DRL to the kbase<br>
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
kbuilder.add( ResourceFactory.newClassPathResource( &quot;test/existsTest.drl&quot;<br>
), ResourceType.DRL);<br>
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );<br>
<br>
// Fire rules<br>
int fireCount = session.fireAllRules();<br>
<br>
<br>
existsTest.drl :<br>
<br>
rule &quot;existsTest&quot;<br>
</div>( Foo() ) ); (2)<br>
<div class="im">end<br>
<br>
When launched , the rule is not fired (no messages , fireCount 0), but it<br>
is when changing<br>
exists with a double not condition (2).<br>
If the working memory is populated after adding the rules file, the exists<br>
CE works as expected.<br>
* I&#39;ve used no RuleBaseUpdateHandler preventing automatic activations to be<br>
executed so fireAllRules can be used to get the fireCount, but commenting<br>
this line out doesn&#39;t change the results.<br>
<br>
Probably i&#39;m doing something wrong so a little help would be very<br>
appreciated.<br>
<br>
Regards,<br>
Manuel.<br>
</div>_______________________________________________<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>
<br>
<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>