[ATL] XML document as input for ATL transformation [message #649232] |
Tue, 18 January 2011 10:14 |
Cesar Caves Messages: 29 Registered: July 2009 |
Junior Member |
|
|
Hello everybody !
I am starting with ATL. If I am right, the basic scheme in ATL is to have two Ecore metamodels and execute the created transformation on an instance model expressed as an XMI file to obtain a target model in the same format. At least, is what you can see from the basic examples downloaded from here
http://www.eclipse.org/m2m/atl/basicExamples_Patterns/
If I would want more source models in any of those (o another) use cases, I could go to "Create dynamic instance" to generate a new XMI file in which save the new model and, using the tree-based editor, fill in it with content. And for each newly model instance, execute the transformation to get a new corresponding target model, also in XMI format.
Now, my question: I have the source and target metamodels as XML Schemas. According to what I have read about EMF, I think that it is direct to get them as Ecore metamodels using the appropriate model importer when creating a new EMF project. But the point is that I have a lot of XML documents validating vs the source XML Schema, each of them holding a model instance. Is there any way to reuse all of that information? I mean, I don't want to think about entering again that content through the tree-based editor to create XMI files with information I already have in XML documents. And, if there is any way, does it worth? Would it be something already done to convert form XML to XMI?
Also, I would like the reverse process, i. e., translate the target models resulting from the transformation form XMI to XML documents conforming my target Schema.
In other words, I would like that the extremes of my transformation were XML documents, outside the Ecore / XMI framework.
Any help would be welcome. Thanks in advance.
|
|
|
Re: [ATL] XML document as input for ATL transformation [message #649240 is a reply to message #649232] |
Tue, 18 January 2011 10:42 |
Vincent MAHE Messages: 129 Registered: July 2009 |
Senior Member |
|
|
Le 18/01/2011 11:14, Cesar a écrit :
> Hello everybody !
>
> I am starting with ATL. If I am right, the basic scheme in ATL is to
> have two Ecore metamodels and execute the created transformation on an
> instance model expressed as an XMI file to obtain a target model in the
> same format. At least, is what you can see from the basic examples
> downloaded from here
>
> http://www.eclipse.org/m2m/atl/basicExamples_Patterns/
>
> If I would want more source models in any of those (o another) use
> cases, I could go to "Create dynamic instance" to generate a new XMI
> file in which save the new model and, using the tree-based editor, fill
> in it with content. And for each newly model instance, execute the
> transformation to get a new corresponding target model, also in XMI format.
>
> Now, my question: I have the source and target metamodels as XML
> Schemas. According to what I have read about EMF, I think that it is
> direct to get them as Ecore metamodels using the appropriate model
> importer when creating a new EMF project. But the point is that I have a
> lot of XML documents validating vs the source XML Schema, each of them
> holding a model instance. Is there any way to reuse all of that
> information? I mean, I don't want to think about entering again that
> content through the tree-based editor to create XMI files with
> information I already have in XML documents. And, if there is any way,
> does it worth? Would it be something already done to convert form XML to
> XMI?
>
> Also, I would like the reverse process, i. e., translate the target
> models resulting from the transformation form XMI to XML documents
> conforming my target Schema.
> In other words, I would like that the extremes of my transformation were
> XML documents, outside the Ecore / XMI framework.
>
> Any help would be welcome. Thanks in advance.
What you need is to do XML injection, transformation, and then XML
extraction, as explained in the zoo examples:
- http://www.eclipse.org/m2m/atl/atlTransformations/#MSOfficeE xcelInjector
-
http://www.eclipse.org/m2m/atl/atlTransformations/#MSOfficeE xcelExtractor
Your whole chain will look like this:
1) XML text -> ATL XML extractor -> XML model
2) XML model -> your XML2MMa transfo -> MMa model
3) MMa model -> your MMa2MMb transfo -> MMb model
4) MMb model -> your MMb2XML transfo -> XML out model
5) XML model -> ATL XML extractor -> XML out text file
You may later automate this chain in order to apply it on all your XML
input files.
Notice that the XML2MM* transfos are easy to write with a good knowledge
of underlying XML schema.
--
Cordialement
Vincent MAHÉ
Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03550 seconds