This is possible with an accumulate where you code the init/action/result explicily. Perhaps not fully &quot;out of the box&quot; but a box that holds everything would be rather big, wouldn&#39;t it? ;-)<br><br>-W<br><br><div class="gmail_quote">
2011/11/15 Bruno Freudensprung <span dir="ltr">&lt;<a href="mailto:bruno.freudensprung@temis.com">bruno.freudensprung@temis.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  

    
  
  <div text="#000000" bgcolor="#ffffff">
    Hi all,<br>
    <br>
    There is something I can&#39;t express using &quot;collect&quot; or &quot;accumulate&quot;
    and I would like to have your opinion.<br>
    Let&#39;s imagine I have the following types :<br>
    <br>
    <tt>    # a country type <br>
      <b>    declare Country<br>
               name : String<br>
            end<br>
      </b><br>
          # a city type holding a reference to its country<br>
      <b>    declare City<br>
               name : String<br>
               country : Country<br>
            end<br>
      </b></tt>
    <br>
    Let&#39;s imagine I have all Country and City objects into the working
    memory.<br>
    I want to get the set of Countries corresponding to Cities whose
    name starts with &quot;X&quot;.<br>
    <br>
    I have the impression that I need a kind of (nonexistent right?)
    &quot;collect&quot; syntax that would look like the &quot;accumulate&quot; syntax (a
    kind of &quot;anonymous&quot; accumulate function):<br>
    <br>
    <tt>    # meaning I want to collect $country objects and not City
      objects<br>
    </tt><tt>    $countries : HashSet() from collect (City($name matches
      &quot;X.*&quot;, $country : country)<b>, $country</b>)<br>
    </tt><br>
    Or a home made accumulate function that builds a set of countries:<br>
    <br>
    <tt>    # custom &quot;buildset&quot; accumulate function<br>
    </tt><tt>    $countries : HashSet() from accumulate (City($name
      matches &quot;X.*&quot;, $country : country), <b>buildset</b>($country))<br>
    </tt>
    <br>
    Do you see any other (possibly out of the box) solution?<br>
    <br>
    Many thanks in advance for your answers,<br>
    Best regards,<br><font color="#888888">
    <br>
    Bruno.<br>
    <br>
  </font></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>