[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2m-atl-dev] [ATL] Model Transformation from Personal to ECore

Hello,

I'm working for an entreprise project that uses now ATL.
I'm beginner at using ATL. I've learnt models principle but i face a
problem using ATL.
All i've found on the web is the same examples, basic examples.
My problem is the following :

I have a model description : my_model.ecore

Contents of my_model.ecore :

<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="numerical"
    nsURI="http://my_numerical/1.0"; nsPrefix="numerical">
  <eClassifiers xsi:type="ecore:EClass" name="ModelElement" abstract="true">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString";
        iD="true"/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
lowerBound="1" eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString";
        defaultValueLiteral=""/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="comment"
eType="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EString";
        defaultValueLiteral=""/>
    <eStructuralFeatures xsi:type="ecore:EReference"
name="constraints" upperBound="-1"
        eType="#//Constraint" containment="true"/>
  </eClassifiers>

and so on ... That is to say, my model has ECORE as meta model.

Now, i have an instance of this ecore, that i name my_instance.xmi

Contents of my_instance.xmi :

<?xml version="1.0" encoding="UTF-8"?>
<numerical:Case xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:numerical="http://paprika_numerical/1.0";
id="d5f46177-eb45-495b-85c1-aebdf8babf9a" name="modele"
author="T0050098" nameInGecko="modele">
 <dynamicConfiguration launchingScript=""/>
  <dataList>
    <data xsi:type="numerical:DataBlock"
id="f9e985da-5774-462f-9cae-191975aa1e4c" name="New_Bloc_1">
      <contents xsi:type="numerical:Data"
id="a3afed84-8259-43f4-ad30-ce05d58ff021" name="TEST_INTEGER_DATA"
type="ddaf2576-7115-4bda-aa92-f208ccd96bfd"
defaultValueLiteral="ACED0005737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000A"
defaultUnit="C"/>

and so on ....

My first question is : Why have XML tags changed from ecore tags to
numerical, data, datalist etc .. tags ?

Second question ( the most important for me )
I use eclipse/ATL so as to transform this xmi file ( that i consider
now as a model ) into an emf ecore model ( ecore compliant model,
example of wanted contents : <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";
xsi:schemaLocation="http://www.eclipse.org/emf/2002/Ecore
java://org.eclipse.emf.ecore.EcorePackage" name="mycase"
    nsURI="http://modele/d5f46177-eb45-495b-85c1-aebdf8babf9a";
nsPrefix="modele">
  <eClassifiers xsi:type="ecore:EEnum" name="My_ENUM">
    <eAnnotations source="Nikaia">
      <details key="ID" value="679cb093-9510-42dc-ab7e-5fe68f9d0250"/>
    </eAnnotations>
    <eLiterals

... and so on )

How should i do ? Because a simple ATL transformation like replace
numerical:Case with ecore:EPackage and so on for others classes will
give a result file with tags of type : ecore:EClass and so on, i never
get tags of type eAnnotations, eClassifiers, etc ..
Moreover, using ATL, i don't know how to get imbricated tags, i only
manage to get tags written one after the other.

Best regards for helping.


Chris.