Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Using Acceleo investigating a model
Using Acceleo investigating a model [message #783758] Thu, 26 January 2012 11:57 Go to next message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
My name is Paolo and I am a new Acceleo user.

I am stuck on a particolar stage of my project and I wish to know if you could, please, give some information or a tutorial where to find this info.

Using XTEXT Eclipse Tool, I wrote the grammar to implement a Dsl language, and as result I had the corresponding ".ecore" meta-model.

I imported this ".ecore" meta-model in an Acceleo project , and wrote the template to investigate this meta-model, just to reach my final target (implement a C# language transformation of my initial Dsl language).
Doing this process I had no problems.


At this point my problems are the following :

1) in Acceleo, how is it possible to implement a "model" of this meta-model ?
2) in Acceleo, how is possible to write a template that investigates (I mean, that collect information) from a model implemented in point 1 and use it for my final target?


I wish to thank you in advance for your help.

Best regards.

Paolo.

Re: Using Acceleo investigating a model [message #783940 is a reply to message #783758] Thu, 26 January 2012 19:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

what do you mean with implement a "model"

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using Acceleo investigating a model [message #783978 is a reply to message #783940] Thu, 26 January 2012 21:39 Go to previous messageGo to next message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
Hi Christian,

I have an .ecore file representing my meta-model (represented in term of EClass, EAttribute, ecc).
I wish to know if, in Acceleo, is possible to "translate" this meta-model into the corresponding model.

I think to make the problem more clear, I can use a UML example : the object CLASS is the meta-model ---> the object PERSON is the model (so it is the implementation of the meta-model).

Please excuse if is not very clear, but I don't know how to explain in a better way.

Cheers.
Paolo.
Re: Using Acceleo investigating a model [message #783981 is a reply to message #783978] Thu, 26 January 2012 21:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

this is clear, but i dont know how to do this in a generic way (so that it will work with all ecores of the world) how do you want to tell acceleo to create a Class Person and an Attribute Name.
this would be rather static and thus imho nonsence.

btw acceleo is a Model 2 Text tool, maybe you are looking for a Model2Model too.

but as i said: without knowing your rules how you want to decide what instances to create this is hard to tell.
so let us say you have a EClass Model that has a list of EClasses Entity that have an EAttribut name.
what so you want to do-


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using Acceleo investigating a model [message #783987 is a reply to message #783981] Thu, 26 January 2012 22:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I think you just want to

Open your Ecore file in Sample Ecore Editor
select your root element
Invoke Create Dynamic Instance

Regards

Ed Willink


On 26/01/2012 21:49, Christian Dietrich wrote:
> Hi,
>
> this is clear, but i dont know how to do this in a generic way (so
> that it will work with all ecores of the world) how do you want to
> tell acceleo to create a Class Person and an Attribute Name.
> this would be rather static and thus imho nonsence.
>
> btw acceleo is a Model 2 Text tool, maybe you are looking for a
> Model2Model too.
>
> but as i said: without knowing your rules how you want to decide what
> instances to create this is hard to tell.
> so let us say you have a EClass Model that has a list of EClasses
> Entity that have an EAttribut name.
> what so you want to do-
Re: Using Acceleo investigating a model [message #784327 is a reply to message #783987] Fri, 27 January 2012 11:13 Go to previous messageGo to next message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
Many thanks for your reply : I wish to thank you for your time.

As Edward suggested, I implemented a Dinamic Instance of my meta-model (and called it Model.xmi) : is that I was looking for.

I wish to know if it is possible to load Model.xmi in Acceleo and use it to produce the final transformation (the goal is translate a basic structure of my initial Domain Specific Language into a C# class).

Regards.
Paolo.
Re: Using Acceleo investigating a model [message #784443 is a reply to message #784327] Fri, 27 January 2012 14:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Yes

On 27/01/2012 11:13, Paolo Mising name wrote:
> Many thanks for your reply : I wish to thank you for your time.
>
> As Edward suggested, I implemented a Dinamic Instance of my meta-model
> (and called it Model.xmi) : is that I was looking for.
>
> I wish to know if it is possible to load Model.xmi in Acceleo and use
> it to produce the final transformation (the goal is translate a basic
> structure of my initial Domain Specific Language into a C# class).
>
> Regards.
> Paolo.
>
Re: Using Acceleo investigating a model [message #784489 is a reply to message #784443] Fri, 27 January 2012 15:54 Go to previous messageGo to next message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
Hi Edward.

Thank for your reply.
Could you please tell me how to import that model in Acceleo?
I have already written the template file to investigate the meta-model : what have I to do now?

Regards.
Paolo.
Re: Using Acceleo investigating a model [message #784499 is a reply to message #784489] Fri, 27 January 2012 16:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
It's called an input model.

On 27/01/2012 15:54, Paolo Mising name wrote:
> Hi Edward.
>
> Thank for your reply.
> Could you please tell me how to import that model in Acceleo? I have
> already written the template file to investigate the meta-model : what
> have I to do now?
>
> Regards.
> Paolo.
>
Re: Using Acceleo investigating a model [message #784519 is a reply to message #784499] Fri, 27 January 2012 16:47 Go to previous messageGo to next message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
Hi Edward.

Could you please be more specific about what I have to do.
Can you suggest me a tutorial explaining this operation?

Cheers.
Paolo.
Re: Using Acceleo investigating a model [message #787164 is a reply to message #784519] Tue, 31 January 2012 08:25 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Paolo,

Loading a dynamic instance as input of an Acceleo generation is the same as loading a "regular" model. The only thing to look at if I am not mistaken is to make sure your package is properly registered (see the "registerPackage" method of the generated launcher).

However, please make sure that using a "dynamic instance" is indeed what you need. If you are trying to create generators that should be used by others, you probably need to generate your model code and use a real instance of this model as input of the generation. Make sure you also take a look at the Getting Started guide if you have not done it yet.

Laurent Goubet
Obeo
Re: Using Acceleo investigating a model [message #787262 is a reply to message #787164] Tue, 31 January 2012 11:17 Go to previous messageGo to next message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
Hi Laurent.

Many thanks for your reply and the time spent for my problem.

After your mail I am a bit confused about what I have really to do.
At the moment I am reading the "Android tutorial" because I think there is something very similar at what I have to do.

I will try implementing an application following that tutorial and I will keep you posted.

Best regards.
Paolo.
Re: Using Acceleo investigating a model [message #789033 is a reply to message #787262] Thu, 02 February 2012 14:23 Go to previous message
Paolo Missing name is currently offline Paolo Missing nameFriend
Messages: 9
Registered: January 2012
Junior Member
Hi Laurent.

I spent some days with the "Android tutorial" but I am still stuck.
I hope you can give some suggestions.

This is what I did for my tests.

I have the .ecore file in a folder and I created the "Dynamic Instance" called MODEL.XMI (so this is the .ecore implementation).

I developed an Acceleo Project, where I wrote a Generate.mtl file to investigate the .ecore file and this worked fine ( of course I launched the generation using as model the .ecore file).
Subsequently I launched the generation using as model the file MODEL.XMI , and this was not working.

I know that there is something wrong doing this procedure, but is not very clear to me how else I should procede.

Can you please give me any suggestion?

Best regards.
Paolo.
Previous Topic:[Acceleo] The generation fail to generate any file because there are no model elements that matches
Next Topic:[Acceleo] Unable to find module?
Goto Forum:
  


Current Time: Thu Mar 28 18:52:27 GMT 2024

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

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

Back to the top