[rules-users] Problem with DSL in Drools 4.0.3

Anstis, Michael (M.) manstis1 at ford.com
Wed Oct 31 04:52:46 EDT 2007


Can you provide your DRL and DSL?

Have you included a reference to "expander" in your DRL?

-----Original Message-----
From: rules-users-bounces at lists.jboss.org
[mailto:rules-users-bounces at lists.jboss.org] On Behalf Of tansey
Sent: 31 October 2007 07:55
To: rules-users at 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 at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4159 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20071031/9d4a089e/attachment.bin 


More information about the rules-users mailing list