Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo3] Polymorphism in queries?
icon5.gif  [Acceleo3] Polymorphism in queries? [message #656970] Tue, 01 March 2011 08:36 Go to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 209
Registered: June 2010
Senior Member
Hi,

Assume in my meta model, I have twee classes DataPort and EventPort derived from Port. Can I then make queries like this:

[query public getPortPrefix(p: Port) : String = 'abstract'/]

[query public getPortPrefix(p: DataPort) : String = 'data'/]

[query public getPortPrefix(p: EventPort) : String = 'event'/]

When I iterate over a collection containing event and dataports, it seems to invoke only the base class getPortPrefix query. Preferably, I would have expected something like:

[query public Port::getPortPrefix() : String = 'abstract'/]
[query public DataPort::getPortPrefix() : String = 'data'/]
[query public EventPort::getPortPrefix() : String = 'event'/]

Greetings,
Wilbert.
Re: [Acceleo3] Polymorphism in queries? [message #656975 is a reply to message #656970] Tue, 01 March 2011 08:46 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010302090801040003030905
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Wilbert,

Polymorphism is currently not supported for queries. The reason for this
choice is that the specification on which Acceleo is based (MOF Model To
Text Transformation Language, see http://www.omg.org/spec/MOFM2T/1.0/ )
does describe polymorphism (or rather, invocation rules) for templates,
but it does not for queries.

We might change this rule in the future, but it is not planned yet.

Laurent Goubet
Obeo

On 01/03/2011 09:36, Wilbert Alberts wrote:
> Hi,
>
> Assume in my meta model, I have twee classes DataPort and EventPort
> derived from Port. Can I then make queries like this:
>
> [query public getPortPrefix(p: Port) : String = 'abstract'/]
>
> [query public getPortPrefix(p: DataPort) : String = 'data'/]
>
> [query public getPortPrefix(p: EventPort) : String = 'event'/]
>
> When I iterate over a collection containing event and dataports, it
> seems to invoke only the base class getPortPrefix query. Preferably, I
> would have expected something like:
>
> [query public Port::getPortPrefix() : String = 'abstract'/]
> [query public DataPort::getPortPrefix() : String = 'data'/]
> [query public EventPort::getPortPrefix() : String = 'event'/]
>
> Greetings,
> Wilbert.


--------------010302090801040003030905
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=
--------------010302090801040003030905--
Previous Topic:[Acceleo] Dynamic model support appears broken
Next Topic:[Acceleo3] for loop over collection
Goto Forum:
  


Current Time: Tue Apr 23 06:57:33 GMT 2024

Powered by FUDForum. Page generated in 0.03156 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top