[Acceleo]Collections of Collections on Queries [message #500602] |
Thu, 26 November 2009 21:44  |
Eclipse User |
|
|
|
Hi
Is it possible to use collections of collections as return of a query? i've tried the code below, but the type 'Sequence(Sequente(T))' is Invalid.
[query public packages2(input : MetaComponent) : Sequence(Sequence(T)) =
input.properties->iterate(item : Property; res : Sequence(Sequence(String)) = Sequence{Sequence{}} | res->append(
item.type.ancestors(Package)->iterate(pack : Package; retur : Sequence(String) = Sequence{} | retur->append(pack.name))
)) /]
And what about the initialization of a collection of collection? i've tried 'Sequence{Sequence{}}', but i dont know if it is right.
thanks
[Updated on: Fri, 27 November 2009 08:58] by Moderator
|
|
|
Re: Collections of Collections on Queries [message #500640 is a reply to message #500602] |
Fri, 27 November 2009 04:33   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------020008040900020608000409
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Andre,
You can initialize sequences containing Sequence like you described here
: "Sequence{Sequence{'a', 'b'}, Sequence{'c'}}" is perfectly legal.
However, the current implementation of OCL will prevent you from using
Sequences typed with Sequences : "Sequence(Sequence(String))" is
illegal. That means you cannot define Acceleo queries returning such
sequences, and you cannot cast to them either "Sequence{Sequence{'a',
'b'}, Sequence{'c'}}.oclAsType(Sequence(Sequence(String)))" will fail in
compilation error.
Laurent Goubet
Obeo
Andre wrote:
> Hi
>
> Is it possible to use collections of collections as return of a query?
> i've tried the code below, but the type 'Sequence(Sequente(T))' is Invalid.
>
> [query public packages2(input : MetaComponent) : Sequence(Sequence(T)) =
> input.properties->iterate(item : Property; res :
> Sequence(Sequence(String)) = Sequence{Sequence{}} | res->append(
> item.type.ancestors(Package)->iterate(pack : Package; retur :
> Sequence(String) = Sequence{} | retur->append(pack.name))
> )) /]
>
>
> And what about the initialization of a collection of collection? i've
> tried 'Sequence{Sequence{}}', but i dont know if it is right.
>
> thanks
>
--------------020008040900020608000409
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------020008040900020608000409--
|
|
|
|
|
|
Re: Collections of Collections on Queries [message #500794 is a reply to message #500789] |
Sat, 28 November 2009 14:53  |
Eclipse User |
|
|
|
Hi
Based on this problem and other tests, i've concluded that on queries like these, when a query calls another, the error message is always 'Invalid Operation Signature', even when there is another type of error subsequent on the query. So, the developer thinks that the problem is on the call to the other query, when it isn't.
|
|
|
Powered by
FUDForum. Page generated in 0.03854 seconds