[rules-users] xdrl, and-constraint-connective and from

Veit Guna veit.guna at gmx.de
Tue Oct 26 07:51:30 EDT 2010


Hi.

We're using Drools 5.1.0 together with the xdrl format.

Now we encounter a problem with the <from> element.
We're using it like so:

--cut here--
<dro:and-conditional-element>
 <dro:pattern object-type="EMail" identifier="fctv_17263"/>
 <dro:pattern object-type="String">
  <dro:field-constraint field-name="this">
     <dro:literal-restriction evaluator="==" value="true"/>
  </dro:field-constraint>
  <dro:from>
     <dro:expression>fctv_17263.getHeaderValues("X-My-Header");
     </dro:expression>
  </dro:from>
 </dro:pattern>
</dro:and-conditional-element>
--cut here--

Now we simply added an additional field-constraint within an
and-constraint-connective (for a not null check):

--cut here--
<dro:and-conditional-element>
 <dro:pattern object-type="EMail" identifier="fctv_17263"/>
 <dro:pattern object-type="String">
  <dro:and-constraint-connective>
    <dro:field-constraint field-name="this">
      <dro:literal-restriction evaluator="!=" value="null"/>
    </dro:field-constraint>
    <dro:field-constraint field-name="this.toLowerCase">
      <dro:literal-restriction evaluator="==" value="true"/>
    </dro:field-constraint>
  </dro:and-constraint-connective>
  <dro:from>
     <dro:expression>fctv_17263.getHeaderValues("X-My-Header");
     </dro:expression>
  </dro:from>
 </dro:pattern>
</dro:and-conditional-element>
--cut here--

But that dies with a:

java.lang.RuntimeException: org.drools.compiler.DroolsParserException:
org.xml.sax.SAXParseException: <from> is after an invalid element:
org.drools.xml.Handler
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:545)
	at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
...
...
Caused by: org.drools.compiler.DroolsParserException:
org.xml.sax.SAXParseException: <from> is after an invalid element:
org.drools.xml.Handler
	at
org.drools.compiler.PackageBuilder.addPackageFromXml(PackageBuilder.java:304)
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
	... 77 more



As I'm writing this, I encountered this is related to this:

https://jira.jboss.org/browse/JBRULES-2672

I added an updated patch that worksforme to the JIRA.

Maybe someone of the Drools team can verify it?

BTW: all drools-compiler testcases seem to work (5.1.1) after applying
the patch.

Thanks
Veit



More information about the rules-users mailing list