JESS: Print Jess rule in detail using Java code
"Vu Le" <[email protected]> Sun, 24 Apr 2011 00:47:39 +0700
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <6605_1303740910_p3PEDsGI007411_002701cc01de$8c515650$a4f402f0$@com> |
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?