<br>&gt; So the question is it a bug or a feature? :)<br><br>   Well, there are no bugs, only features! ;)<br>   But we still should change the feature to properly match the spec semantics of &quot;not&quot;. :) Can you please open a ticket and attach your test case bellow? Should be an easy fix. <br>
<br>   Thanks,<br>   Edson<br><br><div class="gmail_quote">2010/1/12 Taras Svirskyi <span dir="ltr">&lt;<a href="mailto:stware@gmail.com">stware@gmail.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;">
Hi,<br>
  I don&#39;t know exactly is it a bug or am I doing something wrong.<br>
  Consider following example.<br>
  There are nodes that are connected into directed graph. Each node has<br>
special collection of attributes. Under some conditions attributes<br>
should be propagated along the edges in the graph.<br>
<br>
  Lets model this with following code.<br>
<br>
/******* propagation rules **********************/<br>
package com.test.collection;<br>
<br>
rule &quot;move child&quot;<br>
when<br>
        c : Child()<br>
        s : CNode( children contains c)<br>
        l : Link( src == s,<br>
                  t : target &amp;&amp; target.children not contains c )<br>
then<br>
        System.out.println(&quot;adding &quot;+c+&quot; from &quot;+s+&quot; to &quot;+t);<br>
        t.addChild(c);<br>
        update(t);<br>
end<br>
<br>
<br>
/** Child.java (represent special attributes of a node) *******/<br>
package com.test.collection;<br>
<br>
public class Child {<br>
        private String name;<br>
        public Child(String name){<br>
                <a href="http://this.name" target="_blank">this.name</a> = name;<br>
        }<br>
        public String getName() {<br>
                return name;<br>
        }<br>
        @Override<br>
        public String toString() {<br>
                return &quot;child(&quot;+name+&quot;)&quot;;<br>
        }<br>
}<br>
<br>
/********* CNode.java - nodes of a graph *************/<br>
package com.test.collection;<br>
<br>
import java.util.HashSet;<br>
import java.util.Set;<br>
<br>
public class CNode {<br>
        private Set&lt;Child&gt; children;<br>
<br>
        public CNode() {<br>
                this.children = new HashSet&lt;Child&gt;();<br>
        }<br>
<br>
        public Set&lt;Child&gt; getChildren() {<br>
                return children;<br>
        }<br>
<br>
        public void addChild(Child ch){<br>
                children.add(ch);<br>
        }<br>
<br>
        @Override<br>
        public String toString() {<br>
                return &quot;Node{children=&quot;+children+&quot;}&quot;;<br>
        }<br>
}<br>
<br>
/**** Link.java - edges of a graph *******/<br>
package com.test.collection;<br>
<br>
public class Link {<br>
        private CNode src;<br>
        private CNode target;<br>
<br>
        public Link(CNode src, CNode target) {<br>
                this.src = src;<br>
                this.target = target;<br>
        }<br>
<br>
        public CNode getSrc() {<br>
                return src;<br>
        }<br>
<br>
        public CNode getTarget() {<br>
                return target;<br>
        }<br>
}<br>
<br>
/********************* populate session with facts **********/<br>
Child c0 = new Child(&quot;x&quot;);<br>
Child c1 = new Child(&quot;y&quot;);<br>
Child c2 = new Child(&quot;z&quot;);<br>
<br>
CNode src = new CNode();<br>
src.addChild(c0);<br>
src.addChild(c1);<br>
<br>
CNode target = new CNode();<br>
target.addChild(c0);<br>
<br>
Link link = new Link(src,target);<br>
<br>
// populate with facts<br>
ksession.insert(c0);<br>
ksession.insert(c1);<br>
ksession.insert(c2);<br>
ksession.insert(link);<br>
ksession.insert(src);<br>
ksession.insert(target);<br>
<br>
/****************************************************************/<br>
So with all that code listed below I&#39;ve got following output from rules:<br>
--<br>
adding child(x) from Node{children=[child(x), child(y)]} to<br>
Node{children=[child(x)]}<br>
--<br>
That means that &#39;not contains&#39; operator actually works as &#39;contains&#39;<br>
one. Still when I changed it to older operator &#39;excludes&#39; everything<br>
goes right printing out.<br>
---<br>
adding child(y) from Node{children=[child(y), child(x)]} to<br>
Node{children=[child(x)]}<br>
---<br>
<br>
I&#39;ve noticed that rewriting rule in form of simple statements also fix<br>
issue.<br>
<br>
rule &quot;move child&quot;<br>
when<br>
        c : Child()<br>
        s : CNode( children contains c)<br>
        t : CNode( children not contains c )<br>
        l : Link( src == s, target == t)<br>
then<br>
        System.out.println(&quot;adding &quot;+c+&quot; from &quot;+s+&quot; to &quot;+t);<br>
        t.addChild(c);<br>
        update(t);<br>
end<br>
<br>
So the question is it a bug or a feature? :)<br>
<br>
regards,<br>
Taras<br>
_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><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>