The Rete algorithm isn&#39;t meant to be run this way - all data in globals. Use a fact class X123 with three booleans, and insert facts with varied field values. Your rules ought to be<br><br>   when<br>        X123( cond3 == false )<br>
   then<br><br>and <br><br>   when<br>       X123( cond1 == true, cond2 == true )<br>   then<br><br>-W<br><br><br><div class="gmail_quote">On 2 March 2011 19:43, Dmitri Pissarenko <span dir="ltr">&lt;<a href="mailto:dmitri.pissarenko@gmail.com">dmitri.pissarenko@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello!<br>
<br>
I have following rules file:<br>
<br>
import java.util.List;<br>
<br>
global List outErrorCodes;<br>
global Boolean condition1;<br>
global Boolean condition2;<br>
global Boolean condition3;<br>
<br>
rule &quot;01&quot;<br>
        when<br>
                eval( condition3 == false);<br>
        then<br>
                outErrorCodes.add(&quot;ERROR_CODE1&quot;);<br>
                System.out.println(&quot;01&quot;);<br>
end<br>
<br>
rule &quot;02&quot;<br>
        when<br>
                eval((condition1 == true) &amp;&amp; (condition2 == true));<br>
        then<br>
                outErrorCodes.add(&quot;ERROR_CODE2&quot;);<br>
                System.out.println(&quot;02&quot;);<br>
end<br>
<br>
<br>
When I evaluate this file repeatedly, it is evaluated correctly only<br>
the first time.<br>
<br>
I don&#39;t understand why it happens, because I always create a new<br>
knowledge base for every execution (I don&#39;t re-use sessions).<br>
<br>
Here is the code:<br>
<br>
final KnowledgeBase knowledgeBase2 = createKnowledgeBase(getRuleFileNames());<br>
final StatefulKnowledgeSession session2 =<br>
knowledgeBase2.newStatefulKnowledgeSession();<br>
<br>
...<br>
<br>
Then, I set condition1, condition2 and condition3 with calls like this:<br>
<br>
session2.setGlobal(curName, curValue);<br>
<br>
curValue is Boolean.TRUE or Boolean.FALSE.<br>
<br>
Then, I insert the value of the output variable:<br>
<br>
session2.setGlobal(&quot;outErrorCodes&quot;,<br>
                new LinkedList&lt;String&gt;());<br>
<br>
Then, I invoke these methods:<br>
<br>
session2.fireAllRules();<br>
...<br>
session2.dispose();<br>
<br>
After fireAllRules, outErrorCodes is always empty (apart from the<br>
first run), even in cases, where rule &quot;01&quot; should apply.<br>
<br>
What am I doing wrong?<br>
<br>
Thanks in advance<br>
<br>
Dmitri<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>