Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » UML2 MetaModel not applied
UML2 MetaModel not applied [message #500937] Mon, 30 November 2009 11:42 Go to next message
Rodrigo Tobar is currently offline Rodrigo TobarFriend
Messages: 5
Registered: November 2009
Junior Member
Hi everyone,

I'm in the process of porting a code generator from oAW5 to the new "oAW5" suite. I've been following several blog posts here and there that have been useful in the migration of the Eclipse project and the code. Anyways, I'm facing problems with the workflow.

My workflow reads the model, checks it against a Check file, and then generates the code. It worked fine in oAW4, but now it seems to miss a namespace or something like that.

The workflow file is as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
<workflow>

	<property name="genPath" value="src-gen/" />
	<property name="modelFile" value="my_model.uml" />

	<bean class="org.eclipse.xtend.typesystem.uml2.Setup" standardUML2Setup="true"/>

	<component class="org.eclipse.emf.mwe.utils.Reader" uri="${modelFile}">
		<modelSlot value="model"/>
	</component>

	<component class="org.eclipse.xtend.check.CheckComponent">
		<metaModel id="mm" class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel" />
		<checkFile value="constraints"/>
		<emfAllChildrenSlot value="model"/>
	</component>

	<component id="dirCleaner"
		class="org.eclipse.emf.mwe.utils.DirectoryCleaner"
		directory="src-gen"/>

	<component id="gen" class="org.eclipse.xpand2.Generator" skipOnErrors="true">
		<metaModel idRef="mm" />
		<genPath value="${genPath}"/>
		<expand value="templates::Root::Root FOR model"/>
		<beautifier class="org.eclipse.xpand2.output.JavaBeautifier"/>
	</component> 
</workflow>


In my template, I have the following:

«IMPORT uml»

«DEFINE Root FOR uml::Model»
	«EXPAND FSMJava::Root FOREACH allOwnedElements().typeSelect(uml::StateMachine)»
«ENDDEFINE»


and the error that I get is the following:

Nov 30, 2009 12:21:28 PM org.eclipse.emf.mwe.core.container.CompositeComponent internalInvoke
INFO: Generator(gen): generating 'templates::Root::Root FOR model' => []
Nov 30, 2009 12:21:28 PM org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent invokeInternal
SEVERE: Error in Component gen of type org.eclipse.xpand2.Generator: 
	EvaluationException : No Definition 'templates::Root::Root for null::Model' found!
	[23,38] on line 1 'EXPAND templates::Root::Root FOR model'

Nov 30, 2009 12:21:28 PM org.eclipse.emf.mwe.core.WorkflowRunner executeWorkflow
SEVERE: Workflow interrupted. Reason: No Definition 'templates::Root::Root for null::Model' found!
Nov 30, 2009 12:21:28 PM org.eclipse.emf.mwe.core.WorkflowRunner logIssues
SEVERE: [ERROR]: No Definition 'templates::Root::Root for null::Model' found!(Element: EXPAND templates::Root::Root FOR model; Reported by: Generator(gen): generating 'templates::Root::Root FOR model' => [])


From what I get, the workflow is considering the "mode" variable as of "null::Model" type, when it should be of "uml::Model" type. I'm using the UML2MetaModel in the generator and in the checks, but it doesn't work anyways.

Any hints about what could be the problem here? From now, I'm highly grateful for any replies to my problem.

Cheers!
Re: UML2 MetaModel not applied [message #500964 is a reply to message #500937] Mon, 30 November 2009 13:49 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Don't you have any profile for your model? Usually one would not use the UML2MetaModel bare bone, but typically the ProfileMetaModel. Anyway, maybe it is just a bug. Could you define a dummy profile and try again with a ProfileMetaModel (don't forget to use a platform:/resource URI for the profile, same for your model path).

If the problem disappears then could you be so kind and open a bug report?

Kind regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: UML2 MetaModel not applied [message #500987 is a reply to message #500937] Mon, 30 November 2009 15:28 Go to previous messageGo to next message
Andre Albert is currently offline Andre AlbertFriend
Messages: 25
Registered: July 2009
Junior Member
I have a similar question..
In my workflow i reference a ProfileMetaModel but its stereotypes are ignored when processing xpt templates

I remember that i also got the "templates::Root::Root for null::Model" error. On my environment my input model was not valid, i guess. Maybe, you can upload it here.

Do you run it stand-alone?
I do also have problems while migrating from oaw4 to eclipse.xpand having a standalone (Ant) environment outside of eclipse.

Is platform:/resource usable standalone?

Now i withdraw all my migration effort and switched back to eclipse uml2 2.X.X and oaw4 since -for me- it is the only way to make it run.

Re: UML2 MetaModel not applied [message #500990 is a reply to message #500964] Mon, 30 November 2009 15:38 Go to previous messageGo to next message
Rodrigo Tobar is currently offline Rodrigo TobarFriend
Messages: 5
Registered: November 2009
Junior Member
Dear,

thanks for the advice. Actually I was missing to include the profles. I created one bean per profile, and added them to the generator by idRef. On each profile, I had to substitute UML 2.1.0 by UML 2.0.0 in order to make them work, as I read in one of your blog entries (otherwise, they were not recognized, why is this?).

Now it perfectly works and the code is being generated without problems. Thanks a lot for the help Smile

Rodrigo
Re: UML2 MetaModel not applied [message #501915 is a reply to message #500987] Fri, 04 December 2009 13:15 Go to previous message
Rodrigo Tobar is currently offline Rodrigo TobarFriend
Messages: 5
Registered: November 2009
Junior Member
Andre Albert wrote on Mon, 30 November 2009 10:28
I have a similar question..
Do you run it stand-alone?
I do also have problems while migrating from oaw4 to eclipse.xpand having a standalone (Ant) environment outside of eclipse.

Is platform:/resource usable standalone?



Dear,

I'm now in the same problem that you describe. I was able to apply the profiles, generate code and all, but since the ProfileMetaModel must be used with the platform:/resource URI protocol, I cannot run it stand-alone.

Is there a workaround for this? or maybe I'm just getting the concept wrong?

Thanks in advance,

Rodrigo
Previous Topic:[XPAND] Ecore Metamodel containing EEnum
Next Topic:[xpand] ignores applied stereotypes
Goto Forum:
  


Current Time: Mon Oct 07 23:52:56 GMT 2024

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

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

Back to the top