[rules-dev] Import of declared type in other drools resources

stanka stanska at gmail.com
Tue Dec 14 07:23:02 EST 2010


Here are more details:

I have one drools resource Person.drl with the following content:

package testpkg

declare Person
	name : String
end

And another file PersonRules.drl in the same dir with the following content:
package testpkg


rule "Your First Rule"
	
	when
		Person(name == "Bobi")
	then 
		System.out.println("hi bobi");
		
end

1)Drools builder shows an error(Unable to resolve ObjectType person) on line 
		Person(name == "Bobi")
Is there a way to workarround the problem?
2)I construct the knowledgebase using
http://grepcode.com/file/repository.jboss.com/maven2/org.drools/drools-ant/5.1.0.M1/org/drools/contrib/DroolsCompilerAntTask.java#DroolsCompilerAntTask.execute%28%29
and  bintype=PACKAGEBINTYPE= "knowledge" and binformat:PACKAGEBINFORMAT !=
package.
When I use PeronRules for name of the drools rules resource, the
knowledgebase is built, but if I rename the file from PeronRules to
1PeronRules I get the following error:
Unable to resolve ObjectType 'Person' : [Rule name='Your First Rule'] 

The problem with the order is, sometimes the rules filename may be loaded
after the type declaration which seems to be a problem, how can I deal with
this?

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Import-of-declared-type-in-other-drools-resources-tp2078644p2085157.html
Sent from the Drools - Dev mailing list archive at Nabble.com.


More information about the rules-dev mailing list