Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] e(Generic)SuperTypes
[ATL] e(Generic)SuperTypes [message #504719] Tue, 22 December 2009 10:35 Go to next message
RJ is currently offline RJFriend
Messages: 19
Registered: October 2009
Location: Eindhoven, The Netherland...
Junior Member
Hi,

I'm working on a transformation which requires met to copy entire classes from one model to another. Since it is an ecore model, such a transformation would look as follows:

rule copyEClass{
	from
		a : MM!EClass
	to
		p : MM!EClass(
			abstract <- a.abstract,
			name <- a.name.debug(),
			eAnnotations <- a.eAnnotations,
			eGenericSuperTypes <- a.eGenericSuperTypes,
			eOperations <- a.eOperations,
			eStructuralFeatures <- a.eStructuralFeatures,
			eSuperTypes <- a.eSuperTypes.debug(),
			eTypeParameters <- a.eTypeParameters,
			instanceClassName <- a.instanceClassName,
			instanceTypeName <- a.instanceTypeName,
			interface <- a.interface
		)
}


The problem now is that every inheritance relation gets copied twice, leading to classes looking like this:

<eClassifiers xsi:type="ecore:EClass" name="Container" eSuperTypes="/0/Component /0/Component">


This goes away by not copying either the eSuperTypes or the eGenericSuperTypes, but that seems a little blunt. So my question is, which one (if any) should I remove, what is common practice in this case, and what other solutions are there?

[Updated on: Tue, 22 December 2009 05:36]

Report message to a moderator

Re: [ATL] e(Generic)SuperClass [message #504747 is a reply to message #504719] Tue, 22 December 2009 12:29 Go to previous message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
RJ a écrit :
> Hi,
>
> I'm working on a transformation which requires met to copy entire
> classes from one model to another. Since it is an ecore model, such a
> transformation would look as follows:
>
> rule copyEClass{
> from
> a : MM!EClass
> to
> p : MM!EClass(
> abstract <- a.abstract,
> name <- a.name.debug(),
> eAnnotations <- a.eAnnotations,
> eGenericSuperTypes <- a.eGenericSuperTypes,
> eOperations <- a.eOperations,
> eStructuralFeatures <- a.eStructuralFeatures,
> eSuperTypes <- a.eSuperTypes.debug(),
> eTypeParameters <- a.eTypeParameters,
> instanceClassName <- a.instanceClassName,
> instanceTypeName <- a.instanceTypeName,
> interface <- a.interface
> )
> }
>
> The problem now is that every inheritance relation gets copied twice,
> leading to classes looking like this:
>
> <eClassifiers xsi:type="ecore:EClass" name="Container"
> eSuperTypes="/0/Component /0/Component">

Looking at Ecore.ecore, it appears it is not a merge of both relations,
as the two properties have different types which do not subclass the other.
>
> This goes away by not copying either the eSuperTypes or the
> eGenericSuperTypes, but that seems a little blunt. So my question is,
> which one (if any) should I remove, what is common practice in this
> case, and what other solutions are there?

As the two relations represent/store distinct elements, you should let
them all, except if your models would never use generics.

Try with a model where some elements have the both (a super type and a
generic).

Notice that eGenericSuperTypes is a containment relation so those types
are contained by the EClass element which refers to them.
Previous Topic:[ATL] Character keeps 'disappearing'
Next Topic:[ATL] Migration to Galileo
Goto Forum:
  


Current Time: Fri Apr 26 23:54:28 GMT 2024

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

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

Back to the top