I don't know what sum( $person ) means, :) but nested accessors
definitively should work:
Number () from accumulate (
$person : Person(
age > 18,
dog.weight > 50
),
sum($person)
)
In Cristine's case, a NPE is being raised:
Caused by: java.lang.NullPointerException
Did you guys tried 4.0.7, that is about to be released? Does the error
still happens there?
[]s
Edson
2008/4/25 Chris Woodrow <woodrow.chris(a)gmail.com>:
Hi,
I found out I had this king of errors when I was using nested accessors
like :
Number () from accumulate (
$person : Person(
age > 18,
dog.weight > 50
),
sum($person)
)
I found I could get rid of these this way :
Number () from accumulate (
$person : Person(
age > 18
)&& eval($person.getDog().getWeight()>50),
sum($person)
)
I guess it is not optimized at all, but at least it does not raise strange
exception.
Chris
2008/4/25 Christine <christine(a)christine.nl>:
Hi,
> does anyone know what this error means?
> It happens when I put an enum constant in a rule. I use the same enum
> constant in another part of the same rule with no problem.
>
> Christine
>
> org.drools.RuntimeDroolsException: Exception executing predicate
> org.drools.base.mvel.MVELPredicateExpression@125844f
> at
>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:132)
> at
>
>
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
> at
> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
> at org.drools.reteoo.Rete.assertObject(Rete.java:175)
> at
> org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
> at
>
> org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
> at
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:909)
> at
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:881)
> at
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:682)
> at
>
> nl.ing.towardsdeepdrive.rules.SalesRules.assertCompetitorProduct(SalesRules.java:42)
> at rules.SalesRulesTest.TestRules(SalesRulesTest.java:53)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
>
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
> at
>
> org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
> at
> org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
> at
>
>
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
> at
> org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
> at
> org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
> at
>
>
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
> at
>
> org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
> at
>
> org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
> at
> org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
> at
> org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
> at
>
> org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
> at
>
>
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
> at
>
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
>
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at
>
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at
>
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at
>
>
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Caused by: org.mvel.CompileException: cannot invoke getter: getType
> [declr.class: nl.ing.towardsdeepdrive.data.model.Product; act.class: null]
> at
>
> org.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:52)
> at
>
> org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39)
> at
>
>
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode.java:22)
> at
>
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:21)
> at
>
> org.mvel.ast.BinaryOperation.getReducedValueAccelerated(BinaryOperation.java:21)
> at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
> at
> org.mvel.CompiledExpression.getValue(CompiledExpression.java:111)
> at org.mvel.MVEL.executeExpression(MVEL.java:235)
> at
>
>
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:36)
> at
>
> org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:210)
> ... 33 more
> Caused by: java.lang.NullPointerException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
>
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
>
> org.mvel.optimizers.impl.refl.GetterAccessor.getValue(GetterAccessor.java:42)
> ... 42 more
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com