[rules-users] Convert rules to XSLT and dumping Rete Tree to XML

Edson Tirelli tirelli at post.com
Thu Jun 10 15:11:51 EDT 2010


   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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100610/4183159e/attachment.html 


More information about the rules-users mailing list