<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Wolfgang,&nbsp;<div><br></div><div>Thanks for the suggestions. I have a few questions,&nbsp;does changing the focus on the RHS work like :</div><div><br></div><div><a id="d0e8803" style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif; font-size: 12px; line-height: 18px; text-align: justify; "><div class="example-contents"><pre xmlns="" xmlns:d="http://docbook.org/ns/docbook" xmlns:rf="java:org.jboss.highlight.XhtmlRendererFactory" class="" style="font-size: 0.9em; font-family: courrier, monospace; background-color: rgb(245, 245, 245); overflow: auto; padding: 5px 15px 5px 25px; border: 1px solid rgb(204, 204, 204); ">kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "B to D" ).setFocus();</pre></div></a><div><br></div><div>Do I need to import kcontext ? or is it implicitly in scope already ?</div><div><br></div><div><blockquote type="cite">a low salience rule would set<br>the AG for the Spartan group and so on.</blockquote><br></div><div>As I understand it, salience helps the engine decide "which" rule to run, when one or more matches, but does that mean identical factors ,,&nbsp;</div><div>or just any that are applicable ?&nbsp;</div><div><br></div><div>Will the below example work ? Will "b only" fire last like I want it to ?</div><div><br></div><div><font face="Monaco">class Foo { boolean a; boolean b; }</font></div><div><br></div><div>(object inserted has a and b == true), Agenda-group Focus is set to "Intialisation"</div><div><br></div><div>---</div><div><font face="Monaco">rule "a only"</font></div><div><span style="font-family: Monaco; ">agenda-group "Initialisation"</span></div><div><font face="Monaco">salience 10</font></div><div><font face="Monaco">when&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp; &nbsp;Foo (a == true)</font></div><div><font face="Monaco">then&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp; &nbsp;…</font></div><div><font face="Monaco">end</font></div><div><font face="Monaco"><br></font></div><div><div><font face="Monaco">rule "a and b"</font></div><div><span style="font-family: Monaco; ">agenda-group "Initialisation"</span></div><div><font face="Monaco">salience 5</font></div><div><font face="Monaco">when&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp; &nbsp;Foo (a == true, b == true)</font></div><div><font face="Monaco">then&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp; &nbsp;…</font></div><div><font face="Monaco">end</font></div></div><div><font face="Monaco"><br></font></div><div><div><font face="Monaco">rule "b only"</font></div><div><font face="Monaco">agenda-group "Initialisation"</font></div><div><font face="Monaco">salience 1</font></div><div><font face="Monaco">when&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp; &nbsp;Foo (b == true)</font></div><div><font face="Monaco">then&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp;&nbsp;kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "WorkerGroup" ).setFocus();</font></div><div><font face="Monaco">end</font></div></div><div><br></div><div>Many thanks</div><div>Ramon</div><div><br></div><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div>Ramon Buckland</div><div><a href="mailto:ramon@thebuckland.com">ramon@thebuckland.com</a></div><div><br></div></span><br class="Apple-interchange-newline">

</div>
<br><div><div>On 5 Jun 2013, at 06:47, Wolfgang Laun &lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">You can change the focus on the RHS of a rule as well, using the API.<br>Starting in the default agenda group, a low salience rule would set<br>the AG for the Spartan group and so on.<br><br>Notice that any attribute can be set in front of or in between rules to<br>become effective in successive rules. This should also work in XLS,<br>except that you may have to create three files for your three groups.<br>(The XLS parser isn't very intelligent, at least wasn't last time I was<br>looking.)<br><br>-W<br><br><br>On 04/06/2013, Ramon Buckland &lt;<a href="mailto:ramon@thebuckland.com">ramon@thebuckland.com</a>&gt; wrote:<br><blockquote type="cite">Hi,<br><br>I am using a Stateless Knowledge session backed behind a web rest api.<br>The rest api is provided by spring Mvc, so I have a stateless ksession<br>injected in.<br><br>As it is stateless, I have found it difficult to use agenda groups to<br>meet my need. And have a question to how I set this up.<br><br>My task.<br>In short, I have 10 or so set up rules (init rules), then a 300 odd<br>(work) rules, then I need to fire a few (5) (finalisation) rules.<br><br>They need to be processed in that order. If I were using stateful I<br>see how an agenda group solves that need.. In the calling java that is<br>nice. setFocus().. But stateless blocks that api.<br><br>So I have attempted with auto-focus..<br><br>In the DRL (from XLS) however getting the agenda group settings right<br>has been a small 'mare. Suffice to say I haven't got it working.<br><br>My options:<br> 1. get agenda groups working.<br>2. split the three groups into 3 DRL files. and execute in sequence<br>each one using a different ksession for each.<br><br>--- on 1.<br><br>How would I construct the flow.. .. Do I use three separate auto focus<br>rules , one for each a.group &nbsp;and set a salience ( I don think<br>salience helps here ) ? How do I guarantee to stack the focus using<br>auto-focus to follow my ordering?<br><br>-- on 2.<br>Can I create a separate ksession for each DRL file (injecting them in<br>from spring).<br><br>--<br>Thoughts ? Am I solving right ?<br><br>Many thanks. Ramon<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br><br></blockquote>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote></div><br></div></body></html>