Home » Archived » M2M (model-to-model transformation) » [ATL] Cannot copy attribute types
[ATL] Cannot copy attribute types [message #513458] |
Wed, 10 February 2010 10:09 |
RJ Messages: 19 Registered: October 2009 Location: Eindhoven, The Netherland... |
Junior Member |
|
|
Hi all,
I'm still trying to do model transformations on metamodels, first starting by just simply copying a metamodel, through ATL. I have a very simple metamodel, with just one class, containing one attribute, with type EString:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
nsURI="test" nsPrefix="test">
<eClassifiers xsi:type="ecore:EClass" name="testClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="ID" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</ecore:EPackage>
However, when I run my ATL transformation, the type of the attribute just seems to disappear:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testOutput"
nsURI="testOutput" nsPrefix="testOutput">
<eClassifiers xsi:type="ecore:EClass" name="testClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="ID">
<eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>
It looks like ATL cannot handle the ecore datatypes of something like that. What am I missing here. For completeness sake, here is the transformation I use. It may look long, but all it does is copy the source metamodel 1-on-1 to the target metamodel. (note that I removed the irrelevant parts of the transformation. I fact, I have a rule for all classes of the Ecore meta-metamodel)
-- @path MM=platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore
-- @path MM2=platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore
module merge;
create InstMM : MM2 from AbstMM : MM;
rule copyEPackage{
from
a : MM!EPackage
to
p : MM2!EPackage(
eClassifiers <- a.eClassifiers,
name <- 'testOutput',
nsURI <- 'testOutput',
nsPrefix <- 'testOutput',
eAnnotations <- a.eAnnotations,
eFactoryInstance <- a.eFactoryInstance,
eSubpackages <- a.eSubpackages
)
}
rule copyEClass{
from
a : MM!EClass
to
p : MM2!EClass(
abstract <- a.abstract,
name <- a.name,
eAnnotations <- a.eAnnotations,
eGenericSuperTypes <- a.eGenericSuperTypes,
eOperations <- a.eOperations,
eStructuralFeatures <- a.eStructuralFeatures,
--eSuperTypes <- a.eSuperTypes,
eTypeParameters <- a.eTypeParameters,
instanceClassName <- a.instanceClassName,
instanceTypeName <- a.instanceTypeName,
interface <- a.interface
)
}
rule copyEGenericType{
from
a : MM!EGenericType
to
p : MM2!EGenericType(
eClassifier <- a.eClassifier,
eLowerBound <- a.eLowerBound,
eTypeArguments <- a.eTypeArguments,
eTypeParameter <- a.eTypeParameter,
eUpperBound <- a.eUpperBound
)
}
rule copyEDataType{
from
a : MM!EDataType (a.oclIsTypeOf(MM!EDataType))
to
p : MM2!EDataType(
eAnnotations <- a.eAnnotations,
eTypeParameters <- a.eTypeParameters,
instanceClassName <- a.instanceClassName,
instanceTypeName <- a.instanceTypeName,
name <- a.name,
serializable <- a.serializable
)
}
rule copyEReference{
from
a : MM!EReference
to
p : MM2!EReference(
changeable <- a.changeable,
containment <- a.containment,
defaultValueLiteral <- a.defaultValueLiteral,
derived <- a.derived,
eAnnotations <- a.eAnnotations,
eGenericType <- a.eGenericType,
eKeys <- a.eKeys,
eOpposite <- a.eOpposite,
eType <- a.eType,
lowerBound <- a.lowerBound,
name <- a.name,
ordered <- a.ordered,
resolveProxies <- a.resolveProxies,
transient <- a.transient,
unique <- a.unique,
unsettable <- a.unsettable,
upperBound <- a.upperBound,
volatile <- a.volatile
)
}
rule copyEAttribute{
from
a : MM!EAttribute
to
p : MM2!EAttribute(
changeable <- a.changeable,
defaultValueLiteral <- a.defaultValueLiteral,
derived <- a.derived,
eAnnotations <- a.eAnnotations,
eGenericType <- a.eGenericType,
eType <- a.eType,
lowerBound <- a.lowerBound,
name <- a.name,
ordered <- a.ordered,
transient <- a.transient,
unique <- a.unique,
unsettable <- a.unsettable,
upperBound <- a.upperBound,
volatile <- a.volatile,
iD <- a.iD
)
}
rule copyETypeParameter{
from
a : MM!ETypeParameter
to
p : MM2!ETypeParameter(
eAnnotations <- a.eAnnotations,
eBounds <- a.eBounds,
name <- a.name
)
}
rule copyEFactory{
from
a : MM!EFactory
to
p : MM2!EFactory(
eAnnotations <- a.eAnnotations,
ePackage <- a.ePackage
)
}
rule copyEObject{
from
a : MM!EObject (a.oclIsTypeOf(MM!EObject))
to
p : MM2!EObject(
)
}
|
|
| |
Re: [ATL] Cannot copy attribute types [message #513475 is a reply to message #513471] |
Wed, 10 February 2010 10:48 |
RJ Messages: 19 Registered: October 2009 Location: Eindhoven, The Netherland... |
Junior Member |
|
|
Tnx for the suggestion, but unfortunately, it doesn't help. Then I get:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="testOutput" nsURI="testOutput" nsPrefix="testOutput">
<eClassifiers xsi:type="ecore:EClass" name="testClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="ID"/>
</eClassifiers>
</ecore:EPackage>
<ecore:EGenericType/>
</xmi:XMI>
It just leaves out the type entirely. Also note that for some reason, the layout of the EPackage changed.
[Updated on: Wed, 10 February 2010 10:51] Report message to a moderator
|
|
|
Re: [ATL] Cannot copy attribute types [message #513480 is a reply to message #513458] |
Wed, 10 February 2010 06:16 |
Alfons Laarman Messages: 35 Registered: July 2009 |
Member |
|
|
Hi RJ,
This I got from an earlier post from William Piers:
When you use Ecore as metamodel, you have to mention in the launch
configuration that it is a metametamodel (using the ismetametamodel
checkbox near the Ecore metamodel declaration), in order to prevent
loading issues like yours which may happen if Ecore metamodel is loaded
several times.
The checkbox make ATL consider an unique instance of this Resource.
HTH,
Alfons
On 2/10/10 11:09 AM, in article hku0lm$463$1@build.eclipse.org, "RJ"
<r.j.bijl@gmail.com> wrote:
> Hi all,
>
> I'm still trying to do model transformations on metamodels, first starting by
> just simply copying a metamodel, through ATL. I have a very simple metamodel,
> with just one class, containing one attribute, with type EString:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="testClass">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ID"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> </ecore:EPackage>
>
> However, when I run my ATL transformation, the type of the attribute just
> seems to disappear:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testOutput"
> nsURI="testOutput" nsPrefix="testOutput">
> <eClassifiers xsi:type="ecore:EClass" name="testClass">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ID">
> <eType xsi:type="ecore:EDataType"
> href="http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
> </eStructuralFeatures>
> </eClassifiers>
> </ecore:EPackage>
>
> It looks like ATL cannot handle the ecore datatypes of something like that.
> What am I missing here. For completeness sake, here is the transformation I
> use. It may look long, but all it does is copy the source metamodel 1-on-1 to
> the target metamodel. (note that I removed the irrelevant parts of the
> transformation. I fact, I have a rule for all classes of the Ecore
> meta-metamodel)
>
> -- @path MM=platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore
> -- @path MM2=platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore
>
> module merge;
> create InstMM : MM2 from AbstMM : MM;
>
> rule copyEPackage{
> from
> a : MM!EPackage
> to
> p : MM2!EPackage(
> eClassifiers <- a.eClassifiers,
> name <- 'testOutput',
> nsURI <- 'testOutput',
> nsPrefix <- 'testOutput',
> eAnnotations <- a.eAnnotations,
> eFactoryInstance <- a.eFactoryInstance,
> eSubpackages <- a.eSubpackages
> )
> }
>
> rule copyEClass{
> from
> a : MM!EClass
> to
> p : MM2!EClass(
> abstract <- a.abstract,
> name <- a.name,
> eAnnotations <- a.eAnnotations,
> eGenericSuperTypes <- a.eGenericSuperTypes,
> eOperations <- a.eOperations,
> eStructuralFeatures <- a.eStructuralFeatures,
> --eSuperTypes <- a.eSuperTypes,
> eTypeParameters <- a.eTypeParameters,
> instanceClassName <- a.instanceClassName,
> instanceTypeName <- a.instanceTypeName,
> interface <- a.interface
> )
> }
>
>
> rule copyEGenericType{
> from
> a : MM!EGenericType
> to
> p : MM2!EGenericType(
> eClassifier <- a.eClassifier,
> eLowerBound <- a.eLowerBound,
> eTypeArguments <- a.eTypeArguments,
> eTypeParameter <- a.eTypeParameter,
> eUpperBound <- a.eUpperBound
> )
> }
>
> rule copyEDataType{
> from
> a : MM!EDataType (a.oclIsTypeOf(MM!EDataType))
> to
> p : MM2!EDataType(
> eAnnotations <- a.eAnnotations,
> eTypeParameters <- a.eTypeParameters,
> instanceClassName <- a.instanceClassName,
> instanceTypeName <- a.instanceTypeName,
> name <- a.name,
> serializable <- a.serializable
> )
> }
>
> rule copyEReference{
> from
> a : MM!EReference
> to
> p : MM2!EReference(
> changeable <- a.changeable,
> containment <- a.containment,
> defaultValueLiteral <- a.defaultValueLiteral,
> derived <- a.derived,
> eAnnotations <- a.eAnnotations,
> eGenericType <- a.eGenericType,
> eKeys <- a.eKeys,
> eOpposite <- a.eOpposite,
> eType <- a.eType,
> lowerBound <- a.lowerBound,
> name <- a.name,
> ordered <- a.ordered,
> resolveProxies <- a.resolveProxies,
> transient <- a.transient,
> unique <- a.unique,
> unsettable <- a.unsettable,
> upperBound <- a.upperBound,
> volatile <- a.volatile
> )
> }
>
> rule copyEAttribute{
> from
> a : MM!EAttribute
> to
> p : MM2!EAttribute(
> changeable <- a.changeable,
> defaultValueLiteral <- a.defaultValueLiteral,
> derived <- a.derived,
> eAnnotations <- a.eAnnotations,
> eGenericType <- a.eGenericType,
> eType <- a.eType,
> lowerBound <- a.lowerBound,
> name <- a.name,
> ordered <- a.ordered,
> transient <- a.transient,
> unique <- a.unique,
> unsettable <- a.unsettable,
> upperBound <- a.upperBound,
> volatile <- a.volatile,
> iD <- a.iD
> )
> }
>
> rule copyETypeParameter{
> from
> a : MM!ETypeParameter
> to
> p : MM2!ETypeParameter(
> eAnnotations <- a.eAnnotations,
> eBounds <- a.eBounds,
> name <- a.name
> )
> }
>
> rule copyEFactory{
> from
> a : MM!EFactory
> to
> p : MM2!EFactory(
> eAnnotations <- a.eAnnotations,
> ePackage <- a.ePackage
> )
> }
>
> rule copyEObject{
> from
> a : MM!EObject (a.oclIsTypeOf(MM!EObject))
> to
> p : MM2!EObject(
> )
> }
|
|
| |
Re: [ATL] Cannot copy attribute types [message #513780 is a reply to message #513458] |
Thu, 11 February 2010 04:50 |
William Piers Messages: 301 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------030108010802030400050101
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hello,
As Ecore datatypes are defined into the Ecore metamodel, what you do is
a reference between the Ecore output and the Ecore metamodel. So you
have to check the inter-model references checkbox in the launch
configuration (Advanced tab).
Best regards,
William
Le 10/02/2010 11:09, RJ a écrit :
> Hi all,
>
> I'm still trying to do model transformations on metamodels, first
> starting by just simply copying a metamodel, through ATL. I have a very
> simple metamodel, with just one class, containing one attribute, with
> type EString:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="test"
> nsURI="test" nsPrefix="test">
> <eClassifiers xsi:type="ecore:EClass" name="testClass">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ID"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> </ecore:EPackage>
>
> However, when I run my ATL transformation, the type of the attribute
> just seems to disappear:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="testOutput"
> nsURI="testOutput" nsPrefix="testOutput">
> <eClassifiers xsi:type="ecore:EClass" name="testClass">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="ID">
> <eType xsi:type="ecore:EDataType"
> href="http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
> </eStructuralFeatures>
> </eClassifiers>
> </ecore:EPackage>
>
> It looks like ATL cannot handle the ecore datatypes of something like
> that. What am I missing here. For completeness sake, here is the
> transformation I use. It may look long, but all it does is copy the
> source metamodel 1-on-1 to the target metamodel. (note that I removed
> the irrelevant parts of the transformation. I fact, I have a rule for
> all classes of the Ecore meta-metamodel)
>
> -- @path MM=platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore
> -- @path MM2=platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore
>
> module merge;
> create InstMM : MM2 from AbstMM : MM;
>
> rule copyEPackage{
> from
> a : MM!EPackage
> to
> p : MM2!EPackage(
> eClassifiers <- a.eClassifiers,
> name <- 'testOutput',
> nsURI <- 'testOutput',
> nsPrefix <- 'testOutput',
> eAnnotations <- a.eAnnotations,
> eFactoryInstance <- a.eFactoryInstance,
> eSubpackages <- a.eSubpackages
> )
> }
>
> rule copyEClass{
> from
> a : MM!EClass
> to
> p : MM2!EClass(
> abstract <- a.abstract,
> name <- a.name,
> eAnnotations <- a.eAnnotations,
> eGenericSuperTypes <- a.eGenericSuperTypes,
> eOperations <- a.eOperations,
> eStructuralFeatures <- a.eStructuralFeatures,
> --eSuperTypes <- a.eSuperTypes,
> eTypeParameters <- a.eTypeParameters,
> instanceClassName <- a.instanceClassName,
> instanceTypeName <- a.instanceTypeName,
> interface <- a.interface
> )
> }
>
>
> rule copyEGenericType{
> from
> a : MM!EGenericType
> to
> p : MM2!EGenericType(
> eClassifier <- a.eClassifier,
> eLowerBound <- a.eLowerBound,
> eTypeArguments <- a.eTypeArguments,
> eTypeParameter <- a.eTypeParameter,
> eUpperBound <- a.eUpperBound
> )
> }
>
> rule copyEDataType{
> from
> a : MM!EDataType (a.oclIsTypeOf(MM!EDataType))
> to
> p : MM2!EDataType(
> eAnnotations <- a.eAnnotations,
> eTypeParameters <- a.eTypeParameters,
> instanceClassName <- a.instanceClassName,
> instanceTypeName <- a.instanceTypeName,
> name <- a.name,
> serializable <- a.serializable
> )
> }
>
> rule copyEReference{
> from
> a : MM!EReference
> to
> p : MM2!EReference(
> changeable <- a.changeable,
> containment <- a.containment,
> defaultValueLiteral <- a.defaultValueLiteral,
> derived <- a.derived,
> eAnnotations <- a.eAnnotations,
> eGenericType <- a.eGenericType,
> eKeys <- a.eKeys,
> eOpposite <- a.eOpposite,
> eType <- a.eType,
> lowerBound <- a.lowerBound,
> name <- a.name,
> ordered <- a.ordered,
> resolveProxies <- a.resolveProxies,
> transient <- a.transient,
> unique <- a.unique,
> unsettable <- a.unsettable,
> upperBound <- a.upperBound,
> volatile <- a.volatile
> )
> }
>
> rule copyEAttribute{
> from
> a : MM!EAttribute
> to
> p : MM2!EAttribute(
> changeable <- a.changeable,
> defaultValueLiteral <- a.defaultValueLiteral,
> derived <- a.derived,
> eAnnotations <- a.eAnnotations,
> eGenericType <- a.eGenericType,
> eType <- a.eType,
> lowerBound <- a.lowerBound,
> name <- a.name,
> ordered <- a.ordered,
> transient <- a.transient,
> unique <- a.unique,
> unsettable <- a.unsettable,
> upperBound <- a.upperBound,
> volatile <- a.volatile,
> iD <- a.iD
> )
> }
>
> rule copyETypeParameter{
> from
> a : MM!ETypeParameter
> to
> p : MM2!ETypeParameter(
> eAnnotations <- a.eAnnotations,
> eBounds <- a.eBounds,
> name <- a.name
> )
> }
>
> rule copyEFactory{
> from
> a : MM!EFactory
> to
> p : MM2!EFactory(
> eAnnotations <- a.eAnnotations,
> ePackage <- a.ePackage
> )
> }
>
> rule copyEObject{
> from
> a : MM!EObject (a.oclIsTypeOf(MM!EObject))
> to
> p : MM2!EObject(
> )
> }
--
Ne manquez pas notre prochaine formation ATL inter entreprises:
ATL - Paris - du 2 au 3 Décembre 2009
Pour plus de dates et pour le détail de cette formation:
http://www.obeo.fr/pages/formations/fr
Don't forget our next ATL training:
ATL - Paris - 2009 December from 2th to 3th
More dates and training program on:
http://www.obeo.fr/pages/formations/fr
--------------030108010802030400050101
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"
YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------030108010802030400050101--
|
|
| | |
Goto Forum:
Current Time: Thu Apr 25 22:13:40 GMT 2024
Powered by FUDForum. Page generated in 0.03878 seconds
|