You have to establish one representative of each subgroup that is markedly distinct from all of its siblings in the same subgroup. This triggers a single firing for a unique a/b combination. Then you can collect all those that match the representative. With attribute c being what it is in your example:<br>
<br>Fact( $a: a, $b: b, $c: c )<br>not Fact( c &lt; $c )<br>$list: List() from collect ( Fact( a == $a, b == $b ) )<br><br>-W<br><br><div class="gmail_quote">On 14 May 2012 21:05, Mike Goldner <span dir="ltr">&lt;<a href="mailto:mike@thegoldners.com" target="_blank">mike@thegoldners.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:14px;font-family:Arial,sans-serif;word-wrap:break-word"><div><div><div>I have a single rule that includes a &quot;collect&quot; pattern to pass a collection to the RHS.  However, what I now need to do fire this rule for multiple collections based on groupings defined by attributes on the fact.</div>
<div><br></div><div>Here is an example:</div><div><br></div><div><div>Fact(a = 1, b = 1, c = 1)</div></div><div><div>Fact(a = 1, b = 1, c = 2)</div></div><div><div>Fact(a = 2, b = 1, c = 3)</div></div><div><div>Fact(a = 2, b = 2, c = 4)</div>
</div><div><div>Fact(a = 2, b = 2, c = 5)</div></div><div><br></div><div>I would like to create sub-groups based on the attributes &#39;a&#39; and &#39;b&#39;.  My rule should fire three times for the facts listed above, providing the corresponding collection of Fact.</div>
<div><br></div><div>The only solution that I can think of is to build a HashSet and add each Fact to the HashSet using the attributes as keys.  I suppose it would have to be a nested set since I can&#39;t define a multi-valued key class within a rule.  I could then handle this HashSet in a RHS block.  However, I realize that I&#39;m completely subverting the whole rule language…</div>
<div><br></div><div>Any suggestions?</div><div><br></div><div>Thanks,</div><div><br></div><div>Mike</div></div></div></div>
<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>