See http://www.jessrules.com/jess/docs/71/library.html#prettyprinting


On Apr 23, 2011, at 1:47 PM, Vu Le wrote:

In my Java code, I have:
            Rete engine = new Rete();
engine.batch("myrule.clp");
…
Now how do I print out, by Java code, LHS and RHS of the rules that are in "myrule.clp"?
I had tried to use this to print the LHS:
for (Iterator iterator = engine.listDefrules(); iterator.hasNext();) {
            Defrule rule = (Defrule) iterator.next();
for (Iterator iterator2 = rule.getNodes(); iterator2.hasNext();) {
                  Node node = (Node) iterator2.next();
                  if (node.getNodeType() == 1) {
                        System.out.println("--" + node);
                  }
            }
            System.out.println("Action: " + rule.getAction(0));
      }
But the output looks really annoying.
Can anyone help me?

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            ejfr...@sandia.gov
Livermore, CA 94550                             http://www.jessrules.com






--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------

Reply via email to