<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<div>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'>No, I&#8217;m not concerned with the order
in this particular case &#8211; just trying to figure out what I should be
taking into account or rely on when doing the design. Thanks for taking the
time to go through (now that I scrolled through it myself </span></font><font
color=navy face=Wingdings><span style='font-family:Wingdings;color:navy'>J</span></font><font
color=navy><span style='color:navy'> ) this quite lengthy email.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'>Vlad<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'>&nbsp;</span></font><o:p></o:p></p>

</div>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Michael Neale<br>
<b><span style='font-weight:bold'>Sent:</span></b> 12 February 2007 23:53<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">Rules
 Users List</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] fact
tuples selection - what are the principles - a bit confused?</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>that sounds correct.<br>
<br>
No you can'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'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<o:p></o:p></span></font></p>

<div>

<p class=MsoNormal><span class=gmailquote><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>On 2/13/07, <b><span style='font-weight:bold'>Olenin,
Vladimir (MOH)</span></b> &lt;<a href="mailto:Vladimir.Olenin@moh.gov.on.ca">
Vladimir.Olenin@moh.gov.on.ca</a>&gt; wrote:</span></font></span><o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>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'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 'Accounts' 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; | <st1:City
w:st="on"><st1:place w:st="on">Toronto</st1:place></st1:City>&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; | <st1:City
w:st="on">Vancouver</st1:City>&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; | <st1:City
w:st="on"><st1:place w:st="on">Toronto</st1:place></st1:City>&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; | <st1:City
w:st="on"><st1:place w:st="on">Toronto</st1:place></st1:City>&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; | <st1:City
w:st="on"><st1:place w:st="on">Vancouver</st1:place></st1:City>&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; | <st1:City
w:st="on">Vancouver</st1:City>&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;
| <st1:City w:st="on"><st1:place w:st="on">Calgary</st1:place></st1:City>&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; | <st1:City
w:st="on"><st1:place w:st="on">Toronto</st1:place></st1:City>&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 (<st1:City
w:st="on">Toronto</st1:City>, <st1:City w:st="on">Vancouver</st1:City>, <st1:City
w:st="on"><st1:place w:st="on">Calgary</st1:place></st1:City>) <br>
<br>
<br>
Then the rules containing 'within province' would read like:<br>
-----------------<br>
Rule '1'<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 'within province, within city' would have then:<br>
-------------<br>
Rule '3'<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 'guides' 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><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>