Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Papyrus UML Profiles(How to use UML profiles in Acceleo)
[Acceleo] Papyrus UML Profiles [message #655883] Wed, 23 February 2011 01:39 Go to next message
No real name is currently offline No real name
Messages: 5
Registered: February 2011
Junior Member
Hi,

I created an UML profile with Papyrus, and now I have a model.profile.uml file with the metamodel, and an instance of this metamodel in instance.uml.

Now I'd like to generate code from it using Acceleo. Can I somehow import the meta-model into a template? I already tried to reference it via "platform:/resource/path_to_the_profile", but it keeps telling me that the metamodel couldn't be resolved.

Do I have to use the standard UML2 metamodel instead and use UML APIs, like getAppliedStereotypes(), instead?

Thanks in advance,
Jay

EDIT
Sorry for the double post, my connection lagged and I hit the submit button twice.

[Updated on: Wed, 23 February 2011 01:44]

Report message to a moderator

Re: [Acceleo] Papyrus UML Profiles [message #656056 is a reply to message #655883] Wed, 23 February 2011 22:31 Go to previous messageGo to next message
Philippe Palau is currently offline Philippe Palau
Messages: 13
Registered: February 2011
Junior Member
Hi Jay,

Perhaps i don't understand your question.

You created an uml profile, i' think you use it in a Uml model. If you intend to generate with acceleo from this model, you can access stereotype applied to your model elements with code like this :

[query public hasStereotype(e : Element, stereotypeName : String) : Boolean = (not self.getAppliedStereotype(stereotypeNameoclIsUndefined())/]

[query public stereoPropValue(e : Element, stereotypeName : String, propertyName : String) : String = 
e.getValue(e.getAppliedStereotype(stereotypeName), propertyName)/]


stereotypeName must be qualified like this:
ProfileName::StereotypeName

Best regards
Re: [Acceleo] Papyrus UML Profiles [message #656057 is a reply to message #655883] Wed, 23 February 2011 22:31 Go to previous messageGo to next message
Philippe Palau is currently offline Philippe Palau
Messages: 13
Registered: February 2011
Junior Member
Hi Jay,

Perhaps i don't understand your question.

You created an uml profile, i' think you use it in a Uml model. If you intend to generate with acceleo from this model, you can access stereotype applied to your model elements with code like this :

[query public hasStereotype(e : Element, stereotypeName : String) : Boolean = (not self.getAppliedStereotype(stereotypeNameoclIsUndefined())/]

[query public stereoPropValue(e : Element, stereotypeName : String, propertyName : String) : String = 
e.getValue(e.getAppliedStereotype(stereotypeName), propertyName)/]


stereotypeName must be qualified like this:
ProfileName::StereotypeName

Best regards

sorry i' double post too Smile

[Updated on: Wed, 23 February 2011 22:36]

Report message to a moderator

Re: [Acceleo] Papyrus UML Profiles [message #656075 is a reply to message #655883] Thu, 24 February 2011 02:46 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 5
Registered: February 2011
Junior Member
Hi Philippe,

Thank you for your response.

I just thought that I have to call something like the following, but with my profile instead of the regular UML metamodel:

[module classBody('http://www.eclipse.org/uml2/3.0.0/UML')/]

Do I just have to use the UML metamodel and can still access stereotypes applied to my model elements?

Best regards,
Jay
Re: [Acceleo] Papyrus UML Profiles [message #656090 is a reply to message #656075] Thu, 24 February 2011 07:11 Go to previous messageGo to next message
Philippe Palau is currently offline Philippe Palau
Messages: 13
Registered: February 2011
Junior Member
Hi,
Your model is an UML 2 model, use the regular UML metamodel.
You ll can access stereotype using getAppliedStereotype method on yours model elements.

Best regards

Re: [Acceleo] Papyrus UML Profiles [message #656273 is a reply to message #656090] Thu, 24 February 2011 20:11 Go to previous message
No real name is currently offline No real name
Messages: 5
Registered: February 2011
Junior Member
Hi,

Thank you very much!

Jay
Previous Topic:[Acceleo] Papyrus UML Profiles
Next Topic:xPand and TaggedValues
Goto Forum:
  


Current Time: Sat Oct 25 08:59:40 GMT 2014

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

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