[rules-users] Accessing collections in conditional statements (inside/outside working memory)

Edson Tirelli tirelli at post.com
Mon Jun 21 17:28:42 EDT 2010


>
> Edson Tirelli-3 wrote:
> >
> >     Also, remember you can negate operators:
> > Parent( collection contains $child )
> > Parent( collection not contains $child )
> >     That is more efficient than composing "exists"/"not" and "from".
> >
>
> True, but "children not contains $child" expects to have the Child bound in
> a previous condition, implying (to my understanding) that "a" child must be
> present to match the condition, while this might not and, in my rule,
> mustn't be the case at all.
>
>
    Correct. The way to represent that scenario without using "from" is to
write it like this:


not(
    $child : Child( name == "bob" )
    $parent : Parent( children contains $child )
)

    Edson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100621/5698b40a/attachment.html 


More information about the rules-users mailing list