[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.m2m] Re: [ATL]Does ATL Engineer always transfer "Element"(SimpleType) to "Attribute" ?

Dear Shan,

Seeing your metamodels, I suppose you get your metamodels from XMLSchema using EMF facilities.

The fact is that metamodels build from XMLSchema add some metadata (EAnnotation) to know how to serialize documents. Thus, this is not a ATL issue but an EMF issue. As i don't really know those EMF's features, i advise you to get in touch with EMF's guys ;)

Regards,
Mikael

Shan wrote :
When I transform an example:

    source model:

    <book xmlns="http://www.m2matl.com/book"; name="ass" code="asss">
target model which I supposed should be :

<prdocut xmlns="http://www.m2matl.com/prdocut";>
<name>ass</name>
<code>asss</name>
</product>
is :


<prdocut:Prdocut xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"; xmlns:prdocut="http://www.m2matl.com/prdocut"; code="asss" name="ass"/>

Target model'style is same as book that "name" and "code" are both attributes.


my atl source:
-------------------
module B2P; create OUT : Product from IN : Book;
rule Book2Product {
from b : Book!Book to out : Product!Product ( name <- b.name, code <- b.code )
}
-------------------


Is my alt rule right or wrong? If it is wrong, how to defiine atl rule to make sure get correct result? else does atl engineer always transfer "Element" to "Attribute" when the element is simpleType?


Attach metamodel source below
--------------------------------------------------------------------------------


book's metamodel---book.ecore
<?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="book"
nsURI="http://www.m2matl.com/book"; nsPrefix="book">
<eClassifiers xsi:type="ecore:EClass" name="Book">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="name" value="Book"/>
<details key="kind" value="elementOnly"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String";>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="element"/>
<details key="name" value="name"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String";>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="element"/>
<details key="name" value="code"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="name" value=""/>
<details key="kind" value="mixed"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry";>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="elementWildcard"/>
<details key="name" value=":mixed"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="xMLNSPrefixMap" upperBound="-1"
eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry";
transient="true" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="attribute"/>
<details key="name" value="xmlns:prefix"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="xSISchemaLocation" upperBound="-1"
eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry";
transient="true" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="attribute"/>
<details key="name" value="xsi:schemaLocation"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="book" upperBound="-2" eType="#//Book"
volatile="true" transient="true" derived="true" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="element"/>
<details key="name" value="book"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>
---------------------------------------------------------------------------------



product's metamodel---product.ecore
<?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="product"
nsURI="http://www.m2matl.com/product"; nsPrefix="product">
<eClassifiers xsi:type="ecore:EClass" name="DocumentRoot">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="name" value=""/>
<details key="kind" value="mixed"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="mixed" unique="false" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFeatureMapEntry";>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="elementWildcard"/>
<details key="name" value=":mixed"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="xMLNSPrefixMap" upperBound="-1"
eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry";
transient="true" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="attribute"/>
<details key="name" value="xmlns:prefix"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="xSISchemaLocation" upperBound="-1"
eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStringToStringMapEntry";
transient="true" containment="true" resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="attribute"/>
<details key="name" value="xsi:schemaLocation"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="product" upperBound="-2"
eType="#//Product" volatile="true" transient="true" derived="true" containment="true"
resolveProxies="false">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="element"/>
<details key="name" value="product"/>
<details key="namespace" value="##targetNamespace"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Product">
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="name" value="Product"/>
<details key="kind" value="empty"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="code" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String";>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="attribute"/>
<details key="name" value="code"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String";>
<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData";>
<details key="kind" value="attribute"/>
<details key="name" value="name"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>






-- Mikaël Barbero - PhD Candidate ATLAS Group (INRIA & LINA) - University of Nantes 2, rue de la Houssinière 44322 Nantes Cedex 3 - France tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00 email: Mikael.Barbero@{gmail.com, univ-nantes.fr} http://www.sciences.univ-nantes.fr/lina/atl/