Home » Modeling » ATL » How to convert ATL-file to EMF-file?
| |
Re: How to convert ATL-file to EMF-file? [message #896453 is a reply to message #896279] |
Wed, 18 July 2012 12:24 |
Juan Pedro Silva Messages: 258 Registered: July 2009 |
Senior Member |
|
|
+1 on this subject.
I'm lucky this came up so recently.
Dennis, which should be the "SUPER" input that the transformation takes?
Thanks and best regards,
Juan Pedro
El 17/07/2012 22:42, Dennis Wagelaar escribió:
> Op 10-07-12 18:03, jo W schreef:
>> Hi,
>>
>> I would like to translate ATL-transformation code (from .atl- or .asm-files)
>> into an EMF-model (.xmi-file). The aim is to further process the result in a
>> M2M-transformation.
>>
>> I guess the result should conform to ATL.ecore (or ATL-0.2.ecore ?). Or is
>> there any other source for the current ATL-Metamodel?
>>
>> Is there any way to automatically generate the needed xmi-file?
>>
>> Thanks in advance for your help
>
> If I remember correctly, AM3 used to be able to do this with a right-click action.
>
> Currently, this scenario is also supported by EMFTVM
> (http://wiki.eclipse.org/ATL/EMFTVM). To do this, run the ATLCopy.atl
> transformation on a .atl file as input and a .xmi file as output:
>
> http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.emftvm.compiler/transformations/ATLCopy.atl?view=markup&root=Modeling_Project
>
> Use "http://www.eclipse.org/gmt/2005/ATL" as the URI for the ATL metamodel.
>
> Cheers,
> Dennis
|
|
| | | | | | |
Re: How to convert ATL-file to EMF-file? [message #902651 is a reply to message #901761] |
Thu, 16 August 2012 17:08 |
Dennis Wagelaar Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Op 14-08-12 15:24, Ed Willink schreef:
> Hi
>
> I can't help you will the ATL reference and can only provide some clues on the
> OCL reference, since you didn't tell us what OCL file you found where or when.
>
> If. as it appears. you are using ATL as your model, then you should be aware
> that ATL does not use OCL; just something that has many similarities to OCL.
> You must use the 'OCL' model that comes with ATL.
>
> "http://www.eclipse.org/gmt/2005/OCL" is unlikely to be correct since GMT has
> never hosted an OCL project.
>
> Regards
>
> Ed Willink
The URL "http://www.eclipse.org/gmt/2005/OCL" refers to an internal EPackage
inside ATL.ecore. It is not related to Eclipse OCL, and in fact refers to
ATL's implementation of OCL.
>
>
> On 13/08/2012 17:17, jo W wrote:
>> Hi Dennis,
>> thanks a lot, I finally got the transformation working!
>>
>> Unfortunately now a new problem occurs:
>> My aim is to define a (partly) translation between Henshin and ATL as model
>> to model HOT using Henshin as language for this transformation. For this I
>> need the suited meta-models for ATL and OCL.
>> I tried to import from the locations http://www.eclipse.org/gmt/2005/ATL
>> and
>> http://www.eclipse.org/gmt/2005/OCL
>> but this failed.
>> I also tried to use ecore-files I found for ATL and OCL, but I do not know
>> whether I have the right file for ATL and for OCL it does not work, because
>> I do not have a definition fitting to ATL.
>> Also when I try to open the generated xmi file (from your transformation)
>> with sample reflective ecore model editor in eclipse, I get a lot of
>> PackageNotFoundExceptions and ClassNotFoundExceptions regarding OCL.
>>
>> Hoping for more help
>> Josa
You can't really re-open that XMI, I'm afraid. ATL does not register its
namespace URIs with EMF. However, because you have EMFTVM installed, you can
open .atl files directly in EMF editors (EMFTVM registers an EMF
ResourceFactory for .atl files). Therefore, Henshin should also be able to
open a .atl file as an EMF model.
Regards,
Dennis
|
|
|
Re: How to convert ATL-file to EMF-file? [message #902652 is a reply to message #902651] |
Thu, 16 August 2012 18:00 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi Dennis
Since ATL is not part of GMT any more you might plan to migrate the URIs
to e.g. http://www.eclipse.org/atl/2012/ATL and e.g.
..http://www.eclipse.org/atl/2012/OCL.
You can always put in duplicate registrations to preserve backwards
compatibility.
Regards
Ed Willink
On 16/08/2012 18:08, Dennis Wagelaar wrote:
> Op 14-08-12 15:24, Ed Willink schreef:
>> Hi
>>
>> I can't help you will the ATL reference and can only provide some clues on the
>> OCL reference, since you didn't tell us what OCL file you found where or when.
>>
>> If. as it appears. you are using ATL as your model, then you should be aware
>> that ATL does not use OCL; just something that has many similarities to OCL.
>> You must use the 'OCL' model that comes with ATL.
>>
>> "http://www.eclipse.org/gmt/2005/OCL" is unlikely to be correct since GMT has
>> never hosted an OCL project.
>>
>> Regards
>>
>> Ed Willink
> The URL "http://www.eclipse.org/gmt/2005/OCL" refers to an internal EPackage
> inside ATL.ecore. It is not related to Eclipse OCL, and in fact refers to
> ATL's implementation of OCL.
>
>>
>> On 13/08/2012 17:17, jo W wrote:
>>> Hi Dennis,
>>> thanks a lot, I finally got the transformation working!
>>>
>>> Unfortunately now a new problem occurs:
>>> My aim is to define a (partly) translation between Henshin and ATL as model
>>> to model HOT using Henshin as language for this transformation. For this I
>>> need the suited meta-models for ATL and OCL.
>>> I tried to import from the locations http://www.eclipse.org/gmt/2005/ATL
>>> and
>>> http://www.eclipse.org/gmt/2005/OCL
>>> but this failed.
>>> I also tried to use ecore-files I found for ATL and OCL, but I do not know
>>> whether I have the right file for ATL and for OCL it does not work, because
>>> I do not have a definition fitting to ATL.
>>> Also when I try to open the generated xmi file (from your transformation)
>>> with sample reflective ecore model editor in eclipse, I get a lot of
>>> PackageNotFoundExceptions and ClassNotFoundExceptions regarding OCL.
>>>
>>> Hoping for more help
>>> Josa
> You can't really re-open that XMI, I'm afraid. ATL does not register its
> namespace URIs with EMF. However, because you have EMFTVM installed, you can
> open .atl files directly in EMF editors (EMFTVM registers an EMF
> ResourceFactory for .atl files). Therefore, Henshin should also be able to
> open a .atl file as an EMF model.
>
> Regards,
> Dennis
|
|
| |
Re: How to convert ATL-file to EMF-file? [message #908142 is a reply to message #902652] |
Tue, 04 September 2012 20:25 |
Dennis Wagelaar Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Op 16-08-12 20:00, Ed Willink schreef:
> Hi Dennis
>
> Since ATL is not part of GMT any more you might plan to migrate the URIs to
> e.g. http://www.eclipse.org/atl/2012/ATL and e.g.
> .http://www.eclipse.org/atl/2012/OCL.
>
> You can always put in duplicate registrations to preserve backwards
> compatibility.
>
> Regards
>
> Ed Willink
>
Even though that's a sound plan for the future, that likely breaks quite a
number of tacit dependencies in ATL's parser and compiler... For now, no URI
is registered at all with EMF. This is because ATL's parser insists on loading
the ATL metamodel from file/input stream, bypassing the EMF URI resolving
machinery. Registering ATL's URI with EMF will give you the false idea that
you've loaded the correct ATL metamodel, whereas any parsed .atl file will
actually be loaded against a //different instance// of the same metamodel.
Probably this situation needs to be resolved first. It also needs to be
resolved in a way that works without having the EMF registry available (i.e.
standalone).
The reason that EMFTVM can still use ATL namespace URI, is because by parsing
the .atl file into an EMF ResourceSet, the ATL metamodel is implicitly
registered under its namespace URI within that ResourceSet. Also, ATL's
namespace URI is read from the .ecore file in this case, which prevents
registering more than one namespace URI.
Regards,
Dennis
|
|
| | | | | | |
Re: How to convert ATL-file to EMF-file? [message #916228 is a reply to message #915475] |
Tue, 18 September 2012 19:00 |
Dennis Wagelaar Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Op 17-09-12 13:07, jo W schreef:
> Hi Dennis,
>
> I got it! ANTLR was already there, but I had to add it to my projects build path.
> I am using Henshin as Eclipse plugin, i think there isn't even a standalone
> version.
Then you can use Eclipse's plug-in dependency resolution, right? If your
project is a plug-in project, it can simply depend on
org.eclipse.m2m.atl.emftvm.*, and it will pull in all transitive dependencies
(just like Maven - the competition ;-)).
>
> Now I am back to my old metamodel problem. When I loaded my input for the
> transformation from .emftvm I was able to use the EMFTVM-metamodel for
> defining the transformation. As an example for a very basic transformation, I
> was able to read the Module from my input and define a Henshin Transformation
> System of the same name as output.
> Now with the ATL file directly loaded as input I tried both the Module-type
> from the EMFTVM-metamodel and the one from ATL-0.2.ecore, but in both cases
> the Module could not be found in my input.
Ah, Henshin also requires you to load a meta-model *before* you load the
model, is that right? ATL used to do that, which causes trouble for dynamic
metamodels (i.e. the ones for which you did not generate EMF plug-ins).
What likely goes wrong is the following:
- You (or Henshin) create(s) a ResourceSet.
- You load the ATL meta-model into this ResourceSet.
- The AtlParser loads the ATL file (model) into its own private ResourceSet,
based on its own instance of the ATL metamodel.
- You put the ATL file (model) into your ResourceSet.
You now have a situation where the ATL file (model) does *not* conform to the
ATL metamodel you loaded. Instead, it conforms to the ATL metamodel that the
*AtlParser* loaded. In ASCII graphics:
|--- Your ResourceSet ---| |--- AtlParser ResourceSet ---|
| ATL.ecore | | |
| transf.atl --------------> ATL.ecore |
|------------------------| |-----------------------------|
This problem is specific to AtlParser, which will not use your ResourceSet
with pre-loaded ATL metamodel.
>
> Is there any way to solve this issue? Any metamodel that is matching to my
> input created directly from the .atl-file?
>
> Regards
> Josa
In ATL EMFTVM this has been fixed by postponing the loading of metamodels by
namespace URI until after all models have been loaded. This way,
AtlResourceImpl will have had the opportunity to register the (namespace URIs
of the) ATL metamodel with your ResourceSet instance.
The Henshin example invocation code shows that its API exposes the ResourceSet:
http://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.henshin/trunk/plugins/org.eclipse.emf.henshin.examples/src/org/eclipse/emf/henshin/examples/bank/BankExample.java
Try loading the ATL file into the ResourceSet *before* loading the Henshin
module. That way, Henshin should reuse the pre-registered version of the ATL
metamodel.
Regards,
Dennis
|
|
| |
Goto Forum:
Current Time: Mon Sep 23 17:28:03 GMT 2024
Powered by FUDForum. Page generated in 0.05246 seconds
|