that sounds correct.<br><br>No you can&#39;t really depend on things happening in a certain order. of course it will be consistent between executions for the same data, but you can&#39;t count on that. It would mostly be effected by the order in which you assert facts. 
<br><br>I guess the question is why are you concerned in what order it does things?<br><br>Michael<br><br><div><span class="gmail_quote">On 2/13/07, <b class="gmail_sendername">Olenin, Vladimir (MOH)</b> &lt;<a href="mailto:Vladimir.Olenin@moh.gov.on.ca">
Vladimir.Olenin@moh.gov.on.ca</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br><br>I was trying to find more detailed explanation on how the fact tuples for
<br>activations are being selected based on the constraints, but couldn&#39;t find<br>much. So, I guess I just want to assert my understanding of this process is<br>correct.<br><br>Assuming I have the following set of &#39;Accounts&#39; with the fields:
<br><br>ID&nbsp;&nbsp;| Province&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | City&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| Balance<br>----------------------------------------------------------------<br> 1&nbsp;&nbsp;| ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Toronto&nbsp;&nbsp;&nbsp;&nbsp; | Checking&nbsp;&nbsp;&nbsp;&nbsp;| 1000<br> 2&nbsp;&nbsp;| BC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Vancouver&nbsp;&nbsp; | Checking&nbsp;&nbsp;&nbsp;&nbsp;| 100
<br> 3&nbsp;&nbsp;| ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Toronto&nbsp;&nbsp;&nbsp;&nbsp; | Visa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2000<br> 4&nbsp;&nbsp;| ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Toronto&nbsp;&nbsp;&nbsp;&nbsp; | Checking&nbsp;&nbsp;&nbsp;&nbsp;|-100<br> 5&nbsp;&nbsp;| BC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Vancouver&nbsp;&nbsp; | Checking&nbsp;&nbsp;&nbsp;&nbsp;| 100<br> 6&nbsp;&nbsp;| BC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Vancouver&nbsp;&nbsp; | Visa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 150
<br> 7&nbsp;&nbsp;| AB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Calgary&nbsp;&nbsp;&nbsp;&nbsp; | Checking&nbsp;&nbsp;&nbsp;&nbsp;| 100<br> 7&nbsp;&nbsp;| AB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Toronto&nbsp;&nbsp;&nbsp;&nbsp; | Checking&nbsp;&nbsp;&nbsp;&nbsp;| 300<br><br>I have two rules to process:<br><br>1) within each province, the sum of balances on Visa accounts should less
<br>then 10 times the sum of balances on Checking accounts (within the same<br>province)<br>2) within each province, the sum of balances on Checking accounts should be<br>a positive number<br>3) within each province and within each city, the number of visa accounts
<br>should be no more than 2 times the number of checking accounts<br><br>If I model my business objects like this:<br><br>1) Account&nbsp;&nbsp;(id, province, city, type, balance)<br>2) Province (province)<br>3) City&nbsp;&nbsp;&nbsp;&nbsp; (province, city)
<br><br><br>And WorkingMemory will be initialized (for the data above) with:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 7 Account instances (ids 1 through 7)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 3 Province instances (ON, AB, BC)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- 3 City instances (Toronto, Vancouver, Calgary)
<br><br><br>Then the rules containing &#39;within province&#39; would read like:<br>-----------------<br>Rule &#39;1&#39;<br>When<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Province($prov: province)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$a: Account(province == $prov)<br>Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// accumulate sums on Checking and Visa accounts as Edson showed in
<br>previous emails<br>End<br>-----------------<br><br><br>The rule containing &#39;within province, within city&#39; would have then:<br>-------------<br>Rule &#39;3&#39;<br>When<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Province($prov: province)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City($city: city, province = $prov)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$a: Account(province = $prov, city = $city)<br>Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// accumulate sums on Checking and Visa accounts as Edson showed in<br>previous emails<br>-------------<br><br><br>Is this correct business object model to achieve the goal? Do I understand
<br>correctly that the LHS statement:<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Province($prov: province)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City($city: city, province = $prov)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$a: Account(province = $prov, city = $city)<br><br><br>Can be read as:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For each province
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For each city within the province<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For each account for the given city and province<br><br><br><br>What &#39;guides&#39; the order in which fact tuples are selected from the set of
<br>all facts in the WorkingMemory? Can any particular sequence be guaranteed?<br><br>Thanks!<br><br>Vlad<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br>