Something like this?<br><br><span style="font-family: courier new,monospace;">when</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    $t : Town( )</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    $s : SuperMarket( town == $t, $lid : locationId )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    $ls : HashSet( size == 3) from ( Location( locationId = $lid ) )</span><br style="font-family: courier new,monospace;">
<br>I suspect Location would have to override equals and hashCode correctly.<br><br>Once you have some DRL that works I&#39;d suggest moving to Guvnor.<br><br><div class="gmail_quote">On 12 November 2011 23:15, LCode <span dir="ltr">&lt;<a href="mailto:j_whittlesea@hotmail.com">j_whittlesea@hotmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I am trying to write a rule via the guided rule editor and I am really<br>
struggling.<br>
<br>
The following is a simplified explanation of my scenario:<br>
<br>
I have a model where there are lots of &#39;Town&#39; objects, each town has any<br>
number of &#39;Supermarket&#39; objects and each supermarket has a list of integers<br>
&#39;locationID&#39;.<br>
<br>
Something like this....<br>
<br>
        &lt;Town&gt;<br>
                &lt;Supermarket name = &#39;asda&#39;&gt;<br>
                        &lt;LocationID&gt;15&lt;/LocationID&gt;<br>
                        &lt;LocationID&gt;18&lt;/LocationID&gt;<br>
                &lt;/Supermarket&gt;<br>
                &lt;Supermarket name = &#39;tesco&#39;&gt;<br>
                        &lt;LocationID&gt;13&lt;/LocationID&gt;<br>
                &lt;/Supermarket&gt;<br>
                &lt;Supermarket name = &#39;lidl&#39;&gt;<br>
                        &lt;LocationID&gt;13&lt;/LocationID&gt;<br>
                        &lt;LocationID&gt;15&lt;/LocationID&gt;<br>
                        &lt;LocationID&gt;18&lt;/LocationID&gt;<br>
                &lt;/Supermarket&gt;<br>
        &lt;/Town&gt;<br>
<br>
(apologies to the Sainsburys shoppers!!)<br>
<br>
I need to write a rule that fires when there are precisely 3 unique location<br>
ID&#39;s in the whole town.<br>
<br>
So in the example above the complete list of locationIDs would be 13, 13,<br>
15, 15, 18, 18<br>
With the following unique numbers 13, 15, 18<br>
therefore the rule would fire as there are 3 unique numbers.<br>
<br>
I hope that makes some sense.<br>
<br>
I understand that I should collect the locationIDs into a java.util.Set in<br>
order to count unique entries and I can collect together all supermarkets<br>
into an arraylist. However I cannot for the life of me seem to collect<br>
LocationID across all supermarkets.<br>
<br>
Thank you so much in anticipation, I realise this was rather long-winded!<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Collecting-properties-in-a-rule-tp3503523p3503523.html" target="_blank">http://drools.46999.n3.nabble.com/Collecting-properties-in-a-rule-tp3503523p3503523.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</font></span></blockquote></div><br>