Hi,

First of all, you can create 2 packages in Guvnor and then use the 2 different URL according to what KB (ie package) you want to launch, exactly the same way you did before with DRL files. I don't think this is a bad practice in the case of two distinct use-cases, except if the two DRL are sharing some rules. And it will be far much simpler according to where you are at now ...

If you want to use a single KB (because you are sharing rules, or expect to, or only to learn RuleFlows), you have to limit the rules that can fire according to your A or B group. A RuleFlow is a way to do that. Briefly (the doc will explain that with more details), a RuleFlow is state-transition graph that is used to filter the rules that can fire : Only the rules having a "ruleflow-group" equals to the actual state in the graph can fire. When no more rules of that state can fire, the next state (according to the graph and eventually more conditions) become the current one, until the end reached.

So, for your specific case, you need to :
   - assign a "ruleflow-group" ("show options" in Guvnor) "A" or "B" to your rules (states are only Strings)
   - create a RuleFlow (in eclipse) with two states "A" and "B" (not only the names, but the ruleflow-group attribute in "properties" view)
   - In your RuleFlow, you need a start node and a end node, and a banch node to switch between A or B path according to some condition. This condition can be a test on a global var, or something in the WM, or a static method call ... whatever
   - And last, when you execute your kBase, you have to call a kSession.startProcess ("your rule flow id") before calling fireAllRules().

See Drools doc for details, samples ... but the mains steps are described above.

Have fun !


Le 17/06/2011 12:06, Michael Anstis a écrit :
ruleflow-group is a rule attribute and, AFAIK, something you assign in your rule-flow to relate rules to flows.

Unfortunately I am not an expert on drools-flow so I am hoping somebody more experienced and confirm my thoughts.

You do not need to use the attribute when loading the KnowledgeBase, just when authoring your flows.

With kind regards,

Mike

2011/6/17 Serge Vilvovsky <sergevil@gmail.com>
Thank you, Mike.

Can you let me know, please, what is the way to differentiate the ruleflow-groups on Knowledge Base reading? What classes does it affect?

Regards,
Serge

 
2011/6/16 Michael Anstis <michael.anstis@gmail.com>
IIRC, you can use different ruleflow-groups to differentiate the two rules.

The problem you describe would be evident locally if you used a single KnowledgeBase containing the two rules. Creating two KBs would not normally be recommended.

A single KB should be sufficient.

With kind regards,

Mike

2011/6/17 Serge Vilvovsky <sergevil@gmail.com>
I am a beginner with drools, sorry, if the question is too trivial.

I have two drl files A and B. Both they validate the instance of the same type T, but produce the different output.
I call the drool A within one business flow and drool B within another flow.

Before now I ran them locally, creating two separate KnowledgeBases, and everything worked fine. Now I want to use the Guvnor.

If I put them to the same package and run:
http://<server>/guvnor-webapp/org.drools.guvnor.Guvnor/package/<packageName>/LATEST
I will get the KnowledgeBase that contains them both, I believe. According to my understanding, because they process the instance of the same type, I cannot use such KnowledgeBase.

What should I do? Is it any API that allows to distinguish the KnowelageBases for the different drools within the same package or I need to put them to the different packages?

Thank you!