HowTo use meta model class as type or parameter [message #1717516] |
Mon, 14 December 2015 14:09 |
|
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 #1717530 is a reply to message #1717523] |
Mon, 14 December 2015 15:24 |
|
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 #1717553 is a reply to message #1717543] |
Mon, 14 December 2015 16:41 |
|
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 #1726271 is a reply to message #1726270] |
Thu, 10 March 2016 20:58 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04833 seconds