<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 <<a moz-do-not-send="true"
href="/user/SendEmail.jtp?type=node&node=4029304&i=0"
target="_top" rel="nofollow" link="external">[hidden email]</a>>
wrote:
<div class="shrinkable-quote"><br>
> Hello.
<br>
>
<br>
> Thanks for this advice.
<br>
>
<br>
> I've tried it with a small test case, and it actually works
fine : the
<br>
> collecting rule seems to be fired at the end.
<br>
>
<br>
> Nonetheless, I'm not confident at all with salience, since
in my real
<br>
> use case I have many rules before and after that, and I
worry that
<br>
> salience might move the problem elsewhere, and values must
be set to all
<br>
> of them to ensure they're all executed according to the
expected order.
<br>
>
<br>
> At this moment, the rules before the collecting rule also
produce facts
<br>
> that are expected by the rules that follow it, and, I
suppose, it's for
<br>
> that reason that all the ending part of the job is executed
after the
<br>
> correct collection of the intermediary results.
<br>
>
<br>
> Another alternative ?
<br>
>
<br>
> Thanks again.
<br>
>
<br>
> Regards
<br>
>
<br>
>
<br>
>
<br>
> Ephemeris Lappis
<br>
>
<br>
> Le 21/04/2014 13:11, laune [via Drools] a écrit :
<br>
>> This is one of the (rare) cases where I'd advocate
salience.
<br>
>>
<br>
>> rule "Collect results when complete"
<br>
>> salience -999999
<br>
>> when
<br>
>> $all : List from collect(Result())
<br>
>> then
<br>
>> ...do something with $all...
<br>
>> end
<br>
>>
<br>
>> -W
<br>
>>
<br>
>>
<br>
>> On 21/04/2014, Ephemeris Lappis <[hidden email]
<br>
>>
</user/SendEmail.jtp?type=node&node=4029298&i=0>>
wrote:
<br>
>>
<br>
>> > Hello.
<br>
>> >
<br>
>> > I'm looking for the better way to write a rule
that collects data
<br>
>> only when
<br>
>> > they have been all processed.
<br>
>> >
<br>
>> > For example, two input objects classes as facts :
*Data* and
<br>
>> *Category*.
<br>
>> >
<br>
>> > I declare a local type to memorize the result of
the evaluation for
<br>
>> each
<br>
>> > pair of fact.
<br>
>> >
<br>
>> >
<br>
>> >
<br>
>> > Some rule evaluates the Cartesian product of all
*Data* by all
<br>
>> *Category* :
<br>
>> >
<br>
>> >
<br>
>> >
<br>
>> > Now I want to collect all the results, but only
when the previous
<br>
>> rule has
<br>
>> > been fired for all the data.
<br>
>> > Something like :
<br>
>> >
<br>
>> >
<br>
>> >
<br>
>> > Any advice ?
<br>
>> >
<br>
>> > Thanks in advance for your help.
<br>
>> >
<br>
>> > Regards.
<br>
>> >
<br>
>> >
<br>
>> >
<br>
>> > --
<br>
>> > View this message in context:
<br>
>> >
<br>
>> <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>
>> > Sent from the Drools: User forum mailing list
archive at Nabble.com.
<br>
>> > _______________________________________________
<br>
>> > rules-users mailing list
<br>
>> > [hidden email]
</user/SendEmail.jtp?type=node&node=4029298&i=1>
<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>
>> rules-users mailing list
<br>
>> [hidden email]
</user/SendEmail.jtp?type=node&node=4029298&i=2>
<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>
>>
------------------------------------------------------------------------
<br>
>> If you reply to this email, your message will be added
to the
<br>
>> discussion below:
<br>
>> <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>
>>
<br>
>>
<br>
>> To unsubscribe from Collect all occurrences of
resulting data., click
<br>
>> here
<br>
>> <<a moz-do-not-send="true" href="" target="_top" rel="nofollow" link="external">
<br>
>> NAML
<br>
>> <</a><a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&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&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml</a>>
<br>
>>
<br>
>>
<br>
>
<br>
>
<br>
>
<br>
>
<br>
>
<br>
> --
<br>
> View this message in context:
<br>
> <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>
> 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&node=4029304&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&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&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/>