The cell with the keyword RuleTable must also contain the string for the initial part of the rule name. It seems that you have this in the adjoining cell. - See the docs, section "Rule Tables". -W
2011/8/25 Manohar Kokkula <[email protected]> > Hi Frank and Wolfgang, > > Thank you for your help, > I did everything as you both said,still i am getting the same error, > > > java.lang.RuntimeException: [12,19]: [ERR 101] Line 12:19 no viable > alternative at input ''[12,27]: [ERR 101] Line 12:27 no viable alternative > at input ''[13,15]: [ERR 101] Line 13:15 no viable alternative at input > ''[13,21]: [ERR 101] Line 13:21 no viable alternative at input ''[23,19]: > [ERR 101] Line 23:19 no viable alternative at input ''[23,27]: [ERR 101] > Line 23:27 no viable alternative at input ''[24,15]: [ERR 101] Line 24:15 no > viable alternative at input ''[24,21]: [ERR 101] Line 24:21 no viable > alternative at input ''[34,19]: [ERR 101] Line 34:19 no viable alternative > at input ''[34,25]: [ERR 101] Line 34:25 no viable alternative at input > ''[35,15]: [ERR 101] Line 35:15 no viable alternative at input ''[35,21]: > [ERR 101] Line 35:21 no viable alternative at input ''[45,19]: [ERR 101] > Line 45:19 no viable alternative at input ''[45,27]: [ERR 101] Line 45:27 no > viable alternative at input ''[46,15]: [ERR 101] Line 46:15 no viable > alternative at input ''[46,21]: [ERR 101] Line 46:21 no viable alternative > at input '' > Error in kbuildefr ...... > Error in main ... > Error is java.lang.RuntimeException: [12,19]: [ERR 101] Line 12:19 no > viable alternative at input ''[12,27]: [ERR 101] Line 12:27 no viable > alternative at input ''[13,15]: [ERR 101] Line 13:15 no viable alternative > at input ''[13,21]: [ERR 101] Line 13:21 no viable alternative at input > ''[23,19]: [ERR 101] Line 23:19 no viable alternative at input ''[23,27]: > [ERR 101] Line 23:27 no viable alternative at input ''[24,15]: [ERR 101] > Line 24:15 no viable alternative at input ''[24,21]: [ERR 101] Line 24:21 no > viable alternative at input ''[34,19]: [ERR 101] Line 34:19 no viable > alternative at input ''[34,25]: [ERR 101] Line 34:25 no viable alternative > at input ''[35,15]: [ERR 101] Line 35:15 no viable alternative at input > ''[35,21]: [ERR 101] Line 35:21 no viable alternative at input ''[45,19]: > [ERR 101] Line 45:19 no viable alternative at input ''[45,27]: [ERR 101] > Line 45:27 no viable alternative at input ''[46,15]: [ERR 101] Line 46:15 no > viable alternative at input ''[46,21]: [ERR 101] Line 46:21 no viable > alternative at input '' > > at com.model.Student_College.readBase(Student_College.java:90) > at com.model.Student_College.main(Student_College.java:31) > > > Now i am sending my main class and .xls file. > > public class Student_College { > > public static void main(String args[]) throws IOException > { > > Student s=new Student(); > College c=new College(); > s.setAge(20); > s.setMarks(35); > c.setRanking("B"); > c.setLocation("elhi"); > > > > try > { > KnowledgeBase kbase = readBase(); > StatefulKnowledgeSession ksession = > kbase.newStatefulKnowledgeSession(); > > ksession.insert(s); > ksession.insert(c); > ksession.fireAllRules(); > System.out.println("Department is > "+s.getDepartment()); > > System.out.println("Status is " + c.getStatus()); > > ksession.dispose(); > > > > } > catch(RuntimeException re) > { > System.out.println("Error in main ..."); > re.printStackTrace(); > System.out.println("Error is "+re); > > } > > } > > private static KnowledgeBase readBase() throws IOException > { > DecisionTableConfiguration dconf = > KnowledgeBuilderFactory.newDecisionTableConfiguration(); > dconf.setInputType(DecisionTableInputType.XLS); > > KnowledgeBuilder kbuilder = > KnowledgeBuilderFactory.newKnowledgeBuilder(); > > kbuilder.add(ResourceFactory.newClassPathResource("manohar.xls", > Student_College.class), ResourceType.DTABLE, dconf); > > > if(kbuilder.hasErrors()) > { > System.out.println("Error in kbuildefr ......"); > throw new > RuntimeException(kbuilder.getErrors().toString()); > > } > > KnowledgeBase kbase = > KnowledgeBaseFactory.newKnowledgeBase(); > > kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); > > return kbase; > > > } > > } > > > In above main class i used the following code to interpret my manohar.xls > file... > > String drlString = null; > try { > drlString = > DecisionTableFactory.loadFromInputStream(ResourceFactory.newClassPathResource("manohar.xls", > Student_College.class).getInputStream(), dconf); > } catch (IOException e) { > // TODO Auto-generated catch block > System.out.println("Error in drl String ....."); > e.printStackTrace(); > } > > System.out.println("..........."+drlString); > > > > > manohar.xls: > > RuleSet com.model Import com.model.Student, com.model.College > RuleTable > Allocation Rule CONDITION CONDITION CONDITION CONDITION ACTION ACTION > $s:Student > $c:College age marks ranking location $s.setDepartment(“$param”); > $c.setStatus(“$param”); > 18 > 85 > A Delhi Science AICTE > 18 > 90 > B Kanpur Science AICTE > 20 > 90 > A Mumbai Maths AICTE > 23 > 87 > C Hyderabad Physics AICTE > > > > Thanks and Regards > Manohar Kokkula > Mailto: [email protected] > > =====-----=====-----===== > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
