Hello,
initially i didn't give more details to keep my question short and save time to the ppl that read it.
I actually believed that such functionality might be covered and available and details would have just prolong my question.

Here is some additional information on why I am looking for such functionality.
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
inconsiderable. What I want to start using Drools for is a simple blackbox of getting answers from a Stateless Drools
Session, most likely without any need of reinference. Simply ask and get answered.
During the runtime of my project there is a vast amount of information that can be considered as a fact. However in
most of the cases what I need is to invoke a simple ruleset that actually need like 1% of the facts that I currently know
at any particular moment. So what I want to do is ask Drools "Hey I want to invoke <name> ruleset, can you please tell
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
filter the 1% from the big picture and will finally ask Drools to answer my question.
What I want to avoid is passing hundreds of instance/facts with hundreds of fields that are actually never user.
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
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
Drools about that information and it return it as a straight answer.

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
a snap of a finger with some method calls, however now I am interested to see what is the effort to make it happen.

Hope it helps. Thanks for the support.

Best Regards,
Milen


-------- Original Letter --------
From: Stephen Masters stephen.masters@me.com
About: Re: [rules-users] Is rule introspection available from the Drools API?
To: Drools List <rules-users@lists.jboss.org>
Sent at: Tuesday, 2014, January 7 12:08:39 EET

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.

Steve


On 7 Jan 2014, at 08:56, Wolfgang Laun < wolfgang.laun@gmail.com> wrote:

Hi,

while you continue this line of research you might consider possible
ramifications and snags, and be prepared for them.

The syntax for writing LHS conditions is quite complex - it's more
complex than Java expressions, because the CE eval() alone will give
you (almost) all of that. Rule authors may also use DRL functions,
which could hide field access.

If *you* author the rules, you may be able to avoid the worst, but it
won't be a piece of cake.

Cheers
-W



On 07/01/2014, milen igrachev < igrachev@abv.bg> wrote:
Hello thanks for the quick and precise answer!
 I believe that the time difference will be a bit of a problem for the IRC
chat , but i will be online (channel: #drools user: igrachev) today and will
try to check it often.  However big thanks for the support and the
willingness to help!
 You are saying that the code is there, but is not public and documented.
Well being not public seems to be a problem, but do you  think it is
possible to give me an example with the official Drools "first rule" -
Sample.drl. The one that comes with the first Drools project.  So do you
believe it will be possible to paste me some code on how to retrieve the
information that this ruleset is using one fact of type Message  and two of
it's attributes -  status  and  message.  So just some code in a public
static void main (String [] args) will be great :), or any kind of
explanation :).
 Once again thank you.
 Have a nice day,
Milen



----Original Letter----
From: Mark Proctor mproctor@codehaus.org

About: Re: [rules-users] Is rule introspection available from the Drools
API?

To: Rules Users List

Sent at: Monday, 2014, January 6 16:05:33 EET


The code is there, but it’s not public and not documented, and the code can
be a little hard to understand - as it’s grown organically over the years.



You’ll need to cast and unwrap and look at member vars. Start on the Rule
and the lhs variable. You can always pop onto irc, with live questions,and
we’ll try and respond quickly.

http://www.jboss.org/drools/irc



Mark



On 6 Jan 2014, at 09:51, milen igrachev   igrachev@abv.bg  > wrote:



Hello,

is there a way to introspect a Drools file from within java code?

What I need is to be able to identify the facts and the fact attributes
that are used in a given DRL file.



For example if I have a rule stored in a customer.drl DRL file within my
project, containing the following definition:

package myRulePackage



import org.rules.model.Customer

import org.rules.model.Mambership



rule "is eligible customer"

when

$c:Customer(status == "active")

Membership(customer == $c, type == "premium")

then

$c.setEligibilityStatus(true);

end



What i need is a way to understand that this ruleset customer.drl is using
two fact types - Customer and Membership and three of their attributes -
Customer.status, Membership.customer and Membership.type.





I found some information on the internet that such functionality is not
supported, however the information was a bit too old, so I decided to ask
again.





Big thanks for the support!

Milen

_______________________________________________

rules-users mailing list

rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users





_______________________________________________

rules-users mailing list

rules-users@lists.jboss.org

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users