I use mvel 1.3.9, so the latest 1.3.x version. Is there a way to upgrade to mvel 2.x with drools 4.0.7 ? Or will I have to wait for drools 5.0.0 ?
2008/12/15 Edson Tirelli <[email protected]>: > > BTW, what version of MVEL are you using? > > 2008/12/15 Olivier THIERRY <[email protected]> >> >> Well ... I found something very strange with Drools and mvel dialect >> ... It looks like Drools doesn't like points in function parameters ! >> >> I made this very simple test with a log function and the easier rule >> you can have : >> >> function void log (String message) { >> System.out.println(message); >> } >> >> rule "test" >> no-loop >> when >> eval(true) >> then >> log("hello world") >> end >> >> log("hello world") works ok >> log("hello.world") (note the point) fails with this stack trace : >> >> org.drools.spi.ConsequenceException: >> org.mvel.UnresolveablePropertyException: unable to resolve token: >> log("hello.world") >> at >> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13) >> at >> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558) >> at >> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518) >> at >> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475) >> at >> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439) >> at t4.test.drools.TestRuleBase.executeRule(TestRuleBase.java:44) >> at t4.test.drools.Test1.testDebug(Test1.java:57) >> Caused by: org.mvel.UnresolveablePropertyException: unable to resolve >> token: log("hello.world") >> at >> org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129) >> at >> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24) >> at org.mvel.MVELRuntime.execute(MVELRuntime.java:90) >> at >> org.mvel.CompiledExpression.getValue(CompiledExpression.java:111) >> at org.mvel.MVEL.executeExpression(MVEL.java:235) >> at >> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48) >> at >> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554) >> ... 34 more >> >> It looks like there is a problem with point character, doesn't it ? Is >> it a known problem ? >> >> Regards, >> >> Olivier >> >> >> 2008/12/15 Olivier THIERRY <[email protected]>: >> > Thanks Edson. Here it is : >> > >> > rule "CALCUL_RELICAT_CP" >> > salience 8 >> > no-loop >> > when >> > not $RELICAT_CP : VOCounter (code=="RELICAT_CP") >> > $startDate : RuleDate(name=="startDate") >> > $endDate : RuleDate(name=="endDate") >> > $SOLDE_CP_CUM : VOCounter ( code=="SOLDE_CP_CUM", >> > startDate.year == ($startDate.year - 1) ) >> > then >> > VOCounter $relicat = >> > createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value); >> > insert($relicat); >> > >> > insert(createCounter(drools,"SOLDE_RELICAT_CP",$SOLDE_CP_CUM.value)); >> > end >> > >> > I thought about trying with a newer version of mvel, but it doesn't >> > look so easy to upgrade it :( >> > >> > 2008/12/15 Edson Tirelli <[email protected]>: >> >> >> >> Can you plz show us the DRL instead of the DSLR for your rule? use >> >> the >> >> DRLViewer tab for that... >> >> >> >> 2008/12/15 Olivier THIERRY <[email protected]> >> >>> >> >>> Hi, >> >>> >> >>> I use drools 4.0.7 and I encounter a problem calling a function from a >> >>> rule written for mvel dialect. >> >>> >> >>> The function I need to call has this signature : >> >>> >> >>> function VOCounter createCounter(org.drools.spi.KnowledgeHelper >> >>> drools, String code, Number number) >> >>> >> >>> When I call this function, I want to assign result to a variable, for >> >>> example to insert it to working memory later, or just to use it in >> >>> another function call. >> >>> So I wrote something like that (I am writing a DSL so part of the code >> >>> is >> >>> DSL ): >> >>> >> >>> rule "CALCUL_RELICAT_CP" >> >>> salience 8 >> >>> no-loop >> >>> when >> >>> not There is a counter called "RELICAT_CP" >> >>> There is a date called "startDate" >> >>> There is a date called "endDate" >> >>> There is a counter called "SOLDE_CP_CUM" with >> >>> - start date is last year >> >>> then >> >>> > VOCounter $relicat = >> >>> > createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value); >> >>> > insert($relicat); >> >>> Copy counter $SOLDE_CP_CUM to SOLDE_RELICAT_CP >> >>> end >> >>> >> >>> But I have the following stack trace : >> >>> >> >>> org.drools.spi.ConsequenceException: >> >>> org.mvel.UnresolveablePropertyException: unable to resolve token: >> >>> createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value) >> >>> at >> >>> >> >>> org.drools.base.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:13) >> >>> at >> >>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:558) >> >>> at >> >>> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:518) >> >>> at >> >>> >> >>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:475) >> >>> at >> >>> >> >>> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:439) >> >>> at >> >>> >> >>> fr.horoquartz.t4.test.drools.TestRuleBase.executeRuleWithDsl(TestRuleBase.java:120) >> >>> at fr.horoquartz.t4.test.drools.Test1.testDsl(Test1.java:39) >> >>> Caused by: org.mvel.UnresolveablePropertyException: unable to resolve >> >>> token: createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value) >> >>> at >> >>> >> >>> org.mvel.ast.PropertyASTNode.initializePropertyNode(PropertyASTNode.java:129) >> >>> at >> >>> >> >>> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:24) >> >>> at >> >>> org.mvel.ExecutableAccessor.getValue(ExecutableAccessor.java:45) >> >>> at >> >>> >> >>> org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43) >> >>> at org.mvel.MVELRuntime.execute(MVELRuntime.java:90) >> >>> at >> >>> org.mvel.CompiledExpression.getValue(CompiledExpression.java:111) >> >>> at org.mvel.MVEL.executeExpression(MVEL.java:235) >> >>> at >> >>> org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:48) >> >>> at >> >>> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:554) >> >>> ... 34 more >> >>> >> >>> What is strange is that it works if I don't assign function call >> >>> result to a variable. For example the following works : >> >>> >> >>> insert (createCounter(drools,"RELICAT_CP",$SOLDE_CP_CUM.value)); >> >>> >> >>> It also works if I assign $SOLDE_CP_CUM.value to a temporary variable >> >>> and use it for function call : >> >>> >> >>> Number $val = $SOLDE_CP_CUM.value; >> >>> VOCounter $relicat = createCounter(drools,"RELICAT_CP",$val); >> >>> insert($relicat); >> >>> >> >>> I had not this problem using java dialect. I understand nothing in >> >>> what happens ... Anyone has an idea what the problem is ? >> >>> >> >>> Thanks in advance, >> >>> >> >>> Olivier >> >>> _______________________________________________ >> >>> rules-users mailing list >> >>> [email protected] >> >>> https://lists.jboss.org/mailman/listinfo/rules-users >> >> >> >> >> >> >> >> -- >> >> Edson Tirelli >> >> JBoss Drools Core Development >> >> JBoss, a division of Red Hat @ www.jboss.com >> >> >> >> _______________________________________________ >> >> rules-users mailing list >> >> [email protected] >> >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> >> >> >> > >> > >> > >> > -- >> > Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et >> > encore pour l'univers, je ne suis pas sûr … (Einstein) >> > >> >> >> >> -- >> Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et >> encore pour l'univers, je ne suis pas sûr … (Einstein) >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users > > > > -- > Edson Tirelli > JBoss Drools Core Development > JBoss, a division of Red Hat @ www.jboss.com > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > > -- Seules 2 choses sont infinies : l'univers et la bêtise humaine ; et encore pour l'univers, je ne suis pas sûr … (Einstein) _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
