<br>   Nj,<br><br>   The approach David is suggesting using the descriptors is a higher level approach where anything that is written in DRL language is mapped one-to-one in Descr classes, but as you already realized, Descr classes have most data as non-compiled text. It is simpler, if working with text is ok for you. <br>
<br>   If you want to dig deeper and use compiled stuff, keep in mind that you will be using internal APIs, subject to change. Having said that, the Rule object has a method getLHS() that will return the compiled LHS of a rule. It is a logical tree, with nested objects. You need to walk this tree looking for Pattern objects. Each Pattern object will have an Object Type that is what you are looking for.<br>
<br>   []s<br>   Edson<br>  <br><br><div class="gmail_quote">2009/2/24 nopea joki <span dir="ltr">&lt;<a href="mailto:nopea.joki@gmail.com">nopea.joki@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
David,<br>Thank you for the reply.<br> I checked the PackageDescr and RuleDescr classes, but there seems no direct methods which would return the fact classes used in the rule.<br><br>for instance if we have a rule like:<br>

<br>rule rule1<br>when <br>Person(name = &quot;qq&quot;)<br>Driver(name = &quot;aa&quot;)<br>then ... end<br><br>from this rule, I want to get [Person, Fact].<br>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.<br>

But in the above case, we just get empty list of declarations.<br><br>This kind of information is useful when we need to provide a GUI for given rules.<br><br>Do you have more specific suggestion for this?<br><br>Regards,<br>
<font color="#888888">
nj</font><div><div></div><div class="Wj3C7c"><br><br><br><div class="gmail_quote">On Tue, Feb 24, 2009 at 12:04 PM, David Sinclair <span dir="ltr">&lt;<a href="mailto:dsinclair@chariotsolutions.com" target="_blank">dsinclair@chariotsolutions.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This should probably be in the users list, not dev. All of that information is available in the PackageDesc object. For example,<br><br>DrlParser parser = new DrlParser();<br>InputStreamReader reader = new InputStreamReader( this.getClass().getResourceAsStream( &quot;Misc3.drl&quot; ) );<br>


PackageDescr pkg = parser .parse( reader );<br><br>pkg.getGlobals();<br>pkg.getRules();<br><br>etc.<br><br><div class="gmail_quote"><div><div></div><div>On Mon, Feb 23, 2009 at 9:44 PM, nopea joki <span dir="ltr">&lt;<a href="mailto:nopea.joki@gmail.com" target="_blank">nopea.joki@gmail.com</a>&gt;</span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Hi,<br>I would like to get all the classes used for Facts in the rules from Package like getting global variable information from package.<br>


Is it possible to have such information?<br><br>Regards,<br><font color="#888888">nj<br>
</font><br></div></div>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>