<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>If you take a look at the Verifier it goes through the Drools AST with a visitor pattern.</div><div>It starts by using getting the PackageDescr using&nbsp;DrlParser, this uses Drools internals so be warned that it might change in the future.</div><div><br></div><div><div>&nbsp; Reader drlReader = new InputStreamReader( stream );</div><div>&nbsp; PackageDescr descr = new DrlParser().parse( drlReader );</div></div><div><br></div><div>After that it goes through the PackageDescr using&nbsp;PackageDescrVisitor.&nbsp;RuleDescrVisitor shows how to get the condition part from each rule.</div><div><br></div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/PackageDescrVisitor.java">https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/PackageDescrVisitor.java</a></div><div><a href="https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/RuleDescrVisitor.java">https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/RuleDescrVisitor.java</a></div><div><br></div>Toni<div><br></div><div><br><div><div>On Oct 3, 2011, at 8:11 PM, Mark Proctor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 03/10/2011 18:03, Wolfgang Laun wrote:<br><blockquote type="cite">A condition does not have a "name", as you write; values of the cells<br></blockquote><blockquote type="cite">below a condition are (usually) literals.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">There is no API for extracting parts of a spreadsheet. You can look at<br></blockquote><blockquote type="cite">the Drools source code (in the packages org.drools.decisiontable and<br></blockquote><blockquote type="cite">.../parser) and write whatever you need - it is not too difficult.<br></blockquote>You can also look at drools-verifier, as that shows ho to analyse <br>resulting rule fragments.<br><br>Mark<br><blockquote type="cite"><br></blockquote><blockquote type="cite">-W<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 3 October 2011 17:05, RaviCKota&lt;<a href="mailto:Ravi.Kota@wellsfargo.com">Ravi.Kota@wellsfargo.com</a>&gt; &nbsp;wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Hi All, for suppose I have a DecisionTable like below<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">CONDITION &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ACTION<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-----------------------------<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">COND1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ACTION1<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">COND2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ACTION2<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">COND3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ACTION3<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-----------------------------<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">This is just a representation of the DecisionTable. So I need to retrieve<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">all the conditions and store them into a Collection like Set. Does Drools<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">provide any such feature.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">We load the drools as below<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">PackageBuilder builder = new PackageBuilder();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">builder.addPackageFromDrl(new StringReader(drl)); //drl is the filepath of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">decisiontable excel<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">// add the package to a rulebase (deploy the rule package).<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">RuleBase ruleBase = RuleBaseFactory.newRuleBase();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ruleBase.addPackage(builder.getPackage());<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I tried to look into api of RuleBase, tried to get the packages, Rules,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Consequence, etc etc, but could not find any method, that gets me the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">condition name.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">When I tried to do<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Package[] packages = rulebase.getPackages();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for(Package pack : packages){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">System.out.println("Package Name is : "+pack.getName());<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Rule[] rules = pack.getRules();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for(Rule rule : rules){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">System.out.println("Rule name is : "+rule.getName());<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">All I get is some representation of each row, but I'm specifically looking<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for the value of the first column (CONDITION) for each rule.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Please offer some guidance here.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">View this message in context: <a href="http://drools.46999.n3.nabble.com/Is-it-possible-to-retrieve-the-collection-of-Conditions-from-DecisionTable-tp3390026p3390026.html">http://drools.46999.n3.nabble.com/Is-it-possible-to-retrieve-the-collection-of-Conditions-from-DecisionTable-tp3390026p3390026.html</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Sent from the Drools: User forum mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">rules-users mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">rules-users mailing list<br></blockquote><blockquote type="cite"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br></blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></div></blockquote></div><br></div></body></html>