[rules-users] Re: [rules-dev] How to get Fact's type from rule package?

David Sinclair dsinclair at chariotsolutions.com
Tue Feb 24 16:53:08 EST 2009


Take a look at the verifier module.

On Tue, Feb 24, 2009 at 4:45 PM, nopea joki <nopea.joki at gmail.com> wrote:

> 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 at 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 at 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 at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090224/ed76d20b/attachment.html 


More information about the rules-users mailing list