Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] XML document as input for ATL transformation
[ATL] XML document as input for ATL transformation [message #649232] Tue, 18 January 2011 10:14 Go to next message
Cesar Caves is currently offline Cesar CavesFriend
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 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
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
Re: [ATL] XML document as input for ATL transformation [message #649748 is a reply to message #649232] Thu, 20 January 2011 14:16 Go to previous messageGo to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,
You can also take another approach. If both source and target meta-models as XML Schemas then you can convert them to Ecore models as you have done. Next you should generate code off the genmodel of each meta-model. Once you have done this you can deploy the plugins created to eclipse or else start a second target eclipse. The meta-models are now registered.

With meta-models registered you can set the source and target meta-model using the EMF Regsitry. The input model to the ATL transform can be a regular XML file compliant to the source XML schema. The output generated by ATL will be an XML file complaint to both your target XML schema and the target ecore meta-model.

With this approach you don't need to write any model serialization code.

Regards,
Ronan
Re: [ATL] XML document as input for ATL transformation [message #655504 is a reply to message #649748] Mon, 21 February 2011 13:37 Go to previous messageGo to next message
Mehdi Missing name is currently offline Mehdi Missing nameFriend
Messages: 22
Registered: December 2010
Junior Member
hi,

Actually i have the same problem, but there is some question i have regarding ronan's solution:

You can also take another approach. If both source and target meta-models as XML Schemas then you can convert them to Ecore models as you have done. OK

Next you should generate code off the genmodel of each meta-model. what do you mean by this ?

Once you have done this you can deploy the plugins created to eclipse or else start a second target eclipse. The meta-models are now registered. is the plugin generated automatically ?

With meta-models registered you can set the source and target meta-model using the EMF Regsitry. The input model to the ATL transform can be a regular XML file compliant to the source XML schema. is this what i should generate using the genmodel ?

The output generated by ATL will be an XML file complaint to both your target XML schema and the target ecore meta-model. does ATL accept xml files and xml schema as MM as entries ?

Thank you for your time.
Re: [ATL] XML document as input for ATL transformation [message #655553 is a reply to message #655504] Mon, 21 February 2011 18:07 Go to previous message
Mehdi Missing name is currently offline Mehdi Missing nameFriend
Messages: 22
Registered: December 2010
Junior Member
hi,

ok i think i managed to do everything until the creation of the plugin.
my question now is what do i put as my atl input MM (ecore or xsd (xml shema ?) ) and should i use my xml file as the entry model ?

thank you for your time
Previous Topic:[ETL]Absolute Paths in ANT Workflows
Next Topic:XML and ATL
Goto Forum:
  


Current Time: Wed Apr 24 22:59:17 GMT 2024

Powered by FUDForum. Page generated in 0.02943 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top