[ATL] General Question XML2XML [message #51344] |
Sun, 08 July 2007 14:49  |
Eclipse User |
|
|
|
Originally posted by: NewsgroupSPAM.iKupp.de
Hi
i ve got a question. Is this the right way to transform a xml file to
another xml file with atl.
i ve got an input file in.xml with a easy structure like
<document>
<entity>
<id>123</id>
<description>this is a description</description>
</entity>
<entity>
<id>234</id>
<description>this is another description</description>
</entity>
..
..
..
</document>
the output file has a similar easy structure which is defined in
outmm.ecore.
1. XML injector (xml file to xml model Ecore Based) = in.ecore
2. write my transformation.atl
3. build a transformation with in.ecore as input model and xml.ecore as
metamodel (the official one)
and out.ecore as output model and my outmm.ecore (my own output metamodel)
4. xml extractor (model to file) = out.xml
thanks very much,
Ina
|
|
|
|
|
Re: [ATL] General Question XML2XML [message #51646 is a reply to message #51605] |
Mon, 09 July 2007 08:10   |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
Ina Kupp a écrit :
> Hugo Bruneliere schrieb:
>> Ina Kupp a écrit :
>>> Hi
>>
>> Hi Ina,
> Hi
>>
>>> i ve got a question. Is this the right way to transform a xml file to
>>> another xml file with atl.
>>>
>>> i ve got an input file in.xml with a easy structure like
>>> <document>
>>> <entity>
>>> <id>123</id>
>>> <description>this is a description</description>
>>> </entity>
>>> <entity>
>>> <id>234</id>
>>> <description>this is another description</description>
>>> </entity>
>>> .
>>> .
>>> .
>>> </document>
>>> the output file has a similar easy structure which is defined in
>>> outmm.ecore.
>>>
>>> 1. XML injector (xml file to xml model Ecore Based) = in.ecore
>>> 2. write my transformation.atl
>>> 3. build a transformation with in.ecore as input model and xml.ecore
>>> as metamodel (the official one)
>>> and out.ecore as output model and my outmm.ecore (my own output
>>> metamodel)
>>> 4. xml extractor (model to file) = out.xml
>>>
>> In order to do this in ATL, the complete chain of operations is the
>> following:
>> 1. XML injection
>> 2. Transfo XML->MMa
>> 3. Transfo MMa->MMb
>> 4. Transfo MMb->XML
>> 5. XML extraction
>>
> hm, i thougt the xml injection do the xml -> MMa transformation and the
> result is a xml based model (xml.ecore as Metamodel). And the same with
> point 4/5.
> So do i need to write my own inmm.ecore (metamodel from the in.ecore
> file) for point 2? What about the XML.ecore file?
The XML injection builds a XML model (i.e. a model which conforms to the
generic XML metamodel) from a XML file. So you then need to write your
own metamodel and the corresponding transformation.
In order to write more easily your various metamodels, you may use KM3
(http://wiki.eclipse.org/KM3) which is our DSL for metamodel definition.
Note that the KM3 files can then be automatically transformed into
".ecore" files.
The XML metamodel, used in both the injector and extractor, is available
from http://www.eclipse.org/gmt/am3/zoos/atlantEcoreZoo/#XML
> now im a bit confused,
> many thanks
> Ina
Regards,
Hugo
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Re: [ATL] General Question XML2XML [message #51677 is a reply to message #51646] |
Mon, 09 July 2007 11:20   |
Eclipse User |
|
|
|
Originally posted by: NewsgroupSPAM.iKupp.de
Hugo Bruneliere schrieb:
> Ina Kupp a écrit :
>> Hugo Bruneliere schrieb:
>>> Ina Kupp a écrit :
>>>> Hi
>>>
>>> Hi Ina,
>> Hi
>>>
>>>> i ve got a question. Is this the right way to transform a xml file
>>>> to another xml file with atl.
>>>>
>>>> i ve got an input file in.xml with a easy structure like
>>>> <document>
>>>> <entity>
>>>> <id>123</id>
>>>> <description>this is a description</description>
>>>> </entity>
>>>> <entity>
>>>> <id>234</id>
>>>> <description>this is another description</description>
>>>> </entity>
>>>> .
>>>> .
>>>> .
>>>> </document>
>>>> the output file has a similar easy structure which is defined in
>>>> outmm.ecore.
>>>>
>>>> 1. XML injector (xml file to xml model Ecore Based) = in.ecore
>>>> 2. write my transformation.atl
>>>> 3. build a transformation with in.ecore as input model and xml.ecore
>>>> as metamodel (the official one)
>>>> and out.ecore as output model and my outmm.ecore (my own output
>>>> metamodel)
>>>> 4. xml extractor (model to file) = out.xml
>>>>
>>> In order to do this in ATL, the complete chain of operations is the
>>> following:
>>> 1. XML injection
>>> 2. Transfo XML->MMa
>>> 3. Transfo MMa->MMb
>>> 4. Transfo MMb->XML
>>> 5. XML extraction
>>>
>> hm, i thougt the xml injection do the xml -> MMa transformation and
>> the result is a xml based model (xml.ecore as Metamodel). And the same
>> with point 4/5.
>> So do i need to write my own inmm.ecore (metamodel from the in.ecore
>> file) for point 2? What about the XML.ecore file?
>
> The XML injection builds a XML model (i.e. a model which conforms to the
> generic XML metamodel) from a XML file. So you then need to write your
> own metamodel and the corresponding transformation.
I ve got many different xml files (with an easy structure like mentioned
above, but with different element names). So do I really have to write a
metamodel (ecore or KM3) for each xml file?
I hoped that, I only have to write one transformation for each xml file.
( The transformation file should be generated automaticly by my program
for the different files. )
Point 4 would be the same transformation for each file, so this wont be
a problem, or?
Ok, so I cant do this way:
write a transformation from the xml model (with xml.ecore as the
metamodel) direct to the MMb model.
Because if this wont work I think atl isnt the right tool for my
problem. ;-(
>
> The XML metamodel, used in both the injector and extractor, is available
> from http://www.eclipse.org/gmt/am3/zoos/atlantEcoreZoo/#XML
i meant this one with xml.ecore
many thanks
Ina
|
|
|
Re: [ATL] General Question XML2XML [message #51730 is a reply to message #51677] |
Mon, 09 July 2007 12:21  |
Eclipse User |
|
|
|
Originally posted by: Hugo.Bruneliere.univ-nantes.fr
Ina Kupp a écrit :
> Hugo Bruneliere schrieb:
>> Ina Kupp a écrit :
>>> Hugo Bruneliere schrieb:
>>>> Ina Kupp a écrit :
>>>>> Hi
>>>>
>>>> Hi Ina,
>>> Hi
>>>>
>>>>> i ve got a question. Is this the right way to transform a xml file
>>>>> to another xml file with atl.
>>>>>
>>>>> i ve got an input file in.xml with a easy structure like
>>>>> <document>
>>>>> <entity>
>>>>> <id>123</id>
>>>>> <description>this is a description</description>
>>>>> </entity>
>>>>> <entity>
>>>>> <id>234</id>
>>>>> <description>this is another description</description>
>>>>> </entity>
>>>>> .
>>>>> .
>>>>> .
>>>>> </document>
>>>>> the output file has a similar easy structure which is defined in
>>>>> outmm.ecore.
>>>>>
>>>>> 1. XML injector (xml file to xml model Ecore Based) = in.ecore
>>>>> 2. write my transformation.atl
>>>>> 3. build a transformation with in.ecore as input model and
>>>>> xml.ecore as metamodel (the official one)
>>>>> and out.ecore as output model and my outmm.ecore (my own output
>>>>> metamodel)
>>>>> 4. xml extractor (model to file) = out.xml
>>>>>
>>>> In order to do this in ATL, the complete chain of operations is the
>>>> following:
>>>> 1. XML injection
>>>> 2. Transfo XML->MMa
>>>> 3. Transfo MMa->MMb
>>>> 4. Transfo MMb->XML
>>>> 5. XML extraction
>>>>
>>> hm, i thougt the xml injection do the xml -> MMa transformation and
>>> the result is a xml based model (xml.ecore as Metamodel). And the
>>> same with point 4/5.
>>> So do i need to write my own inmm.ecore (metamodel from the in.ecore
>>> file) for point 2? What about the XML.ecore file?
>>
>> The XML injection builds a XML model (i.e. a model which conforms to
>> the generic XML metamodel) from a XML file. So you then need to write
>> your own metamodel and the corresponding transformation.
> I ve got many different xml files (with an easy structure like mentioned
> above, but with different element names). So do I really have to write a
> metamodel (ecore or KM3) for each xml file?
Of course not.
What I described is the general and usual process: in MDE a XML file
conforming to a given XML schema is usually mapped, in two steps (1 &
2), to a model that conforms to a specific metamodel abstracted from the
schema.
> I hoped that, I only have to write one transformation for each xml file.
> ( The transformation file should be generated automaticly by my program
> for the different files. )
> Point 4 would be the same transformation for each file, so this wont be
> a problem, or?
> Ok, so I cant do this way:
> write a transformation from the xml model (with xml.ecore as the
> metamodel) direct to the MMb model.
>
But you can do this if you want.
> Because if this wont work I think atl isnt the right tool for my
> problem. ;-(
ATL is perfectly adapted to this kind of problem. You can find a lot of
complete use cases and transformation scenarios from the Eclipse/M2M ATL
page: http://www.eclipse.org/m2m/atl/
There are many of them using the XML metamodel. I think you can find
some interesting transformations which may be related to your problem.
>>
>> The XML metamodel, used in both the injector and extractor, is
>> available from http://www.eclipse.org/gmt/am3/zoos/atlantEcoreZoo/#XML
> i meant this one with xml.ecore
>
> many thanks
> Ina
Regards,
Hugo
--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
|
|
|
Powered by
FUDForum. Page generated in 0.04509 seconds