Oi Miguel,<br><br>when I try this in the &quot;doMove&quot; method using the &quot;workingMemory&quot; instead of &quot;ksession&quot; I got this error<br><br><span style="color: rgb(204, 0, 0);"><span style="color: rgb(255, 0, 0);">Exception in thread &quot;main&quot;</span> </span>java.lang.UnsupportedOperationException: <span style="color: rgb(255, 0, 0);">this is implementedby StatefulKnowledgeImpl</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);">    at org.drools.reteoo.ReteooWorkingMemory.getFactHandles</span>(ReteooWorkingMemory.java:363)<br>    ...<br>    ...<br><br>Any idea?<br><br>Obrigado<br><br>Antonio<br><br><br><div class="gmail_quote">
2010/5/6 miguel machado <span dir="ltr">&lt;<a href="mailto:mls.machado@gmail.com">mls.machado@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font size="2"><font face="verdana,sans-serif">Olá Antonio,</font></font><div><font size="2"><font face="verdana,sans-serif"><br></font></font></div><div><font size="2"><font face="verdana,sans-serif"><div>// retract all of it just in case</div>

<div>for (Object fact : ksession.getFactHandles()) {</div><div>  ksession.retract((FactHandle) fact);</div><div>}</div><div><br></div><div>Hope this helps.</div><div>_ miguel</div><div><br></div><div><br></div></font></font><br>

<div class="gmail_quote">2010/5/5 Antonio Neto <span dir="ltr">&lt;<a href="mailto:antoniosouzaneto@gmail.com" target="_blank">antoniosouzaneto@gmail.com</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi,<br><br>Thank you very much for all replies.<br><br>I&#39;ve tried also with not ( EPackage(...)), but the result is the same.<br><br>I think that I remove the EClass from the facts in my solution, but they continue in my workingMemory. <br>


<br>How I can see the facts of the workingMemory object (and how remove it)?<br><br>Thanks<br><br>Best regards<br><br>Antonio<br><br><div class="gmail_quote">2010/5/5  <span dir="ltr">&lt;<a href="mailto:fgadrat@genigraph.fr" target="_blank">fgadrat@genigraph.fr</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div>Hi Antonio,<br>Documentation states that the complement to &quot;not&quot; is &quot;exists&quot;, 
whereas &quot;not&quot; keyword is used to match the absence of a fact (in Working
 Memory), and &quot;exists&quot; keyword is used to test the existence of one or 
more facts (in Working memory).<br> <br>
So if you want to test that a fact is not in working memory, then you 
should  use the <br>
not(MyClass()) pattern.<br> <br>
Hope this helps,<br>
Francois.<br> <br>
Antonio Neto &lt;<a href="mailto:antoniosouzaneto@gmail.com" target="_blank">antoniosouzaneto@gmail.com</a>&gt; a écrit :<div><div></div><div><br> <br>
&gt; Any idea? Please...<br>
&gt;<br>
&gt; 2010/5/4 Antonio Neto &lt;<a href="mailto:antoniosouzaneto@gmail.com" target="_blank">antoniosouzaneto@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; I don&#39;t know exactly why I have a problem in my &quot;exists&quot; function. I&#39;ve<br>
&gt;&gt; tried many different ways, but it does not work. Anybody could help me,<br>
&gt;&gt; please?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I have the following rules:<br>
&gt;&gt;<br>
&gt;&gt; *rule &quot;diff&quot;<br>
&gt;&gt; when<br>
&gt;&gt;     $var1: EReference(name == &quot;employee&quot;)<br>
&gt;&gt;     $var2: EClass(name == &quot;Company&quot;, EAllReferences contains $var1)<br>
&gt;&gt;     not (exists( EPackage(EClassifiers contains $var2 ) ))<br>
&gt;&gt; then<br>
&gt;&gt;     insertLogical(new IntConstraintOccurrence(&quot;diff&quot;, 10));<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt; rule &quot;ClassesNotReferenced&quot;<br>
&gt;&gt;     when<br>
&gt;&gt;         $q1 : EClass();<br>
&gt;&gt;         $q2 : EPackage(EClassifiers contains $q1);<br>
&gt;&gt;         not( exists ( EReference(EType == $q1) ));<br>
&gt;&gt;     then<br>
&gt;&gt;         insertLogical(new IntConstraintOccurrence(&quot;ClassesNotReferenced&quot;,<br>
&gt;&gt; 1, $q1));<br>
&gt;&gt; end*<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; and in my facts (and my EPackage) I have 4 instances of EClass &quot;Company&quot;<br>
&gt;&gt; with a EReference &quot;employee&quot;, and another EClass &quot;Person&quot;.  I still have a<br>
&gt;&gt; &quot;move&quot; that removes EClasses in my Drools Solver.<br>
&gt;&gt;<br>
&gt;&gt; I need to have only one classe &quot;Company&quot; after processing. But it removes<br>
&gt;&gt; only the EClass &quot;Person&quot;, when it was supposed to remove one EClass &quot;Person&quot;<br>
&gt;&gt; and 3 ECLasses &quot;Company&quot;. Leaving one EClass &quot;Company&quot; in the end.<br>
&gt;&gt;<br>
&gt;&gt; The problem is:  when Drools tries to remove a EClass &quot;Person&quot; it thinks<br>
&gt;&gt; that  the EClass &quot;Company&quot; does not exists. But in fact there are 3 others.<br>
&gt;&gt;<br>
&gt;&gt; Any clue about it, please ?<br>
&gt;&gt;<br>
&gt;&gt; Thanks<br>
&gt;&gt;<br>
&gt;&gt; Bests regards<br>
&gt;&gt;<br>
&gt;&gt; Antonio<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br></div></div><br></div></div><div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div></blockquote></div><br>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div></div><br><br clear="all"><div class="im"><br>-- <br>&quot;To understand what is recursion you must first understand recursion&quot;<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>