[rules-users] How to set drools.dialect.mvel.strict = false?

Jeet Singh jeetcyb at gmail.com
Wed Jul 24 13:22:00 EDT 2013


Alright, I kinda found out the cause of the exception I am getting, however
I am still struggling the reason behind the exception.

So DRL_1, this works perfectly fine.
package drools;
import drools.ProposalLight;
import function drools.DateUtil.compareDatesWithTime;
rule "Date Rule"
when
    $obj : ProposalLight(eval(compareDatesWithTime(endDateTime, -2, 6,
\"<\")))
then
    $obj.addFailedRule("Date Rule");
end;

DRL_2, this doesn't work. and throws [Error: unable to resolve method using
strict-mode: myObject.eval(boolean)]  [Near : {...
(eval(compareDatesWithTime(star ....}] ...

package drools;
import drools.ProposalLight;
import function drools.DateUtil.compareDatesWithTime;
rule "Date Rule"
when
    $obj : ProposalLight(*(*eval(compareDatesWithTime(endDateTime, -2, 6,
\"<\"))*)*)
then
    $obj.addFailedRule("Date Rule");
end;

Notice that extra paranthesis around eval(). This is where Drools 5.5
throws exception. Can someone please explain why this extra paranthesis
throws exception and how can I make it work.

Thanks,
Jeetendra.


On Wed, Jun 5, 2013 at 1:27 AM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:

> The error message suggests that you have made a syntactic error in a
> rule which is not the one you have posted, or you have modified the
> rule too much to be of any help. Post again, taking great care not to
> omit anything or to change the cause of the problem. Also, indicate
> precisely the declaration of the function compareDatesWithTime().
>
> -W
>
>
> On 04/06/2013, jeetendray <jeetcyb at gmail.com> wrote:
> > Hi,
> >
> > Snippet of my DRL .
> >
> > rule "Rev: Start Time < 2 Hours in Future"
> >       when
> >               $obj : eval(compareDatesWithTime(startDateTime, -2, 2,
> "<"))
> >       then
> >               $obj.addFailedRule("Rev: Start Time < 2 Hours in Future");
> > end
> >
> > This fails during compilation and throws error:
> >
> > org.drools.rule.InvalidRulePackage: Unable to Analyse Expression
> > (eval(compareDatesWithTime(startDateTime, -2, 2, "<"))  ):
> > [Error: unable to resolve method using strict-mode:
> myObject.eval(boolean)]
> > [Near : {... (eval(compareDatesWithTime(star ....}]
> >              ^
> > [Line: 6, Column: 2] : [Rule name='Proposal - Start time is after
> current +
> > 2 hour']
> >
> >
> > I am using Drools 5.5 and I found the cause that my code runs in strict
> > mode.. so If I set strict mode to false then this would work. Now I am
> not
> > sure how to make it to false.
> >
> > Here's the code I am using:
> >
> > PackageBuilderConfiguration packageBuilderConfiguration = new
> > PackageBuilderConfiguration();
> > PackageBuilder packageBuilder = new
> > PackageBuilder(packageBuilderConfiguration);
> > packageBuilder.addPackageFromDrl(drl.getCharacterStream());
> >
> > Can someone please suggest me how to do that??
> >
> > Thanks!!!
> >
> >
> >
> > --
> > View this message in context:
> >
> http://drools.46999.n3.nabble.com/How-to-set-drools-dialect-mvel-strict-false-tp4024122.html
> > Sent from the Drools: User forum 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130724/ccd29979/attachment.html 


More information about the rules-users mailing list