[rules-users] Can I check if a collection contains one, and only one item of another collection

Edson Tirelli tirelli at post.com
Sat Aug 23 11:45:16 EDT 2008


    You need to use "memberOf", "from" and the accumulate function "count".


   []s
   Edson


2008/8/23 David Cracauer <dcracauer at earthlink.net>

> Thanks for your response.
>
> I don't think contains will work in this case.  I need to match if a
> collection contains one, and only one, of another collection.  So "
> ('a','b','c') contains one of ('a','b','e') " should not match, where
> "('a','b','c') contains ('a','2','3')" should match.
>
> Thanks,
> Dave Cracauer
>
> On Aug 23, 2008, at 8:31 AM, Scott Burrows wrote:
>
> You have the answer in your example, reserved word "contains" will give you
> that information.
>
> Scott Burrows
>
>
>
> On Sat, Aug 23, 2008 at 9:23 AM, David Cracauer <dcracauer at earthlink.net>wrote:
>
>>
>> Hi,
>> I'm getting stuck on this and I'm hoping someone can help..
>> I need to be able to check that a collection contains one, and only one
>> item
>> from another collection.
>>
>> Ideally, I would do something like this:
>>
>>  a:Answer(responses contains one of ("a","b","c"));
>>
>> Is there a way do do this without resorting to evals or predicate
>> expressions? (drools 4.07)
>>
>> Thanks,
>> Dave
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Can-I-check-if-a-collection-contains-one%2C-and-only-one-item-of-another-collection-tp19114896p19114896.html
>> Sent from the drools - user mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080823/b6dbaacb/attachment.html 


More information about the rules-users mailing list