<HTML><BODY>
Well the problem with the fields of the fact objects is just the same as the one with the fact types.<br>Let me try to explain.<br>The business objects representing the business abstractions in my project are overlaping with the Fact model.<br>I believe that this is the standard case :). Actually we can ignore the technical particularity that we have a Java<div>fact model and another business application model, because the two model will be mirrored. We can think that</div><div>for each business class there is a fact class for Drools to use :).</div><div>The business classes are complex and consist of many fields. For example the biggest contains ovet 450 fields.</div><div>The most common ones to be used as facts consists of 373 and 314 fields.</div><div>If I identify just the <i>Fact Types </i>then I will need to extract all the information that is available for that fact before</div><div>pass it to Drools, then Instantiate a Java instance to represent the Fact and initialize the instance with the information.</div><div>What I am trying to avoid here is the transfer of that many useless information once again.</div><div>In the most common case I will need 1 to 10 fields per Fact Type. So passing the 300 seems redundant.</div><div><br>Best Regards,</div><div>Milen<br><br>
-------- Original Letter --------
<br>From: Wolfgang Laun wolfgang.laun@gmail.com
<br>About: Re: [rules-users] Is rule introspection available from the Drools
        API?
<br>To: Rules Users List <rules-users@lists.jboss.org>
<br>Sent at: Tuesday, 2014, January7 15:04:21 EET
<br><br>As you describe it, the fields of the fact objects shouldn't matter.<br>
<br>
On 07/01/2014, milen igrachev <<a href="javascript: internSendMess('igrachev@abv.bg')">igrachev@abv.bg</a>> wrote:<br>
> Hello, initially i didn't give more details to keep my question short and<br>
> save time to the ppl that read it. I actually believed that such<br>
> functionality might be covered and available and details would have just<br>
> prolong my question.<br>
> Here is some additional information on why I am looking for such<br>
> functionality. In my project I want to use Drools as external rule engine.<br>
> My project is not written in Java and the effort to transfer it is<br>
> inconsiderable.<br>
<br>
I guess you mean "considerable".<br>
<br>
> What I want to start using Drools for is a simple blackbox<br>
> of getting answers from a Stateless Drools Session, most likely without any<br>
> need of reinference. Simply ask and get answered. During the runtime of my<br>
> project there is a vast amount of information that can be considered as a<br>
> fact . However in most of the cases what I need is to invoke a simple<br>
> ruleset that actually need like 1% of the facts that I currently know at<br>
> any particular moment. So what I want to do is ask Drools "Hey I want to<br>
> invoke ruleset, can you please tell me what are the facts that it is<br>
> using so I can pass all of them, that I currently have?". Then after<br>
> receiving the answer I will filter the 1% from the big picture and will<br>
> finally ask Drools to answer my question.<br>
<br>
If these "rule sets" are unrelated with each other, you might put them into<br>
separater DRL files. Then the import list will tell you which facts this<br>
rule set needs, and so all you need is simple text processing...<br>
<br>
-W<br>
<br>
> What I want to avoid is passing hundreds of instance/facts with hundreds<br>
> of fields that are actually never user. Of course I realise that the rule<br>
> introspection that I am asking for is not my only option, I can create the<br>
> .drl metadata during the ruleset definition. Some more ideas poped into my<br>
> head, so far, but the best solution for me seems to be if we can just call<br>
> 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<br>
> metadata from Drools. At first I thought it could be available in a snap of<br>
> a finger with some method calls, however now I am interested to see what is<br>
> the effort to make it happen.<br>
> Hope it helps. Thanks for the support.<br>
> Best Regards, Milen<br>
><br>
><br>
><br>
><br>
><br>
><br>
> -------- Original Letter --------<br>
><br>
> From: Stephen Masters <a href="javascript: internSendMess('stephen.masters@me.com')">stephen.masters@me.com</a><br>
><br>
> About: Re: [rules-users] Is rule introspection available from the<br>
>         Drools        API?<br>
><br>
> To: Drools List<br>
><br>
> Sent at: Tuesday, 2014, January 7 12:08:39 EET<br>
><br>
><br>
><br>
><br>
><br>
><br>
> It may also be worth explaining exactly what you aim to achieve through<br>
> this and why. From what I have seen, most people who ask about introspecting<br>
> the LHS of rules via the API, don’t actually need to do that.<br>
><br>
><br>
><br>
><br>
><br>
><br>
> Steve<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On 7 Jan 2014, at 08:56, Wolfgang Laun <<br>
> <a href="javascript: internSendMess('wolfgang.laun@gmail.com')">wolfgang.laun@gmail.com</a> > wrote:<br>
><br>
><br>
><br>
><br>
> Hi,<br>
><br>
><br>
><br>
> while you continue this line of research you might consider possible<br>
><br>
> ramifications and snags, and be prepared for them.<br>
><br>
><br>
><br>
> The syntax for writing LHS conditions is quite complex - it's more<br>
><br>
> complex than Java expressions, because the CE eval() alone will give<br>
><br>
> you (almost) all of that. Rule authors may also use DRL functions,<br>
><br>
> which could hide field access.<br>
><br>
><br>
><br>
> If *you* author the rules, you may be able to avoid the worst, but it<br>
><br>
> won't be a piece of cake.<br>
><br>
><br>
><br>
> Cheers<br>
><br>
> -W<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On 07/01/2014, milen igrachev <<br>
> <a href="javascript: internSendMess('igrachev@abv.bg')">igrachev@abv.bg</a> > wrote:<br>
><br>
><br>
><br>
> Hello thanks for the quick and precise answer!<br>
><br>
><br>
> I believe that the time difference will be a bit of a problem for the IRC<br>
><br>
> chat , but i will be online (channel: #drools user: igrachev) today and<br>
> will<br>
><br>
> try to check it often.<br>
> However big thanks for the support and the<br>
><br>
> willingness to help!<br>
><br>
><br>
> You are saying that the code is there, but is not public and documented.<br>
><br>
> Well being not public seems to be a problem, but do you<br>
> think it is<br>
><br>
> possible to give me an example with the official Drools "first rule" -<br>
><br>
> Sample.drl. The one that comes with the first Drools project.<br>
> So do you<br>
><br>
> believe it will be possible to paste me some code on how to retrieve the<br>
><br>
> information that this ruleset is using one fact of type Message<br>
> and two of<br>
><br>
> it's attributes -<br>
> status<br>
> and<br>
> message.<br>
> So just some code in a public<br>
><br>
> static void main (String [] args) will be great :), or any kind of<br>
><br>
> explanation :).<br>
><br>
><br>
> Once again thank you.<br>
><br>
><br>
> Have a nice day,<br>
><br>
> Milen<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> ----Original Letter----<br>
><br>
> From: Mark Proctor<br>
> <a href="javascript: internSendMess('mproctor@codehaus.org')">mproctor@codehaus.org</a><br>
><br>
><br>
><br>
> About: Re: [rules-users] Is rule introspection available from the Drools<br>
><br>
><br>
> API?<br>
><br>
><br>
><br>
> To: Rules Users List<br>
><br>
><br>
><br>
> Sent at: Monday, 2014, January 6 16:05:33 EET<br>
><br>
><br>
><br>
><br>
><br>
> The code is there, but it’s not public and not documented, and the code can<br>
><br>
> be a little hard to understand - as it’s grown organically over the years.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> You’ll need to cast and unwrap and look at member vars. Start on the Rule<br>
><br>
> and the lhs variable. You can always pop onto irc, with live questions,and<br>
><br>
> we’ll try and respond quickly.<br>
><br>
><br>
><br>
><br>
> <a href="http://www.jboss.org/drools/irc" target="_blank">http://www.jboss.org/drools/irc</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Mark<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On 6 Jan 2014, at 09:51, milen igrachev<br>
><br>
> <a href="javascript: internSendMess('igrachev@abv.bg')">igrachev@abv.bg</a><br>
><br>
> > wrote:<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Hello,<br>
><br>
><br>
><br>
><br>
><br>
><br>
> is there a way to introspect a Drools file from within java code?<br>
><br>
><br>
><br>
><br>
><br>
><br>
> What I need is to be able to identify the facts and the fact<br>
> attributes<br>
><br>
> that are used in a given DRL file.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> For example if I have a rule stored in a customer.drl DRL file within<br>
> my<br>
><br>
> project, containing the following definition:<br>
><br>
><br>
><br>
><br>
><br>
><br>
> package myRulePackage<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> import org.rules.model.Customer<br>
><br>
><br>
><br>
><br>
><br>
><br>
> import org.rules.model.Mambership<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> rule "is eligible customer"<br>
><br>
><br>
><br>
><br>
><br>
><br>
> when<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> $c:Customer(status == "active")<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Membership(customer == $c, type == "premium")<br>
><br>
><br>
><br>
><br>
><br>
><br>
> then<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> $c.setEligibilityStatus(true);<br>
><br>
><br>
><br>
><br>
><br>
><br>
> end<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> What i need is a way to understand that this ruleset customer.drl is<br>
> using<br>
><br>
> two fact types - Customer and Membership and three of their attributes -<br>
><br>
> Customer.status, Membership.customer and Membership.type.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> I found some information on the internet that such functionality is<br>
> not<br>
><br>
> supported, however the information was a bit too old, so I decided to ask<br>
><br>
> again.<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Big thanks for the support!<br>
><br>
><br>
><br>
><br>
><br>
><br>
> Milen<br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
><br>
><br>
><br>
><br>
><br>
><br>
> rules-users mailing list<br>
><br>
><br>
><br>
><br>
><br>
><br>
> <a href="javascript: internSendMess('rules-users@lists.jboss.org')">rules-users@lists.jboss.org</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
><br>
><br>
><br>
> rules-users mailing list<br>
><br>
><br>
><br>
><br>
> <a href="javascript: internSendMess('rules-users@lists.jboss.org')">rules-users@lists.jboss.org</a><br>
><br>
><br>
><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
><br>
> rules-users mailing list<br>
><br>
><br>
> <a href="javascript: internSendMess('rules-users@lists.jboss.org')">rules-users@lists.jboss.org</a><br>
><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="javascript: internSendMess('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>
</div></BODY></HTML>