[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.m2m] Re: EMF M1 model transformation with ATL

Hi Rainer,

I have also tested here (after some discussion with Freddy :) ), and it works OK with the files you attached.

However, the .ecore file is not the same as the metamodel you copied and pasted in the mail. If we copy and paste the models you put in the mail, the example doesn't work, and I get an error message. The element "DiskursweltObjekt" is not defined in the first metamodel (SOURCE MOF M2).


Regards,

Marcos.

Freddy Allilaire wrote:
Hi Rainer,

I quickly try your example. I got the following output:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Person xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"; xmlns="Person" name="Unternehmen"/>


This result seems correct to me.
Maybe you have a configuration problem.

We have an open bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=156101) concerning the switching to the debug perspective (but the debugger works). We will to solve this asap ;-)

Regards,
Freddy.

Rainer Bernhard a écrit :
Hello!

as a beginner, I face some trouble with transforming a model (MOF M1), which is an instance of my own meta-model (MOF M2).
Enclosed, you can find the SOURCE MOF M2, SOURCE MOF M1, TARGET MOF M2 and ATL Model.


Following structure of the SOURCE MOF M2:
- root Element is "Geschaeftsprozess" which has 0.* "GPElement"
- "BetrieblichesObjekt" extends "GPElement"
- "DiskursweltObjekt" extends "BetrieblichesObjekt"

I want to transform all "DiskursweltObjekt" in a "Person" of the TARGET MOF M2....(just a sample).
However, the output is just an empty xmi-file (<?xml version="1.0" encoding="ISO-8859-1"?><xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>).


I came up with the following possible sources:
- Addressing "GP!DiskursweltObjekt" is not correct due to the structure of the Metamodel (SOURCE MOF M2)
- the SOURCE MOF M1, which was generated from EMF Editor is not correct


Can you help me?

By the way: I tried to start the debug mode. I set some breakpoints (in the outline of the atl-file).
however, I didn't succeed to do that. It just "runs through" and generates the empty target-file without even switching to the debug-perspective!


Thanks a lot

Rainer




SOURCE MOF M2:
------------------------------
<?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="geschaeftsprozess"
nsURI="de.unibamberg.wiai.seda.som" nsPrefix="som">


<eClassifiers xsi:type="ecore:EClass" name="Geschaeftsprozess">
<eStructuralFeatures xsi:type="ecore:EReference" name="GPElemente" upperBound="-1"
eType="#//GPElement" containment="true"/>
</eClassifiers>


<eClassifiers xsi:type="ecore:EClass" name="GPElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>


<eClassifiers xsi:type="ecore:EClass" name="BetrieblichesObjekt" abstract="true"
eSuperTypes="#//GPElement"/>


<eClassifiers xsi:type="ecore:EClass" name="UmweltObjekt" eSuperTypes="#//BetrieblichesObjekt"/>
</ecore:EPackage>



SOURCE MOF M1 (generated with the generated emf editor)
-------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<som:Geschaeftsprozess xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:som="de.unibamberg.wiai.seda.som">
<GPElemente xsi:type="som:DiskursweltObjekt" name="Vertrieb"/>
<GPElemente xsi:type="som:DiskursweltObjekt" name="Versand"/>
</som:Geschaeftsprozess>



TARGET MOF M2 (Person example)
------------------------------
<?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="PrimitiveTypes">
<eClassifiers xsi:type="ecore:EDataType" name="String"/>
</ecore:EPackage>
<ecore:EPackage name="Person">
<eClassifiers xsi:type="ecore:EClass" name="Person">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="surname" ordered="false" unique="false" lowerBound="1" eType="/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>



ATL Transformation ------------------------------ module IAS2Person; -- Module Template create OUT : Person from IN : GP;

rule BetrieblichesObjekt {
    from
        o : GP!DiskursweltObjekt
    to
        s : Person!Person (
             name <- o.name           )
}