<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Which version are you using? Latest
versions support named consequences,<br>
which allow to rules in a more compact form:<br>
<br>
when<br>
A() do[a]<br>
( B() do[b]<br>
or<br>
C() do[c]<br>
)<br>
D() do[d]<br>
then<br>
// main consequence here<br>
then[a]<br>
// this will be executed when A() is matched<br>
then[b]<br>
// A() B()<br>
then[c]<br>
// A() C()<br>
then[d]<br>
// same as main consequence<br>
end<br>
<br>
You can then use the main consequence for your normal business
logic.<br>
<br>
In a rule's consequence you can also use the context variables
"drools"<br>
or "kcontext", of type KnowledgeHelper and KnowledgeRuntime
respectively.<br>
They expose some context information such as the rule being fired
and<br>
the tuple (and thus the chain of facts) that led to the
activation.<br>
<br>
If this is not enough, you may have to customize the engine and
extend<br>
the condition nodes (alpha and beta) to fire events when a fact or
a tuple<br>
satisfies the local constraints. It's not terribly difficult to
do, but not immediate either.<br>
Best<br>
Davide<br>
<br>
On 11/20/2013 04:40 PM, Isaac Martin wrote:<br>
</div>
<blockquote
cite="mid:CAP5tTzSxFugaJJF9EUTNvMK45G7KNfyc2fKm4PjWeeb57j5bhw@mail.gmail.com"
type="cite">
<div dir="ltr">I preface this with saying that you should be doing
what Mark suggests. If what he suggests is going to create "too
many drools" or "clutter your files" then I'd recommend putting
them in a decision table.
<div>
<br>
</div>
<div>Another way you could get information like this is to use
the event listeners built into drools in order to give you
information about activation events. For example, you could
have a listener print out the antecedents to a drool in the
beforeActivationFired method.</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Nov 20, 2013 at 1:18 PM, Mark
Proctor <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">create
additional rules, with just the patterns you know you want
to match and record the result in the consequence - so you
can check/assert later.<br>
<span class="HOEnZb"><font color="#888888"><br>
Mark<br>
</font></span>
<div class="HOEnZb">
<div class="h5">On 20 Nov 2013, at 20:49, swaroop <<a
moz-do-not-send="true"
href="mailto:swaroop.oggu@gmail.com">swaroop.oggu@gmail.com</a>>
wrote:<br>
<br>
> Hi ,<br>
><br>
> Is there any way to determine which conditions
matched/passed from list of<br>
> conditions defined for a rule . Also it would be
helpful to know if there is<br>
> any means to relate a fact and the rule fired. In
the below mentioned rule<br>
> can we know which condition passed ?<br>
><br>
> Eg;<br>
> rule "check which Object matched"<br>
> when<br>
> Any of following conditions are true<br>
> Condition1<br>
> Condition2<br>
> Condition3<br>
> then<br>
> insert(Obj A)<br>
><br>
><br>
> Regards<br>
> Oggu<br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a
moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/How-to-know-which-condition-passed-from-list-of-conditions-tp4026853.html"
target="_blank">http://drools.46999.n3.nabble.com/How-to-know-which-condition-passed-from-list-of-conditions-tp4026853.html</a><br>
> Sent from the Drools: User forum mailing list
archive at Nabble.com.<br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
</blockquote>
<br>
</body>
</html>