public boolean retractFactFromRete(Object ob) throws ComponentException { boolean result; try { IWorkingMemory reteWorkingMemory = ruleBase.newWorkingMemory(); reteWorkingMemory.retractObject(ob); result = true; } catch (RuleComponentException rce) { throw new ComponentException(rce.getMessage()); } return result; }
public List<IRuleClass> executeRules(Object[] ob) throws ComponentException { System.out.println("-------Inside Execute RULES---rulebase=" + ruleBase); System.out.println("-------Inside Execute RULES---object=" + ob); try { IWorkingMemory reteWorkingMemory = ruleBase.newWorkingMemory(); reteWorkingMemory.assertObject(ob); return reteWorkingMemory.executeRules(); } catch (RuleComponentException rce) { throw new ComponentException(rce.getMessage()); } }
public void buildRete(String masterPageLocation) throws ComponentException { System.out.println("*********INSIDE RULE COMPONENT BUILD RETE************"); this.masterPagePath = masterPageLocation; ruleBase = new ReteRuleBase(); // ruleBase.readRule(RulesConstants.MASTER_PAGE_PATH); try { ruleBase.readRule(masterPageLocation); ruleBase.buildRete(); } catch (RuleComponentException rce) { rce.printStackTrace(); throw new ComponentException(rce.getMessage()); } /*IWorkingMemory reteWorkingMemory = ruleBase.newWorkingMemory(); reteWorkingMemory.assertObject(ob); return reteWorkingMemory.executeRules();*/ }