Remember that "collect" is a simplified form of "accumulate". So when you can't achieve what you want with collect, first thing you should look for is accumulate.

$list : List() from accumulate(
        $foo : Foo( ) and not Bar( id == $foo.id ),
        collectList( $foo ) )

   Please note that I changed your example making the constraint in Bar use "==" instead of "!=" because I think that is what you want. But if it is not, just use whatever expression you want.

   Also be aware that collect/accumulate are heavy CEs. Nesting multiple patterns inside accumulate is even heavier, so use it wisely.

   Hope it helps,
       Edson
 

2009/8/18 techy <techluver007@gmail.com>

Please someone help me on this.

techy wrote:
>
> I would like to collect All Foo() for which there is no Bar() as given
> below.Please help me on this.
> Thanks.
>
> //psedo rule
> rule 'test'
> list : from collect( Foo(fooId: id) and not Bar(id !=fooId))
> then
> //do conseq
> end
>

--
View this message in context: http://www.nabble.com/Collect-from-tp25014904p25029332.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com