<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  
  
    <div class="moz-cite-prefix">Hello again.<br>
      <br>
      It seems clear that too many salience levels would make it all
      worse !<br>
      <br>
      My ruleset executes over a simple list of initial facts, and
      proceeds more or less as you say in three phases :<br>
      <br>
      1) Analise initial facts using several deduced facts to make
      intermediary conclusions implemented as locally declared types.<br>
      <br>
      2) Consolidate the scattered produced facts to build seven main
      business rules : here is where I need to gather all the facts into
      a unique collection. Depending on each of the seven rules, the
      result may use a simple input fact, or, at the opposite, different
      collections of temporary facts...<br>
      <br>
      3) At the end, for each input fact, generate a global decision
      using the seven rules, and output it into a global map.<br>
      <br>
      For that, I think that it may be rather reasonable [:)] setting 3
      salience levels representing the three main steps of the rule
      system.<br>
      <br>
      I have had a look to the activation groups, but I don't think it
      could match this current need. Moreover this would be more
      intrusive since such a way the Java code should knows the layered
      structure of the rules. At this time the application code just
      puts the initial facts and extract the resulting map to produce a
      JSON like object to be written into a Mongo base...<br>
      <br>
      Thanks a lot for your help. Any new advice is welcome !<br>
      <br>
      Best regards.<br>
      <br>
      <pre class="moz-signature" cols="72">Ephemeris Lappis</pre>
      Le 21/04/2014 17:48, laune [via Drools] a écrit :<br>
    </div>
    <blockquote style='border-left:2px solid #CCCCCC;padding:0 1em'
cite="mid:CANaj1LcJupvVRuMvE6R_6uMdKeAozMG+r-sGEqPqddNOyZbkxw@mail.gmail.com"
      type="cite"> I recommend at most 3 levels of salience, and only if
      you have a
      <br>
      very limited scenario of insert / fire.
      <br>
      <br>
      Alternatively, you can use agenda groups.
      <br>
      <br>
      If I understand you correctly, you have some rules that execute
      <br>
      "Before" and others that should execute "After". In your .drl,
      <br>
      <br>
      activation-group "Before"
      <br>
      rule ... when ... then ... end ... rule ... when ... then ... end
      <br>
      activation-group "After"
      <br>
      rule ... when ... then ... end ... rule ... when ... then ... end
      <br>
      <br>
      You can set (the group "Before" before you insert facts, call
      <br>
      fireAllRules, set "After" and fire again; then start over again. -
      See
      <br>
      the Expert manual for some more about activation groups.
      <br>
      <br>
      Setting the agenda group from Java takes a little digging in the
      API doc:
      <br>
         session.getAgenda().getAgendaGroup( "Before" ).setFocus();
      <br>
      <br>
      -W
      <br>
      <br>
      <br>
      <br>
      On 21/04/2014, Ephemeris Lappis &lt;<a moz-do-not-send="true"
        href="/user/SendEmail.jtp?type=node&amp;node=4029304&amp;i=0"
        target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;
      wrote:
      <div class="shrinkable-quote"><br>
        &gt; Hello.
        <br>
        &gt;
        <br>
        &gt; Thanks for this advice.
        <br>
        &gt;
        <br>
        &gt; I've tried it with a small test case, and it actually works
        fine : the
        <br>
        &gt; collecting rule seems to be fired at the end.
        <br>
        &gt;
        <br>
        &gt; Nonetheless, I'm not confident at all with salience, since
        in my real
        <br>
        &gt; use case I have many rules before and after that, and I
        worry that
        <br>
        &gt; salience might move the problem elsewhere, and values must
        be set to all
        <br>
        &gt; of them to ensure they're all executed according to the
        expected order.
        <br>
        &gt;
        <br>
        &gt; At this moment, the rules before the collecting rule also
        produce facts
        <br>
        &gt; that are expected by the rules that follow it, and, I
        suppose, it's for
        <br>
        &gt; that reason that all the ending part of the job is executed
        after the
        <br>
        &gt; correct collection of the intermediary results.
        <br>
        &gt;
        <br>
        &gt; Another alternative ?
        <br>
        &gt;
        <br>
        &gt; Thanks again.
        <br>
        &gt;
        <br>
        &gt; Regards
        <br>
        &gt;
        <br>
        &gt;
        <br>
        &gt;
        <br>
        &gt; Ephemeris Lappis
        <br>
        &gt;
        <br>
        &gt; Le 21/04/2014 13:11, laune [via Drools] a écrit :
        <br>
        &gt;&gt; This is one of the (rare) cases where I'd advocate
        salience.
        <br>
        &gt;&gt;
        <br>
        &gt;&gt; rule "Collect results when complete"
        <br>
        &gt;&gt; salience -999999
        <br>
        &gt;&gt;     when
        <br>
        &gt;&gt;                 $all : List from collect(Result())
        <br>
        &gt;&gt;     then
        <br>
        &gt;&gt;             ...do something with $all...
        <br>
        &gt;&gt; end
        <br>
        &gt;&gt;
        <br>
        &gt;&gt; -W
        <br>
        &gt;&gt;
        <br>
        &gt;&gt;
        <br>
        &gt;&gt; On 21/04/2014, Ephemeris Lappis &lt;[hidden email]
        <br>
        &gt;&gt;
        &lt;/user/SendEmail.jtp?type=node&amp;node=4029298&amp;i=0&gt;&gt;
        wrote:
        <br>
        &gt;&gt;
        <br>
        &gt;&gt; &gt; Hello.
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; I'm looking for the better way to write a rule
        that collects data
        <br>
        &gt;&gt; only when
        <br>
        &gt;&gt; &gt; they have been all processed.
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; For example, two input objects classes as facts :
        *Data* and
        <br>
        &gt;&gt; *Category*.
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; I declare a local type to memorize the result of
        the evaluation for
        <br>
        &gt;&gt; each
        <br>
        &gt;&gt; &gt; pair of fact.
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; Some rule evaluates the Cartesian product of all
        *Data* by all
        <br>
        &gt;&gt; *Category* :
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; Now I want to collect all the results, but only
        when the previous
        <br>
        &gt;&gt; rule has
        <br>
        &gt;&gt; &gt; been fired for all the data.
        <br>
        &gt;&gt; &gt; Something like :
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; Any advice ?
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; Thanks in advance for your help.
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; Regards.
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; &gt; --
        <br>
        &gt;&gt; &gt; View this message in context:
        <br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296.html"
          target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296.html</a><br>
        &gt;&gt; &gt; Sent from the Drools: User forum mailing list
        archive at Nabble.com.
        <br>
        &gt;&gt; &gt; _______________________________________________
        <br>
        &gt;&gt; &gt; rules-users mailing list
        <br>
        &gt;&gt; &gt; [hidden email]
        &lt;/user/SendEmail.jtp?type=node&amp;node=4029298&amp;i=1&gt;
        <br>
        &gt;&gt; &gt; <a moz-do-not-send="true"
          href="https://lists.jboss.org/mailman/listinfo/rules-users"
          target="_top" rel="nofollow" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        &gt;&gt; &gt;
        <br>
        &gt;&gt; _______________________________________________
        <br>
        &gt;&gt; rules-users mailing list
        <br>
        &gt;&gt; [hidden email]
        &lt;/user/SendEmail.jtp?type=node&amp;node=4029298&amp;i=2&gt;
        <br>
        &gt;&gt; <a moz-do-not-send="true"
          href="https://lists.jboss.org/mailman/listinfo/rules-users"
          target="_top" rel="nofollow" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        &gt;&gt;
        <br>
        &gt;&gt;
        <br>
        &gt;&gt;
        ------------------------------------------------------------------------
        <br>
        &gt;&gt; If you reply to this email, your message will be added
        to the
        <br>
        &gt;&gt; discussion below:
        <br>
        &gt;&gt; <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029298.html"
          target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029298.html</a><br>
        &gt;&gt;
        <br>
        &gt;&gt;
        <br>
        &gt;&gt; To unsubscribe from Collect all occurrences of
        resulting data., click
        <br>
        &gt;&gt; here
        <br>
        &gt;&gt; &lt;<a moz-do-not-send="true" href="" target="_top" rel="nofollow" link="external">
          <br>
          &gt;&gt; NAML
          <br>
          &gt;&gt; &lt;</a><a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml"
          target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</a>&gt;
        <br>
        &gt;&gt;
        <br>
        &gt;&gt;
        <br>
        &gt;
        <br>
        &gt;
        <br>
        &gt;
        <br>
        &gt;
        <br>
        &gt;
        <br>
        &gt; --
        <br>
        &gt; View this message in context:
        <br>
        &gt; <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029300.html"
          target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029300.html</a><br>
        &gt; Sent from the Drools: User forum mailing list archive at
        Nabble.com.
      </div>
      <br>
      _______________________________________________
      <br>
      rules-users mailing list
      <br>
      <a moz-do-not-send="true"
        href="/user/SendEmail.jtp?type=node&amp;node=4029304&amp;i=1"
        target="_top" rel="nofollow" link="external">[hidden email]</a>
      <br>
      <a moz-do-not-send="true"
        href="https://lists.jboss.org/mailman/listinfo/rules-users"
        target="_top" rel="nofollow" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
      <br>
      <br>
      <hr noshade="noshade" size="1" color="#cccccc">
      <div style="color:#444; font: 12px
        tahoma,geneva,helvetica,arial,sans-serif;">
        <div style="font-weight:bold">If you reply to this email, your
          message will be added to the discussion below:</div>
        <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029304.html" target="_top" rel="nofollow" link="external">http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029304.html</a>
      </div>
      <div style="color:#666; font: 11px
tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
        To unsubscribe from Collect all occurrences of resulting data.,
        <a moz-do-not-send="true"
href="" target="_top" rel="nofollow" link="external">click
          here</a>.<br>
        <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_top" link="external">NAML</a> </div>
    </blockquote>
    <br>
  



        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/Collect-all-occurrences-of-resulting-data-tp4029296p4029307.html">Re: [rules-users] Collect all occurrences of resulting data.</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>