[rules-users] BuildError: Unable to Analyse Expression var == "a"

Wolfgang Laun wolfgang.laun at gmail.com
Fri Oct 11 06:36:04 EDT 2013


There is quite a list of identifiers that cause surprising syntax errors,
all resulting from MVEL keywords:
   var, with, def, assert, strsim, isdef,...
Several more, I'm sure.

-W

On 11/10/2013, richie <haoruiqian at gmail.com> wrote:
> Why var can not be used in the when clause? I tried to use it in then
> clause
> such as modify ($d) {var = "d"}; it just worked well.
>
> Is var a keyword in drools or mvel? I didn't find it anywhere both in
> drools
> export doc and mvel guide.
>
> Following is the content of my drl file:
>
> package test
>
> declare Dd
> @propertyReactive
> var : String
> age : Integer
> end
>
> rule "Rule A"
> dialect "mvel"
> salience 0
> no-loop
> when
> $d:Dd(var == "a")
> then
> modify ($d) {age = 3};
> end
>
> In the eclipse editor, it just shows an error marker before line $d:Dd(var
> == "a"):
> BuildError: Unable to Analyse Expression var == "a":
> [Error: unexpected end of statement]
> [Near : {... var == "a" ....}]
>                  ^
> [Line: 14, Column: 0]
>
> And when invoke the rule, it just threw following exception:
> java.lang.RuntimeException: Error while creating KieBase[Message [id=1,
> level=ERROR, path=rules/Sample.drl, line=14, column=0
>    text=Unable to Analyse Expression var == "a":
> [Error: unexpected end of statement]
> [Near : {... var == "a" ....}]
>                  ^
> [Line: 14, Column: 0]]]
> 	at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:176)
> 	at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:315)
> 	at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:290)
> 	at com.sample.DroolsTest.main(DroolsTest.java:18)
>
>
> I really appreciate any help you can provide.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/BuildError-Unable-to-Analyse-Expression-var-a-tp4026331.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
>


More information about the rules-users mailing list