Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » UML to Ecore
UML to Ecore [message #760933] Mon, 05 December 2011 16:13 Go to next message
Benoit Lelandais is currently offline Benoit LelandaisFriend
Messages: 19
Registered: November 2011
Junior Member
Hi,

We have an old M2M transformation chain with Xtend 0.7 and Mwe. The input is an EMF UML2 model and the output an Ecore model. We would like to upgrade this chain in Xtext 2.1 to use the new Xtend2 language. Is this possible ? Is there an example available to see how to read the input model ?

Thanks for your answer.

[Updated on: Mon, 05 December 2011 16:14]

Report message to a moderator

Re: UML to Ecore [message #761024 is a reply to message #760933] Mon, 05 December 2011 19:35 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
Certainly it's possible. Like Xtend, Xtend2 has got special syntax for the caching create function mechanism which is the feature you'd need most for M2M transformations. Reading models and executing an Xtend2 file has changed a bit: in particular, Xtend2 compiles to Java so you simply have an instance of the class injected and then you call the transformation function (def) which returns the resultant Ecore model.

Re: UML to Ecore [message #761048 is a reply to message #761024] Mon, 05 December 2011 20:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

yes this is possible. you can read the model using the aproach described here http://christiandietrich.wordpress.com/2011/07/29/xtend2-code-generators-with-non-xtext-models/
or you use the good old org.eclipse.emf.mwe.utils.Reader

bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
		registerGeneratedEPackage = "org.eclipse.uml2.uml.UMLPackage"
	}
	
	component = org.eclipse.emf.mwe.utils.Reader {
    	uri = "src/model/test.uml"
    	modelSlot = "model2"
    }


in both cases you would have to write a workflow component for the m2m

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: UML to Ecore [message #762146 is a reply to message #761048] Wed, 07 December 2011 16:02 Go to previous messageGo to next message
Benoit Lelandais is currently offline Benoit LelandaisFriend
Messages: 19
Registered: November 2011
Junior Member
Hi,

If I read the UML model with this reader, all the profiles applied to this model are null. I also tried with the old deprecated xtend XmiReader and it works.

For example :
	component = org.eclipse.emf.mwe.utils.Reader {	
		uri = "${modelDir}/SimpleHydro.uml"
		modelSlot = "umlmodel1"
		
	} 
	  
	component = org.eclipse.xtend.typesystem.emf.XmiReader{
		modelFile = "${modelDir}/SimpleHydro.uml"
		outputSlot = "umlmodel2"		
	}


'umlmodel1' applied profiles are null.
'umlmodel2' applied profiles are ok.

So, what can I do to use the new reader and browse my profiles ?

Thanks for your answer.
Re: UML to Ecore [message #762169 is a reply to message #762146] Wed, 07 December 2011 16:35 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
If XmiReader works, why not stick to that (at least to get things going in the right direction)? Xtend2 can work with it as long as the model is available in-memory as POJOs, e.g. through EMF.

Re: UML to Ecore [message #762265 is a reply to message #762169] Wed, 07 December 2011 19:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

did you try to use the Reader with platform:/resource uris e.g.

	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".." />
	
	<component class="org.eclipse.emf.mwe.utils.Reader">
		<uri value="platform:/resource/xpand.uml.sample/src/model/test.uml" />
		<modelSlot value="model" />
	</component>


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: UML to Ecore [message #762526 is a reply to message #762265] Thu, 08 December 2011 08:48 Go to previous message
Benoit Lelandais is currently offline Benoit LelandaisFriend
Messages: 19
Registered: November 2011
Junior Member
It works with the platform URI...
Thanks.
Previous Topic:Accessing Warnings associated with a DSL element
Next Topic:Dynamic grammar
Goto Forum:
  


Current Time: Fri Apr 26 23:26:20 GMT 2024

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

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

Back to the top