<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:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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;}
@font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
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:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-NZ link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='color:#1F497D'>Thanks for the ideas, David.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>What I ultimately want to achieve is to have the individual rules independent of each other to the maximal degree to which that is possible.  That&#8217;s why I didn&#8217; t want to have isZombie==false in the general rule &#8211; I wanted the general case to be unaware of the exceptions.  The field in which I&#8217;m working is clinical decision support where there might be a number of exceptions and corner cases.  I&#8217;d like to be able to express the core logic without reference to the corner cases and then deal with the exceptions separately.  <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I think your idea of using salience but only adding advice if it hasn&#8217;t already been given fits the bill &#8211; that way the general case can be simple and not have to explicitly exclude all the exception cases.  <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thanks very much for the feedback &#8211; it&#8217;s really valuable to get an idea about what options are available and what&#8217;s considered best practice.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Cheers!<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Peter.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US 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>David Faulkner<br><b>Sent:</b> Wednesday, 9 March 2011 4:51 p.m.<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] Misunderstanding salience?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>Peter,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>The EXACT way to accomplish the functionality that you are looking for is &#8220;activation-group&#8221;; if two rules are in the same activation group, only one of them will fire. Note that the rule with HIGHER salience will fire first; to accomplish what you are looking for you&#8217;d have to give the exception rule a higher salience.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>I would also note that although there are specific instances where activation-group has a strong need, many in the community find that the most power and flexibility from the rule engine comes from &#8220;letting go&#8221; of trying to exactly order your rule execution, and instead letting the rule engine decide what would happen here. One way to accomplish this in your case would be to simply add (isZombie == false) to your constraint on the general rule. &nbsp;Another way that involves salience but NOT agenda groups is to set a high salience on your exception rule, but only add advice if advice is null. The possibilities are endless. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>With kind regards,<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>David Faulkner<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:#1F497D'>david.faulkner@amentra.com<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US 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>Peter Ashford<br><b>Sent:</b> Wednesday, March 09, 2011 7:24 AM<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] Misunderstanding salience?<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Actually, I think I&#8217;ve figured this one out : in the Zombie case, it&#8217;s firing both rules and it&#8217;s just that with the negative salience,&nbsp; the zombie exception rule is the last rule fired, therefore, the last thing written into advice.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>So... what would be the correct way to do what I&#8217;m trying to do here? &nbsp;The idea is that the Zombie exception rule should fire in preference to the general rule and that none of the general processing should occur at all (imaging that these rules had side-effects for the rest of the system they&#8217;re attached to, we don&#8217;t want all the general rule side effects to apply and then all the exception case side effects)<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Thanks in advance!<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Peter.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US 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>Peter Ashford<br><b>Sent:</b> Wednesday, 9 March 2011 1:31 p.m.<br><b>To:</b> rules-users@lists.jboss.org<br><b>Subject:</b> [rules-users] Misunderstanding salience?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Hi There<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I&#8217;m new to drools.&nbsp; I&#8217;ve just set up the Drools-Server and it is (finally!) working and serving my test rule-set.&nbsp; The one thing that&#8217;s not working as I expect it is the rule ordering via salience.&nbsp; This is my simple test rule set:<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='text-autospace:none'><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>rule</span></b><span style='font-size:8.0pt;font-family:"Courier New";color:black'> </span><span style='font-size:8.0pt;font-family:"Courier New";color:green'>&quot;General brain eating advice&quot;</span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>when</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p : Patient(eatsBrains == </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>true</span></b><span style='font-size:8.0pt;font-family:"Courier New";color:black'>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>then</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p.setAdvice(</span><span style='font-size:8.0pt;font-family:"Courier New";color:green'>&quot;Stop eating brains, or at least, try to cut down&quot;</span><span style='font-size:8.0pt;font-family:"Courier New";color:black'>);&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>end</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>rule</span></b><span style='font-size:8.0pt;font-family:"Courier New";color:black'> </span><span style='font-size:8.0pt;font-family:"Courier New";color:green'>&quot;Zombie exception to brain eating advice&quot;</span><span style='font-size:8.0pt;font-family:"Courier New";color:black'> </span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>salience</span></b><span style='font-size:8.0pt;font-family:"Courier New";color:black'> -50</span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>when</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p : Patient(eatsBrains == </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>true</span></b><span style='font-size:8.0pt;font-family:"Courier New";color:black'>, isZombie == </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>true</span></b><span style='font-size:8.0pt;font-family:"Courier New";color:black'>)</span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>then</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p.setAdvice(</span><span style='font-size:8.0pt;font-family:"Courier New";color:green'>&quot;Evidence suggests that the undead cannot contract Kuru or that the effects are irellevant given the &quot;</span><span style='font-size:8.0pt;font-family:"Courier New";color:black'> +</span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </span><span style='font-size:8.0pt;font-family:"Courier New";color:green'>&quot;patient's current zombified state.\nSuggest euthenasing patient lest he/she eat your (or someone &quot;</span><span style='font-size:8.0pt;font-family:"Courier New";color:black'> +</span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:8.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; </span><span style='font-size:8.0pt;font-family:"Courier New";color:green'>&quot;else's) brains&quot;</span><span style='font-size:8.0pt;font-family:"Courier New";color:black'>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><b><span style='font-size:8.0pt;font-family:"Courier New";color:#960000'>end</span></b><span style='font-size:8.0pt;font-family:"Courier New"'><o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>The idea is that the first rule fires all the time unless the patient happens to be a zombie, in which case the exception rule (the second rule) kicks in.&nbsp; Now, as I have it here, with the exception at salience at -50 it actually works, which is the opposite of what I was expecting.&nbsp; I&#8217;d thought that I would have had to have the exception at a higher salience to fire first.&nbsp; That was what I tried first but that didn&#8217;t work &#8211; everyone got the general advice, zombies included.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>What am I misunderstanding here?<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Thanks!<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Peter.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Georgia","serif";color:black'>---<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Georgia","serif";color:black'>&#8220;It is very difficult to get a man to understand something when his tribal identity depends on his not understanding it&#8221;</span><span style='font-size:10.0pt'> </span><span style='font-size:10.0pt;font-family:"Georgia","serif"'>- Michael Bérubé on Republican climate change denial.</span><o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>