[rules-users] Similarly Named DSL Rules Not Working

Brian Enderle brianke at gmail.com
Mon Sep 17 14:14:26 EDT 2007


I have the following DSL entries:

County is invalid for State
[condition][]County is invalid for State=eval(StringUtils.isNotBlank
($i.getCntyCd())) and eval(!$i.getCntyCd().substring(0,2).equals($i.getStateCd
()))

POB County is invalid for State
[condition][]POB County is invalid for State=eval(StringUtils.isNotBlank
($i.getPobCntyCd())) and eval(!$i.getPobCntyCd().substring(0,2).equals
($i.getPobStateCd()))

The rule in which I am using the DSL entry is as follows:
rule "LevelOne: Place Of Birth, County is invalid"
   agenda-group "LevelOne"
   when
      There is a NwCitizenship
         - pobCntryCd equals MessageConstants.COUNTRY_CODE_US
      POB County is invalid for State
   then
      <Report error>
end


When I atempt to use the POB County... rule I get the following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'ruleBase' defined in class path resource [spring-beans.xml]: 
Invocation of init method failed; nested exception is 
org.drools.rule.InvalidRulePackage: [143,33]: unknown:143:33 Unexpected 
token '$i'[143,47]: unknown:143:47 mismatched token: 
[@987,4726:4726=')',<12>,143:47]; expecting type THEN
Caused by: org.drools.rule.InvalidRulePackage: [143,33]: unknown:143:33 
Unexpected token '$i'[143,47]: unknown:143:47 mismatched token: 
[@987,4726:4726=')',<12>,143:47]; expecting type THEN
	at org.drools.rule.Package.checkValidity(Package.java:420)
	at org.drools.common.AbstractRuleBase.addPackage
(AbstractRuleBase.java:292)
	at com.sample.RuleBaseBeanFactory.afterPropertiesSet
etc...

However, if I change "POB County" to "POBCounty" (no space, only change the 
DSL call leaving the actual code the same) everything works.  Can someone 
explain why the two rules cannot coexist with the space in "POB County"?

Thanks,
Brian Enderle




More information about the rules-users mailing list