Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Working with multiple input models and metamodels([Acceleo] How can I generate code from two models having two different underlying metamodels or from two models having the same underlying metamodel?)
[Acceleo] Working with multiple input models and metamodels [message #1784101] Thu, 22 March 2018 14:47 Go to next message
Novarun Deb is currently offline Novarun DebFriend
Messages: 3
Registered: February 2018
Junior Member
I have a very clear scenario. I want to work with two input models in an Acceleo project. These two models may have the same or different underlying metamodels. I have tried all possible permutation of code syntax but none works.

I know that Acceleo supports defining multiple metamodels as follows:

[module generate('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.xtext.org/example/novadsl/NovaDsl')]

where i am working with the UML metamodel and a metamodel of my own DSL defined using XText. However, I cannot take as input two different models for the two metamodels using the following syntax:

[template public generateElement(bModel : Model, aModel : Model)]
[comment @main/]
....
[/template]

When I try to run this acceleo project i get the following exception:

Exception in thread "main" org.eclipse.acceleo.engine.AcceleoEvaluationException: Could not find public template generateElement in module generate.
at org.eclipse.acceleo.engine.service.AcceleoService.findTemplates(AcceleoService.java:1201)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:616)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:209)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:172)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:159)
at org.eclipse.acceleo.ndslmult2txt.main.Generate.doGenerate(Generate.java:204)
at org.eclipse.acceleo.ndslmult2txt.main.Generate.main(Generate.java:162)

The same problem persists when I have only one metamodel in the [module generate......], i.e., irrespective of the number of metamodels that I include in my generate.mtl file, Acceleo cannot accept more than one input model in the current settings.

Is there a solution or workaround to this problem? I just want to work with 2 input models (irrespective of the number of metamodels) in an Acceleo project.

If this is possible,then can you kindly give a step-by-step tutorial how this can be done!!
Re: [Acceleo] Working with multiple input models and metamodels [message #1784102 is a reply to message #1784101] Thu, 22 March 2018 14:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

Sorry. There comes a point when you have to learn how powerful the Eclipse debugger is. It's how I solve most of my problems.

Regards

Ed Willink
Re: [Acceleo] Working with multiple input models and metamodels [message #1784108 is a reply to message #1784102] Thu, 22 March 2018 15:42 Go to previous messageGo to next message
Novarun Deb is currently offline Novarun DebFriend
Messages: 3
Registered: February 2018
Junior Member
Sorry. But as far as i understood from the debugger, the Acceleo evaluation Could not find public template generateElement in module generate. This is because there are 2 paramteres of this function given for working with 2 input models. The project works fine with 1 input model.

Is there a way in which i can work with 2 input models of the same metamodel?
Re: [Acceleo] Working with multiple input models and metamodels [message #1784117 is a reply to message #1784108] Thu, 22 March 2018 16:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

The Generate.java is there as a good starting example. I found that as I needed more interesting functionality, I needed to rewrite some parts and overload some inherited bits. maybe you have to rewrite for two arguments.

Regards

Ed Willink
Re: [Acceleo] Working with multiple input models and metamodels [message #1784229 is a reply to message #1784117] Fri, 23 March 2018 18:15 Go to previous message
Mad Vin is currently offline Mad VinFriend
Messages: 38
Registered: September 2013
Member
Hi,

I've already read a post about this before.
If I remember correctly, the solution is to manage the second input model in the java file of your main generator module. You can specify it by parameter in the program launcher, receive it in the main method, then load it manually in Acceleo.

Regards.
Previous Topic:Acceleo
Next Topic:Acceleo and QML
Goto Forum:
  


Current Time: Wed Sep 26 07:39:50 GMT 2018

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

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

Back to the top