I have a single rule that includes a "collect" 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.

Here is an example:

Fact(a = 1, b = 1, c = 1)
Fact(a = 1, b = 1, c = 2)
Fact(a = 2, b = 1, c = 3)
Fact(a = 2, b = 2, c = 4)
Fact(a = 2, b = 2, c = 5)

I would like to create sub-groups based on the attributes 'a' and 'b'.  My rule should fire three times for the facts listed above, providing the corresponding collection of Fact.

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'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'm completely subverting the whole rule language…

Any suggestions?

Thanks,

Mike