[rules-users] Similarly Named DSL Rules Not Working

Edson Tirelli tirelli at post.com
Mon Sep 17 15:10:37 EDT 2007


    Brian, the order of the mappings is important, because DSL is a "text
match" engine. So, always write your DSL Mapping file having the most
restrictive mappings first.

    []s
    Edson


2007/9/17, Brian Enderle <brianke at gmail.com>:
>
> 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
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070917/8c0cd69b/attachment.html 


More information about the rules-users mailing list