<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri","sans-serif";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Sorry to repost again…. But I also realized after sending that if you have to exclude locations A, B, and C from the else rule, then you do not need salience,
nor activation group, since all the rules are not mutually exclusive.. This this (much easier too now)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoPlainText">rule 'Rule One'<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location == 'A', age > 60 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">rule 'Rule Two'<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location == 'B', age > 70 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">rule 'Rule Three'<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location == 'C', age > 80 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">rule 'Rule Else'<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location not in (‘A’,’B’,’C’), age > 65 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--Armand<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b>On Behalf Of </b>Welsh, Armand<br>
<b>Sent:</b> Wednesday, November 23, 2011 12:50 PM<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] multi-factor rule<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Oh… I misread the pseudo code. I missed that the if (age>60) is inside the if(location==”A”) rule. This is easy enough to fix. It’s would essentially be the
same thing as the otherwise, but in DRL:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoPlainText">rule 'Rule One'<o:p></o:p></p>
<p class="MsoPlainText">activation-group 'age-test'<o:p></o:p></p>
<p class="MsoPlainText">salience 300<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location == 'A', age > 60 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">rule 'Rule Two'<o:p></o:p></p>
<p class="MsoPlainText">activation-group 'age-test'<o:p></o:p></p>
<p class="MsoPlainText">salience 200<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location == 'B', age > 70 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">rule 'Rule Three'<o:p></o:p></p>
<p class="MsoPlainText">activation-group 'age-test'<o:p></o:p></p>
<p class="MsoPlainText">salience 100<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location == 'C', age > 80 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">rule 'Rule Else'<o:p></o:p></p>
<p class="MsoPlainText">activation-group 'age-test'<o:p></o:p></p>
<p class="MsoPlainText">when<o:p></o:p></p>
<p class="MsoPlainText"> Person (location not in (‘A’,’B’,’C’), age > 65 )<o:p></o:p></p>
<p class="MsoPlainText">Then<o:p></o:p></p>
<p class="MsoPlainText"> do_something();<o:p></o:p></p>
<p class="MsoPlainText">end<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This is a good example why it can be difficult to model rules from procedural language. With a rule, you are reacting to a given condition, but with procedural
language waterfall logic, you automatically exclude conditions as you fall through the logic. With rules, there is not waterfall effect. You have to simulate the waterfall logic with explicit exclusions.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">This is best represented with a lot of if() but no else clauses in procedural language logic.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Not the only rule I modified to make this work was my else rule.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Armand<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b>On Behalf Of </b>Ronald Albury<br>
<b>Sent:</b> Wednesday, November 23, 2011 11:22 AM<br>
<b>To:</b> rules-users@lists.jboss.org<br>
<b>Subject:</b> Re: [rules-users] multi-factor rule<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Armand <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I don't think that works if location=='B' and age=68<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
</body>
</html>