[rules-users] probliem in using "in" and "not in" operator in drool file.

Edson Tirelli tirelli at post.com
Tue Sep 11 07:56:41 EDT 2007


    Inside eval() you must use code in the chosen semantic dialect (either
Java or MVEL). None of them have "not in" operator that is a DRL syntax
sugar.
    So, you need to either properly write Java or MVEL code inside the eval,
or use a regular DRL constraint.

    In this specific case, if you are asserting the Map into the working
memory, you can do something like:

rule XXX
when
    Map( this['name'] not in ("amit","siddhartha") )
then
   // do something
end

    []s
    Edson

2007/9/11, Gaurav2007 <gaurav.a.joshi at capgemini.com>:
>
>
> Hi All,
>
> I am using drool4.0.1 in my application,
>
> I have one map in global memory this map contains mapping of id and
> value,i
> want to validate these values.
>
> but when i am using in and not in rule like:
>
> eval(validatorMap.get("name")  not in("amit","siddhartha"))
>
> where validatorMap is a map of id and value inserted in global memory.
>
> it is giving following error:
> org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
> name=Short Name, agendaGroup=MAIN, salience=0, no-loop=false]
>         com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java
> (8:330) : The
> left-hand side of an assignment must be a variable
>         com/telekurs/nva/mde/fe/ak/validation/Rule_Short_Name_0.java
> (8:357) :
> Syntax error on token "not", invalid AssignmentOperator
>
> please help me how to validate value from a map using in and not in
> operator
> of drool.
>
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/probliem-in-using--%22in%22-and-%22not-in%22-operator-in-drool-file.-tf4421498.html#a12611458
> 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
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  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/20070911/f722a2d1/attachment.html 


More information about the rules-users mailing list