Is there a bug with drools when you try to use a dsl and drl?  I've read
several post where people seem to be getting the same errors as I am.
My drl looks like this:

package com.insurance
expander underwriting.dsl

rule "Low Premium"
   when
       There is a policy
        - for a male
        - with a premium less than 50.00
   then
        Accept the policy;
end

I have this code to read the drl and associated dsl and build a package:

  String drl = "/underwriting.drl";
  String dsl = "/underwriting.dsl";
  PackageBuilder builder = new PackageBuilder();

  InputStreamReader drlInput = new
       InputStreamReader(InsuranceExample.class.getResourceAsStream(drl));
  InputStreamReader dslInput = new
       InputStreamReader(InsuranceExample.class.getResourceAsStream(dsl));

  builder.addPackageFromDrl(drlInput, dslInput);

  RuleBase ruleBase = RuleBaseFactory.newRuleBase();
  ruleBase.addPackage( builder.getPackage() );

When I run the code I get a 'ExpanderException'

Exception in thread "main" org.drools.rule.InvalidRulePackage: 
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
                           [EMAIL PROTECTED]
        at org.drools.rule.Package.checkValidity(Package.java:408)
        at org.drools.common.AbstractRuleBase.addPackage
                            (AbstractRuleBase.java:288)

Can someone tell me what I'm doing wrong and what the correct code would
be for reading a drl/dsl and building a package and rulebase?  Does
building drl rules from a dsl not work in drools 4.0.1?

Thanks,
Rod

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to