Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » QVT to attach elements as children to a root element
QVT to attach elements as children to a root element [message #1724357] Tue, 23 February 2016 10:58 Go to next message
Michael Zach is currently offline Michael ZachFriend
Messages: 7
Registered: November 2015
Junior Member
Hello,

for MDA I have been using QVT and XPAND.

But as it seems to me, XPAND is always needing a root element in the model to start from. And I have not been able so far to write a QVT script which creates such a root element and then attaches all other elements transformed from the source (PIM) model in such a way, that they are attached as children to the root element (e.g. representing the model itself).

How are you doing this?

Kind regards
Michael

have been following these tutorials so far:
http://www.vogella.com/tutorials/EclipseEMF/article.html
http://redpanda.nl/index.php?p=tutorial9
http://www.peterfriese.de/getting-started-with-code-generation-with-xpand/

[Updated on: Tue, 23 February 2016 11:07]

Report message to a moderator

Re: QVT to attach elements as children to a root element [message #1724368 is a reply to message #1724357] Tue, 23 February 2016 11:41 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5629
Registered: July 2009
Senior Member
Hi

If you want a root element then you must model it, perhaps with a Root
metamodel element that can contain all sorts of Element from which all
other classes derive.

cf UML where a Model is typically the root and everything else is an
Element.

The above is true for all modeling tools. I'm not familiar with Xpand
but it may be closer to a Java/XML tool and so may reify the document
(EMF Resource) as a root object whose contents are Resource.contents.

Regards

Ed Willink


On 23/02/2016 10:58, Michael Zach wrote:
> Hello,
>
> for MDA I have been using QVT and XPAND.
> But as it seems to me, XPAND is always needing a root element in the
> model to start from. And I have not been able so far to write a QVT
> script which creates such a root element and then attaches all other
> elements transformed from the source (PIM) model in such a way, that
> they are attached as children to the root element (e.g. representing
> the model itself).
>
> How are you doing this?
>
> Kind regards
> Michael
>
>
Re: QVT to attach elements as children to a root element [message #1725213 is a reply to message #1724368] Tue, 01 March 2016 18:13 Go to previous messageGo to next message
Michael Zach is currently offline Michael ZachFriend
Messages: 7
Registered: November 2015
Junior Member
Hi Ed,

> If you want a root element then you must model it.

Yes of course.

But I want to (in an MDA like approach) define a platform-independent model (PIM) and then use QVT to transform this into a platform-specific model (PSM).

First I create a new empty root element in the PSM, copy all properties for it over from the root in the PIM (possibly transform the values ...). Thats OK.

But then the point is, I can not find a way in QVT how to create other new elements in the PSM which I can then attach as sub-elements to the root-element. They all end up as root elements.

Does anyone have some example code in QVT where I can see if/how this is possible?

Thanks,
Michael
Re: QVT to attach elements as children to a root element [message #1725215 is a reply to message #1725213] Tue, 01 March 2016 18:52 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5629
Registered: July 2009
Senior Member
Hi

The distributed UML2RDBMS example creates hierarchy.

Generally if you want something to have a non-null container you need to
assign that non-null container, either by setting a modeled container,
or more commonly by assigning a set of contained children.

Regards

Ed Willink


On 01/03/2016 18:13, Michael Zach wrote:
> Hi Ed,
>
>> If you want a root element then you must model it.
>
> Yes of course.
>
> But I want to (in an MDA like approach) define a platform-independent
> model (PIM) and then use QVT to transform this into a
> platform-specific model (PSM).
>
> First I create a new empty root element in the PSM, copy all
> properties for it over from the root in the PIM (possibly transform
> the values ...). Thats OK.
>
> But then the point is, I can not find a way in QVT how to create other
> new elements in the PSM which I can then attach as sub-elements to the
> root-element. They all end up as root elements.
>
> Does anyone have some example code in QVT where I can see if/how this
> is possible?
>
> Thanks,
> Michael
Previous Topic:[QVTo] How to load separated (externalized) profile applications in QVTo transformations ?
Next Topic:BlackBox: can not find .class files even in neon (qvt 3.5)
Goto Forum:
  


Current Time: Wed Feb 21 09:05:31 GMT 2018

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

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