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