David,
Thank you for the reply.
 I checked the PackageDescr and RuleDescr classes, but there seems no direct methods which would return the fact classes used in the rule.

for instance if we have a rule like:

rule rule1
when
Person(name = "qq")
Driver(name = "aa")
then ... end

from this rule, I want to get [Person, Fact].
In org.drools.rule.Rule class, there is a getDeclaration(), this returns some type information if variable is associated with Fact class, e.g, $p: Person.
But in the above case, we just get empty list of declarations.

This kind of information is useful when we need to provide a GUI for given rules.

Do you have more specific suggestion for this?

Regards,
nj


On Tue, Feb 24, 2009 at 12:04 PM, David Sinclair <dsinclair@chariotsolutions.com> wrote:
This should probably be in the users list, not dev. All of that information is available in the PackageDesc object. For example,

DrlParser parser = new DrlParser();
InputStreamReader reader = new InputStreamReader( this.getClass().getResourceAsStream( "Misc3.drl" ) );
PackageDescr pkg = parser .parse( reader );

pkg.getGlobals();
pkg.getRules();

etc.

On Mon, Feb 23, 2009 at 9:44 PM, nopea joki <nopea.joki@gmail.com> wrote:
Hi,
I would like to get all the classes used for Facts in the rules from Package like getting global variable information from package.
Is it possible to have such information?

Regards,
nj

_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev