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.
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.
View this message in context: http://old.nabble.com/RuleFlow-and-facts-tp26525337p26528902.html
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 <pierre.belhomme@sogeti.com> 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
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Sent from the drools - user mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users