[rules-users] Matching strings in two arrays

Wolfgang Laun wolfgang.laun at gmail.com
Thu Sep 30 05:55:06 EDT 2010


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

On 29 September 2010 20:47, kpandey <kumar.pandey at gmail.com> wrote:

>
> This works great for the case where all entries in fact matches all entries
> in rule.
>
> I have a case where a subset of facts can exist in the set of rule.
>
> How would I construct the rule in this case without using the exits and
> from
> as I did initially?
>
> so MyContext.classes has subset "TStr1", "TStr2", "TStr3" and rule has set
> "TStr1", "TStr2", "TStr3", "TStr4","TStr5",
>
> The rule should pass in this case as classes values are subset of rules.
>
> Thanks
> Kumar
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Matching-strings-in-two-arrays-tp1602511p1604185.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100930/729fc3ae/attachment.html 


More information about the rules-users mailing list