ATL and JAVA code calling (alternative QVT...) [message #1201300] |
Thu, 21 November 2013 12:25  |
Eclipse User |
|
|
|
My context:
-----------
I make a M2M transformation from XX.format1 to YY.format2 models.
In XX.format1 model a textual field is treated with ANTL parser (JAVA code generated)
I search a way to call a JAVA function from an ATL or QVT script to take the result of textual field parsed in order to insert in YY.format2 model.
I can't do this in the definition project of *.format1 because the eclipse project defining the parser taking this *.format as dependance.
So I will have a cycle of dependance in this case.
Finally my only way to succeed is to be able to call the parser from ATL or other M2M API (I tried QVT but I don't find)
My question:
------------
Find a way to call A JAVA code function from ATL or QVT script.
=> This function returns an object and is not void
=> This function is an operation defined in the entry metamodel definition but without its body (the body is defined with ANTLR parser)
Regards,
Cyril
|
|
|
|
|
|
|
|
|
Re: ATL and JAVA code calling (alternative QVT...) [message #1209677 is a reply to message #1209007] |
Mon, 25 November 2013 11:46   |
Eclipse User |
|
|
|
Hi Ronan, Ed,
A field in my model is a property, an attribute, ... an element of my model which is TEXTUAL, and the parser objective is to convert this part of text into model element define in my model itself.
I choose ANTLR because I know it and it was the best way to define a parser from text.
Before deciding to change from ANTLR to XTEXT, I would be assured it can solve my problem...
So can I find somewhere an example of a link between XTEXT and ATL transformation?
And a tutorial for XTEXT => to be able to convert text to model...
Is it the same link possible between XTEXT and QVT? (because I can do the same transformation with QVT-o...)
Because if I have to redesign all my application, I hope to consider all techno!
I tried to explain the best I can my problem, and I don't find how to redesign it to break the loop...
EMF PROJECT ANTLR, XTEXT, ... project
-------------------- --------------------------
| model def | | <textfield> |
| | | || |
| elemX def | | \/ |
| with <textfield> | => | other elem object |
| & | | conform to EMF project |
| other elem def | | EXTERN PARSER |
-------------------- --------------------------
||
\/
ATL (...or QVT)
---------------------------
| the goal is to |
| convert model |
| |
| taking account |
| <texfield> is |
| is not text after ANTLR |
---------------------------
My problem is :
as ATL doesn't know JAVA, I must have EOperation in my model !
but this is why I have a cycle...
and the only needs for the EOperation is ATL request to access <textfield> converted.
|
|
|
Re: ATL and JAVA code calling (alternative QVT...) [message #1209831 is a reply to message #1209677] |
Mon, 25 November 2013 13:25   |
Eclipse User |
|
|
|
Hi
Xtext is orthogonal to MtoM tools.
Xtext just provides an alternative and often better way of preparing
your models using a textual user interface.
MtoM tools transform them. They should not care how they were prepared.
Regards
Ed Willink
On 25/11/2013 16:46, cyril dufrechou wrote:
> Hi Ronan, Ed,
>
> A field in my model is a property, an attribute, ... an element of my
> model which is TEXTUAL, and the parser objective is to convert this
> part of text into model element define in my model itself.
>
> I choose ANTLR because I know it and it was the best way to define a
> parser from text.
>
> Before deciding to change from ANTLR to XTEXT, I would be assured it
> can solve my problem...
>
> So can I find somewhere an example of a link between XTEXT and ATL
> transformation?
> And a tutorial for XTEXT => to be able to convert text to model...
> Is it the same link possible between XTEXT and QVT? (because I can do
> the same transformation with QVT-o...)
> Because if I have to redesign all my application, I hope to consider
> all techno!
>
> I tried to explain the best I can my problem, and I don't find how to
> redesign it to break the loop...
>
> EMF PROJECT ANTLR, XTEXT, ... project
> -------------------- --------------------------
> | model def | | <textfield> |
> | | | || |
> | elemX def | | \/ |
> | with <textfield> | => | other elem object |
> | & | | conform to EMF project |
> | other elem def | | EXTERN PARSER |
> -------------------- --------------------------
> ||
> \/
> ATL (...or QVT)
> --------------------------- | the goal is to | |
> convert model |
> | |
> | taking account |
> | <texfield> is |
> | is not text after ANTLR |
> ---------------------------
> My problem is : as ATL doesn't know JAVA, I must have EOperation in my
> model !
> but this is why I have a cycle...
> and the only needs for the EOperation is ATL request to access
> <textfield> converted.
>
>
|
|
|
|
Re: ATL and JAVA code calling (alternative QVT...) [message #1211445 is a reply to message #1211209] |
Tue, 26 November 2013 07:43  |
Eclipse User |
|
|
|
Hi,
XText is a tool which allows you to seperate a textual concrete syntax from the model which represents the data structures. So it will look after parsing your text into a model instance that is compliant to your Ecore Meta-Model. You can then use whatever Eclipse based transformation langauge to transform your model to something else.
You can still use ANTLR if you like but I like XText. Regardless I still don't see why you can't fix your dependency cycle. I have many Ecore eOperations which I run the code generator off and then implemented the method to use classes in other projects without any problems.
Regards,
Ronan
|
|
|
Powered by
FUDForum. Page generated in 0.05086 seconds