It's horrible ! My ruleflow have to execute 2 groups : If i keep the "when" condition there is no action. If i delete the "when" condition the action is execute.
Why my facts are not visible by the ruleflow !? I don't understant, i hopte my probleme is simple to result because, my ruleflow is simple and i have 2 rules... Thx for your help paf84 wrote: > > I have deleted the variable... But the rules is often not working ! > I'm so desperate... > > > > Salaboy wrote: >> >> Hmm.. I see that you use the parametre object as a process variable and >> also >> as a fact. >> Remove it from the parametre variable in the process. >> >> On Thu, Nov 26, 2009 at 10:41 AM, paf84 <[email protected]> >> wrote: >> >>> >>> i have replace my when condition by : p : Parametre( para1 : para1 == >>> "para1"). >>> Thx ! >>> The node is reached, i have an action node after it and il works... >>> >>> http://old.nabble.com/file/p26528902/ruleFlow1.rf ruleFlow1.rf >>> >>> Thx for your help. >>> >>> >>> Salaboy wrote: >>> > >>> > First of all, why are you doing this: >>> > >>> > p : Parametre( para1 : para1) >>> > eval (para1 == "para1") >>> > You can directly do: >>> > p : Parametre( para1 : para1 == "para1") >>> > >>> > Can you show us the Drools Flow file? >>> > To see what nodes do you include in that? >>> > Probably your Ruleset node (ruleflow-group) is never reached. >>> > >>> > >>> > >>> > On Thu, Nov 26, 2009 at 8:18 AM, paf84 <[email protected]> >>> wrote: >>> > >>> >> >>> >> Hello, >>> >> >>> >> I try to understand how to use Drolls. >>> >> It's not the first time i work with rules (i know JRules). >>> >> I have a probleme when i execute my ruleflow. >>> >> I have some rules which belong to different ruleflow-group. >>> >> I have put my ruleflow-group in my ruleflow. >>> >> >>> >> THe probleme is that my ruleflow never execute the "then" part of my >>> >> rules. >>> >> >>> >> >>> >> If i delete le ruleflow-group of my rules and i execute the drl file, >>> all >>> >> my >>> >> "then" part are executed. >>> >> I think i have a problem to give my facts to the ruleflow... >>> >> >>> >> Is somebody can help me ? >>> >> >>> >> thx!! >>> >> >>> >> >>> >> Pierre >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> my .java >>> >> >>> >> >>> >> KnowledgeBase kbase = readKnowledgeBase(); >>> >> StatefulKnowledgeSession ksession = >>> >> kbase.newStatefulKnowledgeSession(); >>> >> KnowledgeRuntimeLogger logger = >>> >> KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test"); >>> >> // start a new process instance >>> >> System.out.println("init"); >>> >> Parametre parametre = new Parametre(); >>> >> parametre.para1 = "para1"; >>> >> parametre.para2 = "para2"; >>> >> Parametre parametre2 = new Parametre(); >>> >> parametre2.para1 = "para1"; >>> >> parametre2.para2 = "para2"; >>> >> ksession.insert(parametre); >>> >> >>> >> WorkItemHandler handler = new >>> WorkItemHandler() { >>> >> public void executeWorkItem(WorkItem >>> >> workItem,WorkItemManager manager) { >>> >> System.out.println(">" + >>> >> workItem.getParameters()); >>> >> System.out.println("Executing >>> work >>> >> item " + workItem); >>> >> >>> >> manager.completeWorkItem(workItem.getId(), null); >>> >> } >>> >> >>> >> public void abortWorkItem(WorkItem >>> >> workItem, >>> >> WorkItemManager >>> manager) >>> { >>> >> // Do nothing >>> >> } >>> >> }; >>> >> >>> >> >>> >> Map<String, Object> parametersDispo = new >>> >> HashMap<String, Object>(); >>> >> parametersDispo.put("parametre", parametre); >>> >> >>> >> >>> >> >>> >> >>> >> ksession.getWorkItemManager().registerWorkItemHandler("groupe1", >>> >> handler); >>> >> >>> >> ksession.startProcess("com.sample.ruleflow1", >>> >> parametersDispo); >>> >> >>> >> ksession.fireAllRules(); >>> >> logger.close(); >>> >> } catch (Throwable t) { >>> >> t.printStackTrace(); >>> >> } >>> >> } >>> >> >>> >> private static KnowledgeBase readKnowledgeBase() throws >>> Exception >>> >> { >>> >> KnowledgeBuilder kbuilder = >>> >> KnowledgeBuilderFactory.newKnowledgeBuilder(); >>> >> >>> >> kbuilder.add(ResourceFactory.newClassPathResource("Sample4.drl", >>> >> RuleFlowTest.class), ResourceType.DRL); >>> >> >>> >> kbuilder.add(ResourceFactory.newClassPathResource("ruleFlow1.rf"), >>> >> ResourceType.DRF); >>> >> >>> >> KnowledgeBuilderErrors errors = kbuilder.getErrors(); >>> >> if (errors.size() > 0) { >>> >> for (KnowledgeBuilderError error: errors) { >>> >> System.err.println(error); >>> >> } >>> >> throw new IllegalArgumentException("Could not >>> >> parse >>> >> knowledge."); >>> >> } >>> >> KnowledgeBase kbase = >>> >> KnowledgeBaseFactory.newKnowledgeBase(); >>> >> >>> >> kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); >>> >> return kbase; >>> >> } >>> >> >>> >> >>> >> public static class Parametre { >>> >> >>> >> private String para1; >>> >> private String para2; >>> >> >>> >> >>> >> public String getPara1(){ >>> >> return this.para1; >>> >> } >>> >> public String getPara2(){ >>> >> return this.para2; >>> >> } >>> >> >>> >> >>> >> } >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> One of my rules : >>> >> >>> >> rule "test 1" >>> >> >>> >> ruleflow-group "groupe1" >>> >> when >>> >> p : Parametre( para1 : para1) >>> >> eval (para1 == "para1") >>> >> >>> >> then >>> >> System.out.println( "groupe1 test 1" ); >>> >> >>> >> end >>> >> >>> >> -- >>> >> View this message in context: >>> >> http://old.nabble.com/RuleFlow-and-facts-tp26525341p26525341.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 >>> >> >>> > >>> > >>> > >>> > -- >>> > - http://salaboy.wordpress.com >>> > - http://www.jbug.com.ar >>> > - Salatino "Salaboy" Mauricio - >>> > >>> > _______________________________________________ >>> > rules-users mailing list >>> > [email protected] >>> > https://lists.jboss.org/mailman/listinfo/rules-users >>> > >>> > >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/RuleFlow-and-facts-tp26525337p26528902.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 >>> >> >> >> >> -- >> - http://salaboy.wordpress.com >> - http://www.jbug.com.ar >> - Salatino "Salaboy" Mauricio - >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> > http://old.nabble.com/file/p26529219/ruleFlow1.rf ruleFlow1.rf > -- View this message in context: http://old.nabble.com/RuleFlow-and-facts-tp26525337p26530237.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
