Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Multi-model to text transformation([Acceleo] Multi-model to text transformation)
[Acceleo] Multi-model to text transformation [message #1766269] Mon, 19 June 2017 16:41 Go to next message
Cristina Vicente-Chicote is currently offline Cristina Vicente-ChicoteFriend
Messages: 5
Registered: April 2017
Junior Member
Dear all,

I am trying to use Acceleo to generate some text from a root.xmi model, defined in terms of a rootMM.ecore meta-model. This metamodel has some dependencies on other meta-models. As a consequence, my root.xmi model needs to load some "external models" in memory when the required attributes/references need to be displayed/modified in the model editor. This means that these "external models" are only loaded in memory on demand... not when the root.xmi model is opened!! I guess this is why I am not being able to generate text from some parts of my root.xmi model, in particular, for the attributes of objects stored in those "external models".

When I try to write one of these attributes I always get "invalid". However, if I manage to load these elements in memory in advance (e.g., using an odd "getter" implemented just for that purpose in the corresponding class of the external meta-model), I get the right value of the attribute.

Do you know how to force the load in memory of all the models required by a given xmi model? I guess this would definitively solve the problem.

Thanks in advance,

Cristina
Re: [Acceleo] Multi-model to text transformation [message #1766281 is a reply to message #1766269] Mon, 19 June 2017 20:09 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
Hi

EcoreUtil.resolveAll will resolve all proxies eagerly, but doing nothing should resolve then lazily. So I suspect that you are experiencing a different problem; more likely the difficulty of getting Acceleo to save correct inter-model references at edit time within Eclipse for use at run-time standalone.

Regards

Ed Willink
Re: [Acceleo] Multi-model to text transformation [message #1766292 is a reply to message #1766281] Tue, 20 June 2017 03:29 Go to previous messageGo to next message
Cristina Vicente-Chicote is currently offline Cristina Vicente-ChicoteFriend
Messages: 5
Registered: April 2017
Junior Member
Dear Ed,

Thanks a lot for your prompt answer!

The same problem arises when running my acceleo transformation within the local Eclipse where I wrote the .mtl file, and when I execute it in another Eclipse, launched from the former :-(

Where shall I invoke EcoreUtil.resolveAll to see if it works? In the main method of the GenerateXXX.java associated to the main Acceleo template? After getting the input model URI?, i.e., after:

URI modelURI = URI.createFileURI(args[0]);

or after creating the generator object?, i.e., after:

GenerateXXX generator = new GenerateXXX (modelURI, folder, arguments);

EcoreUtil.resolveAll requires a ResourceSet as an input, right? Where do I get that ResourceSet from?

Thanks in advance!
Cheers,
Cristina
Re: [Acceleo] Multi-model to text transformation [message #1766310 is a reply to message #1766292] Tue, 20 June 2017 07:51 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Cristina,

"resolveAll" will only do what EMF would normally without interferences, it will just do it eagerly instead of on-demand and should not be of any help in your case.

Could you share us the template bits that get you "invalid", as well as the models (or samples reduced to just the problematic parts) that get you your issue? Without more info, there's nothing we can really say about what's happening in your case.

Laurent Goubet
Obeo
Re: [Acceleo] Multi-model to text transformation [message #1768363 is a reply to message #1766292] Tue, 18 July 2017 01:36 Go to previous messageGo to next message
zhihui Zhang is currently offline zhihui ZhangFriend
Messages: 2
Registered: July 2017
Junior Member
Hi Cristina,

Recently i start to learn Acceleo, i want to translate SysML model to SystemC code .if you have related experience , can you provide me a template? Thank you very much!

Best Regars!
wisdom
Re: [Acceleo] Multi-model to text transformation [message #1768717 is a reply to message #1768363] Sat, 22 July 2017 08:25 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7680
Registered: July 2009
Senior Member
Hi

Don't. The gap between SysML and SystemC text is much too large. Implement one (or more) M2Ms from the SysML model to a SystemC model, then an M2T from SystemC to text. You should be able to find a SystemC model somewhere and so can probably find an M2T too.

Regards

Ed Willink
Previous Topic:Setting an absolute path for the File block
Next Topic:[Acceleo] Avoid the new line character when a template is called
Goto Forum:
  


Current Time: Tue Dec 10 18:12:38 GMT 2024

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

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

Back to the top