[rules-users] how to check if a global has been declared in a rule

Wolfgang Laun wolfgang.laun at gmail.com
Thu Feb 10 01:56:43 EST 2011


KnowledgePackageImp and org.drools.rulePackage are not in the
"stable" part of the API, but this is how:

KnowledgePackage kPackage = ...;
KnowledgePackageImp kPackageImp = (KnowledgePackageImp)kPackage;
org.drools.rule.Package package_ = kPackageImp.pkg;

// globals: key is name, value is type name
Map<String, String> name2global = package_.getGlobals();

I have frequently urged for everything that can be written in DRL to be
accessible though the "stable" API. It can't be "unstable" if it is in the
DRL language, right?

-W


2011/2/9 Michael Anstis <michael.anstis at gmail.com>

> Mark, Edson, (Wolfgang?)
>
> Any public API to ascertain whether a DRL package needs a global to be
> inserted?
>
> E.G. a DRL has global defined within it, the DRL is loaded into a
> KnowledgePackage, can you introspect the package to find out if it contains
> a global, it's datatype and name?
>
> With kind regards,
>
> Mike
>
> On 9 February 2011 17:10, gs76pl <gstasica at pacemetrics.com> wrote:
>
>>
>> yeah,,, thats exactly what i need
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-global-has-been-declared-in-a-rule-tp2459143p2459883.html
>> 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
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110210/9e06c4c1/attachment.html 


More information about the rules-users mailing list