Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] inject and extract ATL file to an ATL model
[ATL] inject and extract ATL file to an ATL model [message #96458] Thu, 04 December 2008 11:53 Go to next message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Hello,
I'm looking to a way to inject an ATL file to an ATL model and opposite
(extract an ATL file from an ATL Model).

I have seen class ATLParser which offers apis to inject : methods
parseToModel, parseToModelWithProblems and parseWithProblems.

First one, parseToModel seems to do what I need, is it correct ?

And is there a class in ATL that allows opposite (extract an ATL file from
an ATL Model) ?

Regards,
Gabriel
Re: [ATL] inject and extract ATL file to an ATL model [message #96497 is a reply to message #96458] Thu, 04 December 2008 14:21 Go to previous messageGo to next message
Andres Yie is currently offline Andres YieFriend
Messages: 6
Registered: July 2009
Junior Member
Hi, you can find some information in this entry:

http://dev.eclipse.org/newslists/news.eclipse.technology.gmt /msg00195.html

Regards
Andres

On 2008-12-04 12:53:23 +0100, Gabriel <GBarbier@mia-software.com> said:

> Hello,
> I'm looking to a way to inject an ATL file to an ATL model and opposite
> (extract an ATL file from an ATL Model).
>
> I have seen class ATLParser which offers apis to inject : methods
> parseToModel, parseToModelWithProblems and parseWithProblems.
>
> First one, parseToModel seems to do what I need, is it correct ?
>
> And is there a class in ATL that allows opposite (extract an ATL file from
> an ATL Model) ?
>
> Regards,
> Gabriel
Re: [ATL] inject and extract ATL file to an ATL model [message #96659 is a reply to message #96497] Mon, 08 December 2008 15:38 Go to previous messageGo to next message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Andres wrote:
> Hi, you can find some information in this entry:
>
> http://dev.eclipse.org/newslists/news.eclipse.technology.gmt /msg00195.html
>
> Regards
> Andres
>
> On 2008-12-04 12:53:23 +0100, Gabriel <GBarbier@mia-software.com> said:
>
>> Hello,
>> I'm looking to a way to inject an ATL file to an ATL model and opposite
>> (extract an ATL file from an ATL Model).
>>
>> I have seen class ATLParser which offers apis to inject : methods
>> parseToModel, parseToModelWithProblems and parseWithProblems.
>>
>> First one, parseToModel seems to do what I need, is it correct ?
>>
>> And is there a class in ATL that allows opposite (extract an ATL file
>> from
>> an ATL Model) ?
>>
>> Regards,
>> Gabriel
>
>

Thanks Andres,
I just forgot to mention that I would like to do these things
programmatically (without user interactions).

And it woks well for injection, I can apply transformations to ATM model.
But, I still have a problem with extraction (when it try to find meta
classes).

Here is an example :


private final IFile parseFromModel(final ASMModel transformationModel,
URI atlFileUri) throws IOException {
AtlEMFModelHandler modelHandler = (AtlEMFModelHandler) AtlModelHandler
.getDefault("EMF");
IFile file = null;
Map parameters = new HashMap();
parameters.put("name", "ATL"); //$NON-NLS-1$ //$NON-NLS-2$


IPath atlFilePath = new Path(atlFileUri.toFileString());
OutputStream out = new FileOutputStream(atlFilePath.toFile());
final TCSExtractor ebnfe = new TCSExtractor();
try {
ebnfe.extract(transformationModel, out, parameters);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException ioe) {
}
}
return file;
}


Regards
Gabriel
Re: [ATL] inject and extract ATL file to an ATL model [message #96789 is a reply to message #96659] Tue, 09 December 2008 15:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: a-yie.uniandes.edu.co

Debugging org.eclipse.am3.ui.action.ActionEBNFExtractor I found that
the params Map passed to ebnfe.extract has the value of {format=ATL-0.2
: TCS}. Do you tried it?

On 2008-12-08 16:38:28 +0100, "gabriel <GBarbier@mia-software.com>"
<GBarbier@mia-software.com> said:

> Andres wrote:
>> Hi, you can find some information in this entry:
>>
>> http://dev.eclipse.org/newslists/news.eclipse.technology.gmt /msg00195.html
>>
>> Regards
>> Andres
>>
>> On 2008-12-04 12:53:23 +0100, Gabriel <GBarbier@mia-software.com> said:
>>
>>> Hello,
>>> I'm looking to a way to inject an ATL file to an ATL model and opposite
>>> (extract an ATL file from an ATL Model).
>>>
>>> I have seen class ATLParser which offers apis to inject : methods
>>> parseToModel, parseToModelWithProblems and parseWithProblems.
>>>
>>> First one, parseToModel seems to do what I need, is it correct ?
>>>
>>> And is there a class in ATL that allows opposite (extract an ATL file from
>>> an ATL Model) ?
>>>
>>> Regards,
>>> Gabriel
>>
>>
>
> Thanks Andres,
> I just forgot to mention that I would like to do these things
> programmatically (without user interactions).
>
> And it woks well for injection, I can apply transformations to ATM model.
> But, I still have a problem with extraction (when it try to find meta classes).
>
> Here is an example :
>
>
> private final IFile parseFromModel(final ASMModel transformationModel,
> URI atlFileUri) throws IOException {
> AtlEMFModelHandler modelHandler = (AtlEMFModelHandler) AtlModelHandler
> .getDefault("EMF");
> IFile file = null;
> Map parameters = new HashMap();
> parameters.put("name", "ATL"); //$NON-NLS-1$ //$NON-NLS-2$
>
>
> IPath atlFilePath = new Path(atlFileUri.toFileString());
> OutputStream out = new FileOutputStream(atlFilePath.toFile());
> final TCSExtractor ebnfe = new TCSExtractor();
> try {
> ebnfe.extract(transformationModel, out, parameters);
> } catch (Exception e) {
> e.printStackTrace();
> } finally {
> try {
> out.close();
> } catch (IOException ioe) {
> }
> }
> return file;
> }
>
>
> Regards
> Gabriel
Re: [ATL] inject and extract ATL file to an ATL model [message #96803 is a reply to message #96789] Tue, 09 December 2008 19:14 Go to previous messageGo to next message
Gabriel BARBIER is currently offline Gabriel BARBIERFriend
Messages: 106
Registered: July 2009
Senior Member
Yes, thanks a lot Yie !

I was looking in class ActionATLExtractor => next time I should use debugger !

And with good params, it works well !
The lines I have added :

Map parameters = new HashMap();
InputStream tcsStream = this.getClass().getResourceAsStream("resources/atlextractor/TCS.ecore ");
ASMModel mmTCS = modelHandler.loadModel("TCS", modelHandler.getMof(), tcsStream);
InputStream atlStream = this.getClass().getResourceAsStream("resources/atlextractor/ATL-0.2-TCS.ecore ");
ASMModel modelTCS = modelHandler.loadModel("ATL-0.2", mmTCS, atlStream);
parameters.put("format", modelTCS);

Regards,
Gabriel

Yie wrote:
> Debugging org.eclipse.am3.ui.action.ActionEBNFExtractor I found that the
> params Map passed to ebnfe.extract has the value of {format=ATL-0.2 :
> TCS}. Do you tried it?
>
> On 2008-12-08 16:38:28 +0100, "gabriel <GBarbier@mia-software.com>"
> <GBarbier@mia-software.com> said:
>
>> Andres wrote:
>>> Hi, you can find some information in this entry:
>>>
>>> http://dev.eclipse.org/newslists/news.eclipse.technology.gmt /msg00195.html
>>>
>>>
>>> Regards
>>> Andres
>>>
>>> On 2008-12-04 12:53:23 +0100, Gabriel <GBarbier@mia-software.com> said:
>>>
>>>> Hello,
>>>> I'm looking to a way to inject an ATL file to an ATL model and opposite
>>>> (extract an ATL file from an ATL Model).
>>>>
>>>> I have seen class ATLParser which offers apis to inject : methods
>>>> parseToModel, parseToModelWithProblems and parseWithProblems.
>>>>
>>>> First one, parseToModel seems to do what I need, is it correct ?
>>>>
>>>> And is there a class in ATL that allows opposite (extract an ATL
>>>> file from
>>>> an ATL Model) ?
>>>>
>>>> Regards,
>>>> Gabriel
>>>
>>>
>>
>> Thanks Andres,
>> I just forgot to mention that I would like to do these things
>> programmatically (without user interactions).
>>
>> And it woks well for injection, I can apply transformations to ATM model.
>> But, I still have a problem with extraction (when it try to find meta
>> classes).
>>
>> Here is an example :
>>
>>
>> private final IFile parseFromModel(final ASMModel transformationModel,
>> URI atlFileUri) throws IOException {
>> AtlEMFModelHandler modelHandler = (AtlEMFModelHandler)
>> AtlModelHandler
>> .getDefault("EMF");
>> IFile file = null;
>> Map parameters = new HashMap();
>> parameters.put("name", "ATL"); //$NON-NLS-1$ //$NON-NLS-2$
>>
>>
>> IPath atlFilePath = new Path(atlFileUri.toFileString());
>> OutputStream out = new FileOutputStream(atlFilePath.toFile());
>> final TCSExtractor ebnfe = new TCSExtractor();
>> try {
>> ebnfe.extract(transformationModel, out, parameters);
>> } catch (Exception e) {
>> e.printStackTrace();
>> } finally {
>> try {
>> out.close();
>> } catch (IOException ioe) {
>> }
>> }
>> return file;
>> }
>>
>>
>> Regards
>> Gabriel
>
>
Re: [ATL] inject and extract ATL file to an ATL model [message #96818 is a reply to message #96803] Tue, 09 December 2008 19:26 Go to previous message
Andres Yie is currently offline Andres YieFriend
Messages: 6
Registered: July 2009
Junior Member
No problem!!

On 2008-12-09 20:14:03 +0100, Gabriel <gBarbier@mia-software.com> said:

> Yes, thanks a lot Yie !
>
> I was looking in class ActionATLExtractor => next time I should use debugger !
>
> And with good params, it works well !
> The lines I have added :
>
> Map parameters = new HashMap();
> InputStream tcsStream =
> this.getClass().getResourceAsStream("resources/atlextractor/TCS.ecore ");
> ASMModel mmTCS = modelHandler.loadModel("TCS", modelHandler.getMof(),
> tcsStream);
> InputStream atlStream =
> this.getClass().getResourceAsStream("resources/atlextractor/ATL-0.2-TCS.ecore ");
ASMModel
>
> modelTCS = modelHandler.loadModel("ATL-0.2", mmTCS, atlStream);
> parameters.put("format", modelTCS);
>
> Regards,
> Gabriel
>
> Yie wrote:
>> Debugging org.eclipse.am3.ui.action.ActionEBNFExtractor I found that
>> the params Map passed to ebnfe.extract has the value of {format=ATL-0.2
>> : TCS}. Do you tried it?
>>
>> On 2008-12-08 16:38:28 +0100, "gabriel <GBarbier@mia-software.com>"
>> <GBarbier@mia-software.com> said:
>>
>>> Andres wrote:
>>>> Hi, you can find some information in this entry:
>>>>
>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.gmt /msg00195.html
>>>>
>>>> Regards
>>>> Andres
>>>>
>>>> On 2008-12-04 12:53:23 +0100, Gabriel <GBarbier@mia-software.com> said:
>>>>
>>>>> Hello,
>>>>> I'm looking to a way to inject an ATL file to an ATL model and opposite
>>>>> (extract an ATL file from an ATL Model).
>>>>>
>>>>> I have seen class ATLParser which offers apis to inject : methods
>>>>> parseToModel, parseToModelWithProblems and parseWithProblems.
>>>>>
>>>>> First one, parseToModel seems to do what I need, is it correct ?
>>>>>
>>>>> And is there a class in ATL that allows opposite (extract an ATL file from
>>>>> an ATL Model) ?
>>>>>
>>>>> Regards,
>>>>> Gabriel
>>>>
>>>>
>>>
>>> Thanks Andres,
>>> I just forgot to mention that I would like to do these things
>>> programmatically (without user interactions).
>>>
>>> And it woks well for injection, I can apply transformations to ATM model.
>>> But, I still have a problem with extraction (when it try to find meta classes).
>>>
>>> Here is an example :
>>>
>>>
>>> private final IFile parseFromModel(final ASMModel transformationModel,
>>> URI atlFileUri) throws IOException {
>>> AtlEMFModelHandler modelHandler = (AtlEMFModelHandler) AtlModelHandler
>>> .getDefault("EMF");
>>> IFile file = null;
>>> Map parameters = new HashMap();
>>> parameters.put("name", "ATL"); //$NON-NLS-1$ //$NON-NLS-2$
>>> IPath atlFilePath = new Path(atlFileUri.toFileString());
>>> OutputStream out = new FileOutputStream(atlFilePath.toFile());
>>> final TCSExtractor ebnfe = new TCSExtractor();
>>> try {
>>> ebnfe.extract(transformationModel, out, parameters);
>>> } catch (Exception e) {
>>> e.printStackTrace();
>>> } finally {
>>> try {
>>> out.close();
>>> } catch (IOException ioe) {
>>> }
>>> }
>>> return file;
>>> }
>>>
>>>
>>> Regards
>>> Gabriel
Previous Topic:[ATL] Matched Rules on uml!PrimitiveType
Next Topic:[QVTO] Using programatically provided model source
Goto Forum:
  


Current Time: Thu Apr 25 21:39:27 GMT 2024

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

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

Back to the top