Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » merge two models with same metamodel?
merge two models with same metamodel? [message #649992] Fri, 21 January 2011 10:31 Go to next message
Alex Schenkman is currently offline Alex SchenkmanFriend
Messages: 21
Registered: October 2009
Location: Sweden
Junior Member
Hello forum,

How can I merge to models having the same metamodel?

Thanks in advance!
Re: merge two models with same metamodel? [message #650031 is a reply to message #649992] Fri, 21 January 2011 13:31 Go to previous messageGo to next message
Dennis Hendriks is currently offline Dennis HendriksFriend
Messages: 66
Registered: January 2010
Location: Eindhoven, The Netherland...
Member
Hello Alex,

Some questions to get a clear picture of what you are trying to do:

1) In what language do you want to do that (QVTo, ATL, Java, ...)?

2) What language are we talking about? Does the language/metamodel allow
for merging? If for instance you have a metamodel representing a program,
and multiple programs is not expected, then it may not even be possible...
If on the other hand you would want to merge function definitions of two
programs of a functional language, then that may be possible, providing
some constraints like "the function names of both programs must be disjunct"...

Without more information your question is impossible to answer.

Best,
Dennis


Alex Schenkman wrote:
> Hello forum,
>
> How can I merge to models having the same metamodel?
>
> Thanks in advance!
Re: merge two models with same metamodel? [message #650038 is a reply to message #650031] Fri, 21 January 2011 14:20 Go to previous messageGo to next message
Alex Schenkman is currently offline Alex SchenkmanFriend
Messages: 21
Registered: October 2009
Location: Sweden
Junior Member
Let's take a simple case:

- Using one ecore metamodel.
- Both modelA and modelB comply to it.
- modelA, has a few hundred classes.
- modelB has ten classes.

I want to add those ten classes to modelA.

The language can be ATL or Java.

Thanks!

Re: merge two models with same metamodel? [message #650055 is a reply to message #650038] Fri, 21 January 2011 15:03 Go to previous messageGo to next message
Dennis Hendriks is currently offline Dennis HendriksFriend
Messages: 66
Registered: January 2010
Location: Eindhoven, The Netherland...
Member
In Java, assuming the classes you talk about are all root objects, and
modelA and modelB are EMF resources, something like this should work:

Resource modelA = ...;
Resource modelB = ...;
modelA.getContents().addAll(modelB.getContents());

Best,
Dennis



Alex Schenkman wrote:
> Let's take a simple case:
>
> - Using one ecore metamodel. - Both modelA and modelB comply to it.
> - modelA, has a few hundred classes.
> - modelB has ten classes.
>
> I want to add those ten classes to modelA.
>
> The language can be ATL or Java.
>
> Thanks!
>
>
Re: merge two models with same metamodel? [message #650058 is a reply to message #650055] Fri, 21 January 2011 15:13 Go to previous messageGo to next message
Alex Schenkman is currently offline Alex SchenkmanFriend
Messages: 21
Registered: October 2009
Location: Sweden
Junior Member
Very interesting...
so objects will be placed in the right places, and links created and everything?

Is it that simple in ATL as well?

Re: merge two models with same metamodel? [message #650060 is a reply to message #650058] Fri, 21 January 2011 15:19 Go to previous messageGo to next message
Dennis Hendriks is currently offline Dennis HendriksFriend
Messages: 66
Registered: January 2010
Location: Eindhoven, The Netherland...
Member
Alex Schenkman wrote:
> Very interesting...
> so objects will be placed in the right places, and links created and
> everything?

The links are already there, since you loaded the resource previously.
Basically the containment is changed to the other resource.

> Is it that simple in ATL as well?

I don't know...

Best,
Dennis
Re: merge two models with same metamodel? [message #650088 is a reply to message #650058] Fri, 21 January 2011 16:57 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
This is possible with ATL too. To merge a few models just pass in many input models into the ATL transform.

For a more advanced merge where there won't be duplicates consider the ATL use-case in the zoo at http://www.eclipse.org/m2m/atl/atlTransformations/#UMLMergeM odel
Regards,
Ronan
Previous Topic:No overriding, but just changing the differences in m2m transformations
Next Topic:QVT update failed
Goto Forum:
  


Current Time: Mon Sep 23 11:03:13 GMT 2019

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

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

Back to the top