<HTML><BODY>
<div>Hello,</div><div>initially i didn't give more details to keep my question short and save time to the ppl that read it.</div><div>I actually believed that such functionality might be covered and available and details would have just prolong my question.</div><div><br></div><div>Here is some additional information on why I am looking for such functionality.</div><div>In my project I want to use Drools as external rule engine. My project is not written in Java and the effort to transfer it is</div><div>inconsiderable. What I want to start using Drools for is a simple blackbox of getting answers from a Stateless Drools</div><div>Session, most likely without any need of reinference. Simply ask and get answered.</div><div>During the runtime of my project there is a vast amount of information that can be considered as a <i>fact</i>. However in</div><div>most of the cases what I need is to invoke a simple ruleset that actually need like 1% of the <i>facts </i>that I currently know</div><div>at any particular moment. So what I want to do is ask Drools "Hey I want to invoke &lt;name&gt; ruleset, can you please tell</div><div>me what are the facts that it is using so I can pass all of them, that I currently have?". Then after receiving the answer I will</div><div>filter the 1% from the big picture and will finally ask Drools to answer my question.</div><div>What I want to avoid is passing hundreds of instance/facts with hundreds of fields that are actually never user.</div><div>Of course I realise that the rule introspection that I am asking for is not my only option, I can create the .drl metadata during</div><div>the ruleset definition. Some more ideas poped into my head, so far, but the best solution for me seems to be if we can just call</div><div>Drools about that information and it return it as a straight answer.<br><br>That is why I am trying to identify if it is possible to recive the rule metadata from Drools. At first I thought it could be available in</div><div>a snap of a finger with some method calls, however now I am interested to see what is the effort to make it happen.</div><div><br></div><div>Hope it helps. Thanks for the support.</div><div><br></div><div>Best Regards,</div><div>Milen</div><div><br><br>




 -------- Original Letter --------
<br>From: Stephen Masters stephen.masters@me.com
<br>About: Re: [rules-users] Is rule introspection available from the
        Drools        API?
<br>To: Drools List &lt;rules-users@lists.jboss.org&gt;
<br>Sent at: Tuesday, 2014, January 7 12:08:39 EET
<br><br>
 
 
  <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="javascript: internSendMess('wolfgang.laun@gmail.com')">wolfgang.laun@gmail.com</a>&gt; wrote:
   </div>
   <br class="Apple-interchange-newline">
   <blockquote>
    <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="javascript: internSendMess('igrachev@abv.bg')">igrachev@abv.bg</a>&gt; wrote:
     <br>
     <blockquote>
      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="javascript: internSendMess('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" target="_blank">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="javascript: internSendMess('igrachev@abv.bg')">igrachev@abv.bg</a>
      <span class="Apple-converted-space">&nbsp;</span>&gt; wrote:
      <br>
      <br>
      <br>
      <br>
      <blockquote>
       Hello,
       <br>
      </blockquote>
      <br>
      <blockquote>
       is there a way to introspect a Drools file from within java code?
       <br>
      </blockquote>
      <br>
      <blockquote>
       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>
       <br>
      </blockquote>
      <br>
      <blockquote>
       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>
       package myRulePackage
       <br>
      </blockquote>
      <br>
      <blockquote>
       <br>
      </blockquote>
      <br>
      <blockquote>
       import org.rules.model.Customer
       <br>
      </blockquote>
      <br>
      <blockquote>
       import org.rules.model.Mambership
       <br>
      </blockquote>
      <br>
      <blockquote>
       <br>
      </blockquote>
      <br>
      <blockquote>
       rule "is eligible customer"
       <br>
      </blockquote>
      <br>
      <blockquote>
       <span class="Apple-tab-span" style="white-space: pre"> </span>when
       <br>
      </blockquote>
      <br>
      <blockquote>
       <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>
       <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>
       <span class="Apple-tab-span" style="white-space: pre"> </span>then
       <br>
      </blockquote>
      <br>
      <blockquote>
       <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>
       end
       <br>
      </blockquote>
      <br>
      <blockquote>
       <br>
      </blockquote>
      <br>
      <blockquote>
       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>
       <br>
      </blockquote>
      <br>
      <blockquote>
       <br>
      </blockquote>
      <br>
      <blockquote>
       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>
       <br>
      </blockquote>
      <br>
      <blockquote>
       <br>
      </blockquote>
      <br>
      <blockquote>
       Big thanks for the support!
       <br>
      </blockquote>
      <br>
      <blockquote>
       Milen
       <br>
      </blockquote>
      <br>
      <blockquote>
       _______________________________________________
       <br>
      </blockquote>
      <br>
      <blockquote>
       rules-users mailing list
       <br>
      </blockquote>
      <br>
      <blockquote>
       <a href="javascript: internSendMess('rules-users@lists.jboss.org')">rules-users@lists.jboss.org</a>
       <br>
      </blockquote>
      <br>
      <blockquote>
       <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">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="javascript: internSendMess('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="javascript: internSendMess('rules-users@lists.jboss.org')">rules-users@lists.jboss.org</a>
     <br>https://lists.jboss.org/mailman/listinfo/rules-users
    </div>
   </blockquote>
  </div>
  <br>
 
</div></BODY></HTML>