Another approach (that I haven't tried, but should work) is to write a custom 
operator "contains_all" which checks that all members of one Collection are in 
another.  It should be fairly simple to write, as it would use use 
java.util.Collection.containsAll(Collection) internally.

--- On Fri, 2/19/10, Ansgar Konermann <ansgar.konerm...@googlemail.com> wrote:

> From: Ansgar Konermann <ansgar.konerm...@googlemail.com>
> Subject: Re: [rules-users] Can I do a Collection contains Collection?
> To: "Rules Users List" <rules-users@lists.jboss.org>
> Date: Friday, February 19, 2010, 10:01 AM
> Hi,
> 
> untested guess (replace ZipCode by actual type name of your
> ZIP code data):
> 
> rule "example"
>    when
>      $validZipCodes: Set() from
> RefData.getValidZipCodes()
>      Example( $actualZips: zips )
>      exists( ZipCode( this not memberof
> $validZipCodes ) from $actualZips )
>    then
>     error()
> end
> 
> Am 19.02.2010 16:38, schrieb EdenAEL20:
> > I have an object coming in which contains a collection
> of id's. I want to
> > verify these id's are in another collection. I'm
> looking for something like
> > collection is a subset of another collection. any
> ideas??
> >
> > zips below is a collection, i want to verify that each
> zip is in $e1.
> >
> > rule "example"
> >    when
> >           e1: Set()
> from RefData.getConstantValues()
> >           e2:
> Example( zips not in $e1)
> >    then
> >         error()
> >    
> 
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


      

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

Reply via email to