Vanshi, In general it would be better to put all of the rules together in the same drl file as they all relate to the same object and are all destined for the same rule base. Though there is nothing fundamentally incorrect about your approach in most cases you want related rules to managed and deployed together.
As for your exception it is impossible to say without seeing your rules and the exception. You can try sending them to the list and maybe somebody will be able to help you. Joe -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of vanshi Sent: Friday, November 21, 2008 11:28 AM To: [email protected] Subject: [rules-users] DRL package builder or rule base error Hi all, I have some set of rules which work on same Person object but depending on whether a person is student/employee/Faculty, the rule will have dfferent logic. So, I've made 3 .drl files, one will have all the rules for students, other for employee and then last .drl for faculty. All 3 .drl have same package name (as the first statement in drl) but all rules are named differently. When my rule engine starts, it reads these 3 drl files and adds them to a single rule base, starts a new session, inserts person in working memory and fires rules. Now, my questions are...is there anything odd/wrong with this approach? Secondly, I had some rules names same in different drl and when I changed them ....then I started getting null pointer exception error..... during parsing of drl files. Any idea why is that? code snippet: list=new ArrayList<File>(); list.add(new File("students.drl")); list.add(new File("emloyee.drl"); list.add(new File("faculty.drl")); Iterator<File> it = list.iterator(); ruleBase = RuleBaseFactory.newRuleBase(); builder = new PackageBuilder(); Reader source=null; while(it.hasNext()) { source = new InputStreamReader(RuleEngine.class.getResourceAsStream(it.next().toStrin g())); builder.addPackageFromDrl(source); //if DRL has errors don't add it to the RuleBase if(builder.hasErrors()) log4j.logError(RuleEngine.class, builder.getErrors().toString()); else ruleBase.addPackage(builder.getPackage()); } workingMemory = ruleBase.newStatefulSession(); workingMemory.insert(person); workingMemory.fireAllRules(); -- View this message in context: http://www.nabble.com/DRL-package-builder-or-rule-base-error-tp20627083p 20627083.html Sent from the drools - user mailing list archive at Nabble.com. _______________________________________________ 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
