<br><br><div class="gmail_quote">On 24 March 2011 20:03, Joe White <span dir="ltr">&lt;<a href="mailto:Joe.White@recondotech.com">Joe.White@recondotech.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Wolfgang I use patterns like that for a data filtering problem and also for a preferential selection problem. Any time I have two sources of the same data and I prefer one over the other that pattern allows you to pick the secondary source when the preferred data doesn’t exist. Also used in cases where we want to execute a different action in the absence of the second source.</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">It also occurs for us when dealing with a list of objects where we have two sources for the same type of data and we prefer one data source over the other, but we don’t always get data for the preferred source.. We use your pattern to make sure the preferred source doesn’t exist before using the secondary source</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p></div></div></blockquote><div><br>So you distinguish &quot;source&quot; by ranges of a numeric property? This is unusual. For your use case I&#39;d expect something like<br>
<br>   not Data( source == Source.PRIM )<br>   Data( source == Source.SEC, ... )<br><br>To clarify, here is the rule logic I posted, written with a redundant constraint in the first pattern.<br><br>   Fact( field &gt;= 10 &amp;&amp; field &lt;= 20 )  // if &gt; 20, LHS fails due to &quot;not&quot;<br>
   not Fact( field &gt; 20 )<br><br><br>Thanks<br>Wolfgang<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="EN-US">
<div><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Joe </span></p><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Here is an example from our code. $ebs is a List&lt;Map&gt;. Mapping to your example the Map is the fact and the combination of BnftInfoCdoe and BnftCvgeLevelCode would be the field.:</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">  Map(</span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.BnftInfoCode] == </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&#39;C&#39;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">,</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">      </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.BnftCvgeLevelCode] == </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&#39;IND&#39;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">,</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">      </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.SvcTypeCode] == </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&quot;30&quot;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">,</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></p>
<p class="MsoNormal" style="text-indent: 0.5in;"><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.CvgePeriodQlfr] == </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&#39;25&#39;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">, </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">      </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.BnftAmt] </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">matches</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&quot;0.*&quot;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">) </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">from</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> $ebs</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></p>
<p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></p><p class="MsoNormal" style=""><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">not</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> (Map(</span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.BnftInfoCode] == </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&#39;C&#39;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">,</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">          </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">this</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">[BenefitsConsts.BenefitResponseEligibility.BnftCvgeLevelCode] == </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&#39;FAM&#39;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">) </span><b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0);">from</span></b><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> $ebs)</span><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p><div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:rules-dev-bounces@lists.jboss.org" target="_blank">rules-dev-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-dev-bounces@lists.jboss.org" target="_blank">rules-dev-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Wolfgang Laun<br>
<b>Sent:</b> Thursday, March 24, 2011 11:07 AM<br><b>To:</b> Rules Dev List<div class="im"><br><b>Subject:</b> [rules-dev] An odd couple of patterns</div></span></p></div><p class="MsoNormal"> </p><p class="MsoNormal">Has anybody ever seen a situation where a couple of patterns such as</p>
<div><div></div><div class="h5"><br><br>   Fact( field &gt;= 10 )<br>   not Fact( field &gt; 20 )<br><br>was appropriate? This does not match Facts where field isn&#39;t between 10 and 20, and so it would seem to be the same as<br>
<br>   Fact( field &gt;= 10 &amp;&amp; &lt;= 20 )<br><br>but actually it doesn&#39;t match any such Fact whenever any <i>other</i> Fact with field &gt; 20 is around.<br><br>Cheers<br>Wolfgang</div></div></div></div><br>_______________________________________________<br>

rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br>