<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>
      &nbsp; or<br>
      &nbsp; C() do[c]<br>
      )<br>
      D() do[d]<br>
      then<br>
      &nbsp; // main consequence here<br>
      then[a]<br>
      &nbsp; // this will be executed when A() is matched<br>
      then[b]<br>
      &nbsp; // A() B()<br>
      then[c]<br>
      &nbsp; // A() C()<br>
      then[d]<br>
      &nbsp;// 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.&nbsp;
        <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">&lt;<a moz-do-not-send="true"
              href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;</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 &lt;<a
                  moz-do-not-send="true"
                  href="mailto:swaroop.oggu@gmail.com">swaroop.oggu@gmail.com</a>&gt;
                wrote:<br>
                <br>
                &gt; Hi ,<br>
                &gt;<br>
                &gt; Is there any way to determine which conditions
                matched/passed from list of<br>
                &gt; conditions defined for a rule . Also it would be
                helpful to know if there is<br>
                &gt; any means to relate a fact and the rule fired. In
                the below mentioned rule<br>
                &gt; can we know which condition passed ?<br>
                &gt;<br>
                &gt; Eg;<br>
                &gt; rule "check which Object matched"<br>
                &gt; when<br>
                &gt; Any of following conditions are true<br>
                &gt; Condition1<br>
                &gt; Condition2<br>
                &gt; Condition3<br>
                &gt; then<br>
                &gt; insert(Obj A)<br>
                &gt;<br>
                &gt;<br>
                &gt; Regards<br>
                &gt; Oggu<br>
                &gt;<br>
                &gt;<br>
                &gt;<br>
                &gt; --<br>
                &gt; 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>
                &gt; Sent from the Drools: User forum mailing list
                archive at Nabble.com.<br>
                &gt; _______________________________________________<br>
                &gt; rules-users mailing list<br>
                &gt; <a moz-do-not-send="true"
                  href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
                &gt; <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>