Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » HowTo use meta model class as type or parameter
HowTo use meta model class as type or parameter [message #1717516] Mon, 14 December 2015 14:09 Go to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

Hello,

I'm working on a transformation rule from my own Ecore meta model to the
UML Ecore model. I'm quite new to ATL and want to know, how I can use a
meta model class in a rule, e.g. to set it as a type for a property or
call a ecore method which expects it as parameter.

In particular, I want to create a property with the specific type UML!Element.
Therefore, I use something like
type <- UML!Element
but this is not correct.

In another case, I want to create a UML Extension using the Ecore
Operation Stereotype.createExtension(metaclass: UML!Class, isrequired,
Boolean).
How do I get the type of UML!Class?

Thank you in advance,
Joachim

[Updated on: Mon, 14 December 2015 14:14]

Report message to a moderator

Re: HowTo use meta model class as type or parameter [message #1717523 is a reply to message #1717516] Mon, 14 December 2015 14:56 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You should add the UML metamodel as input of your transformation in order to be able to reference it.
 in UML : ECORE

Then you should be able to do :
type <- ECORE!Class.allInstances()->one(e | e.name = 'Element')

[Updated on: Mon, 14 December 2015 14:57]

Report message to a moderator

Re: HowTo use meta model class as type or parameter [message #1717530 is a reply to message #1717523] Mon, 14 December 2015 15:24 Go to previous messageGo to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

Thank you for your quick answer.
I'm not sure, if I understand it right. I should add the metamodel
during the preperation of the VM (I use emftvm)? Then in my module, I
also add the UML as input model and name it ECORE, right? Then, your
code example should work?
Is it mandatory to name it ECORE?
Re: HowTo use meta model class as type or parameter [message #1717543 is a reply to message #1717530] Mon, 14 December 2015 16:11 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
UML is a metamodel but it also is a model conforming to the ECORE metamodel (which is also a meta-meta-model).
Here you just need to load UML as a model so that you can reference it.
You need to specify its metamodel which is ECORE but you can name is as you like.
Re: HowTo use meta model class as type or parameter [message #1717553 is a reply to message #1717543] Mon, 14 December 2015 16:41 Go to previous messageGo to next message
Joachim Engelhardt is currently offline Joachim EngelhardtFriend
Messages: 53
Registered: September 2013
Member

Is it correct to load the UML metamodel as Ecore model? Or do I have to
load it as UML model? If so, where do I get the UML metamodel? If I look
into an existing UML model (.uml) using the UML model editor, I see,
that the meta model is referenced by
pathmap://UML_METAMODELS/UML.metamodel.uml
But this URI cannot be used to load the model with the emftvm.

I tried the UML Ecore MetaModel as input model and the following code:
umlProperty: UML!Property (
type <- ECORE!EClass.allInstancesFrom('UMLMetaModel')
-> select(e | e.name = 'Element').first()
)
but I get a ClassCastException: org.eclipse.emf.ecore.impl.EClassImpl
cannot be cast to org.eclipse.uml2.uml.Type
Re: HowTo use meta model class as type or parameter [message #1726270 is a reply to message #1717553] Thu, 10 March 2016 20:54 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

You need to load the UML metamodel expressed in the Ecore language, registered under the URI "http://www.eclipse.org/uml2/5.0.0/UML"

Cheers,
Dennis
Re: HowTo use meta model class as type or parameter [message #1726271 is a reply to message #1726270] Thu, 10 March 2016 20:58 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

Wait, I didn't read the second half of your post: your transformation is expecting a UML Type. In that case the metamodel in your launch config should be the Ecore UML metamodel as I posted previously, and the model should be the UML metamodel expressed in UML itself.

P.S. if it this point you still don't get it to work, you had better attach an example zipped eclipse project to demonstrate what it is you want.


Cheers,
Dennis
Previous Topic:Problem Papyrus and stereotype applied
Next Topic:Add new transformed record to the end of the file
Goto Forum:
  


Current Time: Thu Apr 25 11:10:46 GMT 2024

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

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

Back to the top