Since Toni confirms me even before I post this on the list: Using the Verifier way to get at a column from some spreadsheet is not for the faint at heart. In addition to what Toni wrote: source code in the Drools AST corner isn&#39;t even commented.<br>
-W<br><br><br><div class="gmail_quote">2011/10/4 Toni Rikkola <span dir="ltr">&lt;<a href="mailto:toni.rikkola@gmail.com">toni.rikkola@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="word-wrap: break-word;"><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 DrlParser, this uses Drools internals so be warned that it might change in the future.</div>
<div><br></div><div><div>  Reader drlReader = new InputStreamReader( stream );</div><div>  PackageDescr descr = new DrlParser().parse( drlReader );</div></div><div><br></div><div>After that it goes through the PackageDescr using PackageDescrVisitor. 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" target="_blank">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" target="_blank">https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/RuleDescrVisitor.java</a></div>
<div><br></div><font color="#888888">Toni</font><div><div></div><div class="h5"><div><br></div><div><br><div><div>On Oct 3, 2011, at 8:11 PM, Mark Proctor wrote:</div><br><blockquote type="cite"><div>On 03/10/2011 18:03, Wolfgang Laun wrote:<br>
<blockquote type="cite">A condition does not have a &quot;name&quot;, 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" target="_blank">Ravi.Kota@wellsfargo.com</a>&gt;  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               ACTION<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-----------------------------<br></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite">COND1                     ACTION1<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">COND2                     ACTION2<br></blockquote></blockquote><blockquote type="cite">
<blockquote type="cite">COND3                     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(&quot;Package Name is : &quot;+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(&quot;Rule name is : &quot;+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&#39;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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">rules-users@lists.jboss.org</a><br></blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">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" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></div></blockquote></div><br></div></div></div></div><br>_______________________________________________<br>

rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>