Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Model to Text : case of "unsuported by target language"(How to state a given model construct is not supported in a given target language ?)
Model to Text : case of "unsuported by target language" [message #557185] Sun, 05 September 2010 20:12 Go to next message
Yannick Duchene (Hibou57) is currently offline Yannick Duchene (Hibou57)Friend
Messages: 50
Registered: September 2010
Location: Metz (France - Europe)
Member
Hi all,

An overall question : given a transformation script using OMG's standard Model to Text language as supported by Acceleo 3, and given a target language ; what would be the better way to make the script state it could not successfully be applied ? I had a look at the OMG reference in this area, and did not find any thing.

Did I miss something or is there a tricky way to do or is there simply no way ? What is the state ?

Alternatively, is there a non-standard Acceleo extension in that area ?

Have a nice day all.

[Updated on: Sun, 05 September 2010 20:13]

Report message to a moderator

Re: Model to Text : case of "unsuported by target language" [message #557220 is a reply to message #557185] Mon, 06 September 2010 07:42 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010709030209040400010105
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Yannick,

I am not sure I really understand your need : You would say you are
trying to generate Java code, and the particular Acceleo script would
generate incorrect Java, you would like Acceleo to tell you beforehand
that the syntax of your target "after generation" is wrong?

If yes, this simply cannot be done. Acceleo generates "text" and has no
knowledge of the target's syntax.

If not, I'll need a little more explanation to understand what your use
case is.

Laurent Goubet
Obeo

Yannick Duch wrote:
> Hi all,
>
> An overall question : given a transformation script using OMG's standard
> Model to Text language as supported by Acceleo 3, and given a target
> language ; what would be the better way to make the script state it
> could not successfully be applied ? I had a look at the OMG reference in
> this area, and did not find any thing.
>
> Did I miss something or there a tricky way to do or is there simply no
> way ? What is the state ?
>
> Alternatively, is there a non-standard Acceleo extension in that area ?
>
> Have a nice day all.
>


--------------010709030209040400010105
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010709030209040400010105--
Re: Model to Text : case of "unsuported by target language" [message #557236 is a reply to message #557220] Mon, 06 September 2010 08:45 Go to previous messageGo to next message
Yannick Duchene (Hibou57) is currently offline Yannick Duchene (Hibou57)Friend
Messages: 50
Registered: September 2010
Location: Metz (France - Europe)
Member
Hello once again Laurent,

Laurent Goubet

I am not sure I really understand your need : You would say you are
trying to generate Java code, and the particular Acceleo script would
generate incorrect Java, you would like Acceleo to tell you beforehand
that the syntax of your target "after generation" is wrong?

Sorry for being unclear. A try to be more explicit : let A, be an UML model, with no profile (no subset, no extensions), let B be a target language (not Java actually, don't want to tell more, as I am just at the step of first attempts, nothing really produced so far). UML, is a reach language, with its own concept, annotations, etc ; the language B may not support by nature or restriction profile, some of the construct available with UML and which A use.

Example: Imagine a construct appearing in A and which cannot be mapped in the target language B : what should the M2T script do so ? I though this was better to state the transformation failed, suggesting either the model should be redesigned or another target language should be choose (i.e. B may not be suitable as a target language for the model expressed in A).

Is there a way either in the standard M2T or even as an Acceleo non-standard extension to return an error when this kind of circumstance occurs ?

Note: alternatively, this may apply also when a transformation UML to AnyTargetLanguage is incomplete (like unsupported construct in the actually state of the art or of the script version).

Laurent Goubet
If yes, this simply cannot be done. Acceleo generates "text" and has no
knowledge of the target's syntax.

I guess this is the expected behavior indeed, don't worry about it Wink

Have a nice day

Y.D.



P.S. Should I use mail, newsreader or web to write here ? (seems I receive mails, so wonder if it is a mailing list instead of a forum)
Re: Model to Text : case of "unsuported by target language" [message #557249 is a reply to message #557236] Mon, 06 September 2010 09:27 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010908050508090900070309
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Yannick,

I can't help but think I had it nailed on my first attempt (I used Java
as an example, I could have said C, Fortran, Pascal, Scala... without
changing the rest of my message). The usual workflow in cases such as
these is to let Acceleo do his job (generate the target) then let the
target language's tools determine whether it is correct; in the case of
code, the dedicated compiler.

Yet I'd like to confirm some things : first, if your target is a
modeling language, you might want to look into Model to Model
transformations such as ATL instead of Model to Text. With such
languages you can validate that all of your constructs are supported in
the target, as that is specified by the target's metamodel.

Second, if your target is textual, your only option at validation (other
than letting the compiler do its job afterwards) would be to create a
metamodel describing your language and doing your generation in two
steps : first, Model to Model transformation through ATL to map your UML
concepts to your target's specific concepts, then Model to Text through
Acceleo to generate the actual code.

To answer your PS : you can use both newsreader (newsgroup
eclipse.modeling.m2t) or forum for these, I happen to be using a
newsreader :p.

Laurent Goubet
Obeo

Yannick Duch wrote:
> Hello once again Laurent,
>
> Laurent Goubet
>> I am not sure I really understand your need : You would say you are
>> trying to generate Java code, and the particular Acceleo script would
>> generate incorrect Java, you would like Acceleo to tell you beforehand
>> that the syntax of your target "after generation" is wrong?
>
> Sorry for being unclear. A try to be more explicit : let A, be an UML
> model, with no profile (no subset, no extensions), let B be a target
> language (not Java actually, don't want to tell more, as I am just at
> the step of first attempts, nothing really produced so far). UML, is a
> reach language, with its own concept, annotations, etc ; the language B
> may not support by nature or restriction profile, some of the construct
> available with UML and which A use.
>
> Example: Imagine a construct appearing in A and which cannot be mapped
> in the target language B : what should the M2T script do so ? I though
> this was better to state the transformation failed, suggesting either
> the model should be redesigned or another target language should be
> choose (i.e. B may not be suitable as a target language for the model
> expressed in A).
>
> Is there a way either in the standard M2T or even as an Acceleo
> non-standard extension to return an error when this kind of circumstance
> occurs ?
>
> Note: alternatively, this may apply also when a transformation UML to
> AnyTargetLanguage is incomplete (like unsupported construct in the
> actually state of the art or of the script version).
>
> Laurent Goubet
>> If yes, this simply cannot be done. Acceleo generates "text" and has
>> no knowledge of the target's syntax.
>
> I guess this is the expected behavior indeed, don't worry about it ;)
>
> Have a nice day
>
> Y.D.
>
>
>
> P.S. Should I use mail, newsreader or web to write here ? (seems I
> receive mails, so wonder if it is a mailing list instead of a forum)
>


--------------010908050508090900070309
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010908050508090900070309--
Re: Model to Text : case of "unsuported by target language" [message #557253 is a reply to message #557249] Mon, 06 September 2010 09:43 Go to previous messageGo to next message
Yannick Duchene (Hibou57) is currently offline Yannick Duchene (Hibou57)Friend
Messages: 50
Registered: September 2010
Location: Metz (France - Europe)
Member
Laurent Goubet
Second, if your target is textual, your only option at validation (other
than letting the compiler do its job afterwards) would be to create a
metamodel describing your language and doing your generation in two
steps : first, Model to Model transformation through ATL to map your UML
concepts to your target's specific concepts, then Model to Text through
Acceleo to generate the actual code.

That answer the question well.

I've just though about a third option to add to the above : use a kind of log file. This is feasible from a template.

Will go with a kind log file.

Thanks for all Laurent

Laurent Goubet
To answer your PS : you can use both newsreader (newsgroup
eclipse.modeling.m2t) or forum for these, I happen to be using a
newsreader Razz.

Ah, ok Smile As nntp.aioe.org does not seems to relay eclipse.*, will use the web version.
Re: Model to Text : case of "unsuported by target language" [message #557313 is a reply to message #557253] Mon, 06 September 2010 15:52 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
Hi Laurent

I think the question may be more philosphical; how to communicate with
the invocation control flow rather than the model flow.

In C/CPP there is #error
In Java there is throw

In MOFM2T and QVT there is, I think, no way to be exceptional. Probably
a language bug.

Regards

Ed Willink
Previous Topic:[xpand] generate files only once
Next Topic:Execute MWE Workflow programmatically
Goto Forum:
  


Current Time: Thu Oct 10 01:39:42 GMT 2024

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

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

Back to the top