Why are you constructing multiple KBs and sessions? I mean those decision
tables can be written in a way where you would only need a single KB and
session if a4 and a5 in your examples can be set to some "starting" known
state.
If a4 and a5 where initially set to null, or false, or -1 or NOT_SET you
could rewrite the tables as follows
Decision Table 2
------------------------------
---------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a4 != NOT_SET | a5 = a4 |
----------------------------------------------
Decision Table 3
------------------------------
------------------------------------------
condition | condition | condition | condition | condition | Action
|
-------------------------------------------------------------------------
a1 | a2 | a3 | a4 | a5 != NOT_SET
|
computeValue() |
------------------------------------------------------------------------
Or use rule flow/agenda groups.
dave
On Fri, Jan 15, 2010 at 11:47 AM, HonorGod <
jagadeesh.motamarri(a)barclayscapital.com> wrote:
Hi,
I have a single fact model with 5 [a1, a2,a3, a4, and a5] different
attributes. I have 3 decision tables in the following fashion
Decision Table 1
---------------------------------------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a3 | a4 = a1+a3|
----------------------------------------------
Once I have the value of a4, I need to hit different set of rules which are
stored in second decision table
Decision Table 2
---------------------------------------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a4 | a5 = a4 |
----------------------------------------------
Once I have the value of a5, I need to hit different set of rules which are
store in third decision table
Decision Table 3
------------------------------------------------------------------------
condition | condition | condition | condition | condition | Action
|
-------------------------------------------------------------------------
a1 | a2 | a3 | a4 | a5 |
computeValue() |
------------------------------------------------------------------------
I don't have any problem when I load the rules into individual
KnowledgeBase
and fire the rules one after the other as follows -
<code>
// apply rules from decision table 1
StatefulKnowledgeSession kSession =
knowledgeBase1.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
// apply rules from decision table 2
kSession = knowledgeBase2.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
// apply rules from decision table 3
kSession = knowledgeBase3.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
kSession.dispose() ;
</code>
But when I upload the decision tables into Guvnor and use the package / drl
from the package snapshot my second set of rules are not fired at all.
How do I resolve this issue?
Please help.
Thanks
--
View this message in context:
http://n3.nabble.com/Is-this-possible-in-Guvnor-tp122132p122132.html
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users