[rules-users] xdrl, null and nested properties

Veit Guna veit.guna at gmx.de
Fri Oct 15 06:38:09 EDT 2010


Hi.

I'm using Drools 5.1.0 along with .xdrl files. Now I have the problem
with the following sippet:

--cut here--
<dro:and-conditional-element>
   <dro:pattern object-type="TaskResults">
        <dro:field-constraint field-name="lastResult">
           <dro:literal-restriction evaluator="!=" value="null"/>
        </dro:field-constraint>
        <dro:field-constraint
field-name="lastResult.returnValues[&quot;ReturnKey&quot;]">
         <dro:literal-restriction evaluator="==" value="returnvalue"/>
        </dro:field-constraint>
   </dro:pattern>
</dro:and-conditional-element>
--cut here--

It compiles just fine, but when executed it fails with:

Caused by: org.drools.RuntimeDroolsException: Exception executing
predicate lastResult.returnValues["ReturnKey"] == "returnvalue"
Caused by: [Error: unable to access property (null parent): returnValues]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
	at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:886)


It seems that the second field constraint is also evaluated, although
the first should already return "false". Are there no short-circuits
within pattern constraints? How would I express that best in xdrl
conform manner? Use eval?

Thanks
Veit



More information about the rules-users mailing list