[rules-users] problems with decition tables

Vanina Beraudo vaninaberaudo at gmail.com
Wed Jul 23 15:13:02 EDT 2008


Hi,

I am working with decition tables, I have differents xls files with
rules and I want to add multiple xls files to the same rulebase and
they will be merged into a single package.
I do the following:


private static RuleBase readTablaDecision() throws Exception {
		//read in the source
        final SpreadsheetCompiler converter = new SpreadsheetCompiler();
        final String drl = converter.compile( "/reglaPrincipal.xls",
InputType.XLS );
		PackageBuilder builder = new PackageBuilder();
		builder.addPackageFromDrl( new StringReader( drl ) );
		
		final String drl2, drl3;
		if((dj.getVersion()!=null)&&(dj.getVersion().compareTo("Version 1")==0)){
			drl2 = converter.compile( "/reglaVersion1.xls", InputType.XLS );
			builder.addPackageFromDrl( new StringReader( drl2 ) );
		}
	
		Package pkg = builder.getPackage();
		RuleBase ruleBase = RuleBaseFactory.newRuleBase();
		ruleBase.addPackage( pkg );
		return ruleBase;
	}

When I run the program, the following error message appear:

org.drools.compiler.PackageBuilder$PackageMergeException: Can't merge
packages with different names. This package: com.ReglaPrincipal - New
package: com.reglaVersion1
	at org.drools.compiler.PackageBuilder.validatePackageName(PackageBuilder.java:325)
	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:236)
	at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)


Can I work with severals xls files?

-- 
Lic. Vanina Beraudo



More information about the rules-users mailing list