On 21/08/2012, BenjaminWolfe <benjamin.e.wolfe(a)gmail.com> wrote:
I'm trying to wrap my mind around the nature of ruleflows -- and
I think
this
question sums up a bit of my confusion.
I have a stateful knowledge session. The stateful knowledge session has a
ruleflow associated with it. That ruleflow diverges into two branches --
branch A and branch B -- based on a rule constraint. It's an XOR, and the
mvel rule constraints are something like this:
to branch A
$u : User( $i : userId )
exists ( Dog( owner == $i, hasDogTag == false) )
to branch B
$u : User( $i : userId )
not ( Dog( owner == $i, hasDogTag == false) )
Then the two branches converge again. I insert two facts: user 1, whose
dogs all have dog tags, and user 2 whose third dog is missing a tag. Then,
after I insert both facts, I fire all rules.
If you don't insert any Dogs, only the condition for branch B is true,
since there no Dogs at all, tag or no tag.
If you insert Dogs according to your statement, both conditions are
true, A for user 2 and B for user 1 (which is not what you describe
below, but I think this is an oversight).
Anyway, a "flow" will not cycle automatically if there are several
fact groups, with some of them requiring this or that processing. To
notify Users with untagged dogs, a simple rule with the conditions
you've posted and with a consequence notifying the user would be
sufficient.
For an overall decision between "there are tagless dogs" and "all dogs
are tagged" you'd need conditions like these:
exists( Dog( hasDogTag == false) )
not( Dog( hasDogTag == false) )
-W
Should the flow be like this?
user 1: start --> diverge --> branch A (tell him to buy dog tags) -->
converge --> end
user 2: start --> diverge --> branch B (leave him alone) --> converge -->
end
Or does a ruleflow look at the whole session rather than each fact -- in
which case either both users would pass through branch A, or both would
pass
through branch B?
If I want the first case to happen, is there something I'm missing in the
implementation? And are there any more details I can add to make my post
more specific? Thank you for your help.
--
View this message in context:
http://drools.46999.n3.nabble.com/Question-about-the-Nature-of-Ruleflows-...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users