Can you provide your DRL and DSL?
Have you included a reference to "expander" in your DRL?
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of tansey
Sent: 31 October 2007 07:55
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Problem with DSL in Drools 4.0.3
I'm new to Drools, and I've setup the latest version of it in Eclipse 3.2.
I'm having trouble whenever I try to use a DSL though. I took the standard
Hello World example and added the 'mylang.dsl' file, and changed the lines
in DroolsTest.readRule() as follows:
private static RuleBase readRule() throws Exception {
//read in the source
Reader source = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/Sample.drl" ) );
//optionally read in the DSL (if you are using it).
Reader dsl = new InputStreamReader(
DroolsTest.class.getResourceAsStream(
"/mylang.dsl" ) );
//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can
also be used...
PackageBuilder builder = new PackageBuilder();
//this wil parse and compile in one step
//NOTE: There are 2 methods here, the one argument one is
for normal DRL.
//builder.addPackageFromDrl( source );
//Use the following instead of above if you are using a DSL:
builder.addPackageFromDrl( source, dsl );
//get the compiled package (which is serializable)
Package pkg = builder.getPackage();
//add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkg );
return ruleBase;
}
Even if I remove all rules from the dsl file, it still gives me the same
error:
org.drools.rule.InvalidRulePackage:
[4] Unable to expand: m : Message( status == Message.HELLO, message :
message )
[6] Unable to expand: System.out.println( message );
[7] Unable to expand: m.setMessage( "Goodbye cruel world" );
[8] Unable to expand: m.setStatus( Message.GOODBYE );
[9] Unable to expand: update( m );
[5] Unable to expand: m : Message( status == Message.GOODBYE, message :
message )
[7] Unable to expand: System.out.println( message );
[8] Unable to expand: m.setMessage( message );
at org.drools.rule.Package.checkValidity(Package.java:424)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:361)
at com.sample.DroolsTest.readRule(DroolsTest.java:64)
at com.sample.DroolsTest.main(DroolsTest.java:21)
Anyone have an idea of what's wrong?
--
View this message in context:
http://www.nabble.com/Problem-with-DSL-in-Drools-4.0.3-tf4722439.html#a13501
597
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users