<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>It may also be worth explaining exactly what you aim to achieve through this and why. From what I have seen, most people who ask about introspecting the LHS of rules via the API, don’t actually need to do that.</div><div><br></div><div>Steve</div><div><br></div><br><div><div>On 7 Jan 2014, at 08:56, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hi,<br><br>while you continue this line of research you might consider possible<br>ramifications and snags, and be prepared for them.<br><br>The syntax for writing LHS conditions is quite complex - it's more<br>complex than Java expressions, because the CE eval() alone will give<br>you (almost) all of that. Rule authors may also use DRL functions,<br>which could hide field access.<br><br>If *you* author the rules, you may be able to avoid the worst, but it<br>won't be a piece of cake.<br><br>Cheers<br>-W<br><br><br><br>On 07/01/2014, milen igrachev &lt;<a href="mailto:igrachev@abv.bg">igrachev@abv.bg</a>&gt; wrote:<br><blockquote type="cite">Hello thanks for the quick and precise answer!<br>&nbsp;I believe that the time difference will be a bit of a problem for the IRC<br>chat , but i will be online (channel: #drools user: igrachev) today and will<br>try to check it often. &nbsp;However big thanks for the support and the<br>willingness to help!<br>&nbsp;You are saying that the code is there, but is not public and documented.<br>Well being not public seems to be a problem, but do you &nbsp;think it is<br>possible to give me an example with the official Drools "first rule" -<br>Sample.drl. The one that comes with the first Drools project. &nbsp;So do you<br>believe it will be possible to paste me some code on how to retrieve the<br>information that this ruleset is using one fact of type Message &nbsp;and two of<br>it's attributes - &nbsp;status &nbsp;and &nbsp;message. &nbsp;So just some code in a public<br>static void main (String [] args) will be great :), or any kind of<br>explanation :).<br>&nbsp;Once again thank you.<br>&nbsp;Have a nice day,<br>Milen<br><br><br><br>----Original Letter----<br>From: Mark Proctor <a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a><br><br>About: Re: [rules-users] Is rule introspection available from the Drools<br><span class="Apple-tab-span" style="white-space: pre;">        </span>API?<br><br>To: Rules Users List<br><br>Sent at: Monday, 2014, January 6 16:05:33 EET<br><br><br>The code is there, but it’s not public and not documented, and the code can<br>be a little hard to understand - as it’s grown organically over the years.<br><br><br><br>You’ll need to cast and unwrap and look at member vars. Start on the Rule<br>and the lhs variable. You can always pop onto irc, with live questions,and<br>we’ll try and respond quickly.<br><br><a href="http://www.jboss.org/drools/irc">http://www.jboss.org/drools/irc</a><br><br><br><br>Mark<br><br><br><br>On 6 Jan 2014, at 09:51, milen igrachev &nbsp;<a href="mailto:igrachev@abv.bg">igrachev@abv.bg</a><span class="Apple-converted-space">&nbsp;</span>&gt; wrote:<br><br><br><br><blockquote type="cite">Hello,<br></blockquote><br><blockquote type="cite">is there a way to introspect a Drools file from within java code?<br></blockquote><br><blockquote type="cite">What I need is to be able to identify the facts and the fact attributes<br>that are used in a given DRL file.<br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite">For example if I have a rule stored in a customer.drl DRL file within my<br>project, containing the following definition:<br></blockquote><br><blockquote type="cite">package myRulePackage<br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite">import org.rules.model.Customer<br></blockquote><br><blockquote type="cite">import org.rules.model.Mambership<br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite">rule "is eligible customer"<br></blockquote><br><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">        </span>when<br></blockquote><br><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>$c:Customer(status == "active")<br></blockquote><br><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>Membership(customer == $c, type == "premium")<br></blockquote><br><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">        </span>then<br></blockquote><br><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">        </span>$c.setEligibilityStatus(true);<br></blockquote><br><blockquote type="cite">end<br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite">What i need is a way to understand that this ruleset customer.drl is using<br>two fact types - Customer and Membership and three of their attributes -<br>Customer.status, Membership.customer and Membership.type.<br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite">I found some information on the internet that such functionality is not<br>supported, however the information was a bit too old, so I decided to ask<br>again.<br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite"><br></blockquote><br><blockquote type="cite">Big thanks for the support!<br></blockquote><br><blockquote type="cite">Milen<br></blockquote><br><blockquote type="cite">_______________________________________________<br></blockquote><br><blockquote type="cite">rules-users mailing list<br></blockquote><br><blockquote type="cite"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br></blockquote><br><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote><br><br><br><br><br>_______________________________________________<br><br>rules-users mailing list<br><br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><br>https://lists.jboss.org/mailman/listinfo/rules-users<br><br><br></blockquote><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users</div></blockquote></div><br></body></html>