[rules-users] Matching strings in two arrays

Wolfgang Laun wolfgang.laun at gmail.com
Thu Oct 7 08:58:56 EDT 2010


You cannot construct a Collection "on the fly" - neither in Java, nor in DRL.
-W


On 7 October 2010 14:55, kpandey <kumar.pandey at gmail.com> wrote:
>
>
> Wolfgang Laun-2 wrote:
>>
>> You could define a new operator (similar to "contains" or "memberOf") that
>> tests whether a field - a set of values - is a subset of a another set of
>> values.
>>
>> See my home page for a full recipe:  http://members.inode.at/w.laun/
>>
>> The code given there is for both sides being java.util.Collection.
>> Handling
>> of
>> arrays could be added. But you should also consider providing the sets for
>> the rules as static auxiliary facts.
>>
>> -W
>>
> Thanks for the sample code. I also explored other operators in the jboss
> code base and now have a fairly good understanding of it.
>
> In my use case I have a fixed set of values in the right side of of the
> operator. Only the left side changes as input fact --
>
> when
>   MyContext(inputSetOfStings subsetOf  ("StringVal1", "StringVal2",
> "StringVal3", "StringVal4"))
>
>
> How do I construct this rhs of the operator such that it is taken as a
> collection when the rule is compiled?
>
> Thanks
> Kumar
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Matching-strings-in-two-arrays-tp1602511p1648169.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
>




More information about the rules-users mailing list