[rules-users] Convert rules to XSLT and dumping Rete Tree to XML
Andargor
andargor at yahoo.com
Thu Jun 10 18:14:38 EDT 2010
Thanks for the quick response! I've managed to take a quick look at the output, and it is indeed verbose. I will definitely take a look at what good it can do. :)
--- On Thu, 6/10/10, Edson Tirelli <tirelli at post.com> wrote:
From: Edson Tirelli <tirelli at post.com>
Subject: Re: [rules-users] Convert rules to XSLT and dumping Rete Tree to XML
To: "Rules Users List" <rules-users at lists.jboss.org>
Date: Thursday, June 10, 2010, 12:11 PM
Hi,
Well, without knowing what you are trying to achieve, it is hard to properly advise you. :)
It is possible to dump the Rete Tree, among other ways, by using a reporting framework I added for debugging. Example code here:
https://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/util/debug/SessionInspectorTest.java
Basically, for an existing session, do:
SessionInspector inspector = new SessionInspector( ksession );
StatefulKnowledgeSessionInfo info = inspector.getSessionInfo();
String report = SessionReporter.generateReport( "simple", info, null );
You can create your own reports using MVEL templates and use them. Example:
SessionInspector inspector = new SessionInspector( ksession );
StatefulKnowledgeSessionInfo info = inspector.getSessionInfo();
SessionReporter.addNamedTemplate( "topten", getClass().getResourceAsStream( "customreports.mvel" ) );
String report = SessionReporter.generateReport( "topten", info, null );
The question is: what good would do that for you?
Edson
2010/6/10 Andargor <andargor at yahoo.com>
Hello, first time on this list, be gentle :)
I need to convert DRL/DSLR rules to XSLT. There are many reasons why this is
necessary, but I would rather not get into that.
The rules themselves are very simple presence/absence of "tags" and simple
numeric comparisons (all easily converted to XSLT), and the rule base is
acyclic. The RHS does not contain anything other than insertLogicals.
I can already perform a topological sort of the rules and output XSLT.
However, it gets messy because of the differing approach from Drools and I
was wondering if I could somehow dump to XML the "compiled" Rete network
from the KnowledgeBase (or WorkingMemory, or KnowledgeBuilder, I'm not
sure). That way i think I can make the XSLT simpler and cleaner by using a
more hierarchical approach to the statements.
There used to be Dumper and ReteDumper classes to do this in the past, but
looking at the source they seem to have disappeared.
Can someone give me a few pointers on dumping the Rete Tree to XML?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Convert-rules-to-XSLT-and-dumping-Rete-Tree-to-XML-tp886380p886380.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
-----Inline Attachment Follows-----
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100610/1b271daf/attachment.html
More information about the rules-users
mailing list