Home » Modeling » Papyrus » Importing UML profile in an Architecture model
Importing UML profile in an Architecture model [message #1799247] |
Mon, 03 December 2018 13:26 |
|
Hi there,
We are trying to create an Architecture model in Papyrus Photon for a customised viewpoint.
I am a bit confused on how one should import an UML profile into the Description language of a Domian.
I have with me a simple uml profile (let's call it simple.profile.uml), when I do a load resource, I cannot locate the Profile in the Description language. Did I do anything wrong? What is the specific steps that I need to follow to refer to an UML profile?
Cheers,
Ran Wei
Research Associate
Department of Computer Science
University of York
|
|
|
Re: Importing UML profile in an Architecture model [message #1799671 is a reply to message #1799247] |
Wed, 12 December 2018 08:17 |
|
Hi,
The profile is not a really important thing in your architecture. The most important about your profile in your architecture is the element types and the creation command class.
Indeed, when your defined your element types, you must applied your stereotype to your UML element to create if needed (ask me if you want more informations).
If you want to apply automatically the profile into your created model, you must create your own "Creation command class" specified in the architecture (in the language).
Your class will contains something like that :
protected void initializeModel(final EObject owner) {
super.initializeModel(owner);
Package packageOwner = (Package) owner;
// Retrieve profile
Profile profile= (Profile) PackageUtil.loadPackage(URI.createURI("MyProfilePathIntoPlugin"), owner.eResource().getResourceSet());
if (null != profile) {
PackageUtil.applyProfile(packageOwner, profile, true);
}
}
HTH,
Nicolas
|
|
|
Re: Importing UML profile in an Architecture model [message #1799687 is a reply to message #1799671] |
Wed, 12 December 2018 12:00 |
|
Hi Nicholas,
Thank you very much for your response!
The architecture model has got me confused for quite some time. Here's what I have so far:
1) I have defined a simple UML Profile, and created corresponding genmodel, model code, and declared the generated package in plugin.xml. My question with regard to this is: is generating the model code necessary in order to create a customised editor?
2) I have created an architecture model, and load the UML profile in the description language, I have the .typesetconfiguration file generated by Papyrus from my UML profile, and reference it in the architecture model. I have also defined a palette model and referenced it in the architecture model. I have also registered the architecture model in the extension point.
3) I have also created a model creation command, and register the UML profile programmatically like you showed me above.
4) I am able to start a new Eclipse instance, and create a model using my defined architecture model (view point). The model gets created successfully (no exceptions, I am able to see that the profile is applied to the model), but I am unable to create model elements from my defined palette.
I suspected that there may be something wrong with the element types configuration. Could you please may be say a bit more about this?
Thank you very much.
Ran
Research Associate
Department of Computer Science
University of York
|
|
|
Re: Importing UML profile in an Architecture model [message #1799694 is a reply to message #1799687] |
Wed, 12 December 2018 14:00 |
|
Hi,
To answer about your first question (My question with regard to this is: is generating the model code necessary in order to create a customised editor?) : Yes you need it to create element from the EMF framework (The element types manage it)
Concerning the problem you get :
1) Did the created model have the profile applied ? If not, take a look about your creation command class.
2) Do you have elementtypes defined for semantic and for graphical elements ? If not, i guess it will be the problem. You will define semantic element types inherited UML semantic element types and you will define graphical elements inherited UML graphical elements AND your semantis elements. If you have some problems about that, i can show you a simple example to explain that.
3) If you have correctly defined your element types, did the palette reference the graphical element types ?
You can watch if you are able to select your palette configuration with the 'Customize...' menu item in the palette.
HTH,
Nicolas
|
|
|
Re: Importing UML profile in an Architecture model [message #1800174 is a reply to message #1799694] |
Thu, 20 December 2018 21:46 |
|
Hi Nicolas,
Thanks very much for your response, and apologies for not being able to reply to you sooner.
With regard to your last post:
Quote:
1) Did the created model have the profile applied ? If not, take a look about your creation command class.
Yes the created model have the profile applied.
Quote:
2) Do you have elementtypes defined for semantic and for graphical elements ? If not, i guess it will be the problem. You will define semantic element types inherited UML semantic element types and you will define graphical elements inherited UML graphical elements AND your semantis elements. If you have some problems about that, i can show you a simple example to explain that.
I have defined semantic element types inherited from UML, the graphical elements are the ones that confuse me, it would be great if you could provide a n example on this.
Quote:
3) If you have correctly defined your element types, did the palette reference the graphical element types ?
I referenced the palette definition in the .architecture model, so when a new Eclipse starts up, the viewpoint is there (with the palette).
I am wondering, if you could explain a little bit about the organisations of models in plug-ins? As much as I understood, the profile should be in one plug-in, then another plug-in for elementtypesconfiguration, and then another plug-in for the .architecture model and the palette. If this is the case, then please let me know
1) Do I need to generate the code (also the ecore metamodel) for the profile (i.e. the static profile)?
2) How to reference to the profile in other plugins without starting a new Eclipse instance?
3) How to reference to the elementtypesconfiguration from the architecture model without starting a new Eclipse instance?
Thank you very much for your kind help, it is much appreciated.
Cheers!
Will
Research Associate
Department of Computer Science
University of York
|
|
| |
Re: Importing UML profile in an Architecture model [message #1800721 is a reply to message #1800362] |
Mon, 07 January 2019 09:36 |
|
Hi,
I think your problem comes from the graphical element types.
For example, i will show you the class elements types for example :
1) We create a class element type ('UML::Class')
2) We create some graphical element types inherit from the previous metamodel element type ('UML::Class') named 'Class_Shape' and 'Class_Shape_CN'
But for your case, if you just manage stereotypes (as i supposed), you have do these steps:
1) Create your Specialization of your Profile element inherit from the UML metamodel element. For example, if i manage a stereotype on class, i will have this one:
<elementTypeConfigurations xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" xmi:id="my.identifier.exampleStereotype" identifier="my.identifier.exampleStereotype" name="ExampleStereotype" hint="UML::Class" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
<iconEntry xmi:type="elementtypesconfigurations:IconEntry" xmi:id="_R-jZsIkOEeiS4samNlCtPg" iconPath="/icons/full/obj16/Class.gif" bundleId="org.eclipse.uml2.uml.edit"/>
<matcherConfiguration xmi:type="stereotypematcher:StereotypeApplicationMatcherConfiguration" xmi:id="_Utj9oIkOEeiS4samNlCtPg" profileUri="http://www.profileuri.com">
<stereotypesQualifiedNames>ExampleProfile::ExampleStereotype</stereotypesQualifiedNames>
</matcherConfiguration>
<specializedTypes xmi:type="elementtypesconfigurations:MetamodelTypeConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations#org.eclipse.papyrus.uml.Class"/>
</elementTypeConfigurations>
2) After you have to create your own graphical element types depending to this element type created. To continue this example:
<elementTypeConfigurations xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" xmi:id="my.identifier.di.exampleStereotype_Class_Shape" identifier="my.identifier.di.exampleStereotype_Class_Shape" name="Example Stereotype (Class_Shape)" hint="Class_Shape" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
<iconEntry xmi:type="elementtypesconfigurations:IconEntry" xmi:id="_gjTvQYmgEeiS4samNlCtPg" iconPath="/icons/full/obj16/ExampleStereotype.gif" bundleId="my.plugin.profile.edit"/>
<specializedTypes xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" href="platform:/plugin/my.plugin.types/models/example.elementtypesconfigurations#my.identifier.exampleStereotype"/>
<specializedTypes xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/umldi.elementtypesconfigurations#org.eclipse.papyrus.umldi.Class_Shape"/>
</elementTypeConfigurations>
3) You have to link your palette element to this graphical element type.
I hope this example helps you for element types.
Concerning the architecture of our plugins, we got this type:
1) We have a plugin for the architecture named 'my.plugin.architecture'
2) We have 2 plugins for profile 'my.plugin.profile' and 'my.plugin.profile.edit'
3) We have a plugin with element types 'my.plugin.types'
4) We have a plugin for the diagram and palette 'my.plugin.class.diagram'
Finally, to answer to your questions :
Quote:1) Do I need to generate the code (also the ecore metamodel) for the profile (i.e. the static profile)?
If you need to manage some dedicated actions while coding, it's better for you to generate the code.
Quote:2) How to reference to the profile in other plugins without starting a new Eclipse instance?
You can reference the profile in your same eclipse instance but you won't have the palette, diagrams, etc. from your plugins. Take care to the URI of your profile (you will have a local URI (something like '../../../test.uml#id' instead of 'platform:/my.plugin.profile/test.uml#id')
Quote:3) How to reference to the elementtypesconfiguration from the architecture model without starting a new Eclipse instance?
You cannot reference it. Your only way to manage it is the export of your plugins into your eclipse instance (like Eclipse plugins)
HTH,
Nicolas
|
|
|
Re: Importing UML profile in an Architecture model [message #1801754 is a reply to message #1800721] |
Fri, 25 January 2019 16:29 |
Nicholas Pacini Messages: 24 Registered: June 2014 |
Junior Member |
|
|
Hello Nicolas,
I am interested in this topic as I'm facing the same scenario as described by the OP.
Unfortunately they have not replied to your latest post yet, so it is not clear if they managed to solve the issue or not.
Basically I'd like to create stereotyped elements from the palette.
I've tried to develop a minimal profile and architecture following this very useful discussion, but at the end it seems i'm missing something: I can create the element from the palette, but without name (minor issue) and, more importantly, without the stereotype!
Maybe there could still be something wrong with the graphical elements?
I've attached the sample profile and architecture to reproduce the behavior.
It would be of great help if you, or anyone else, is willing to have a look at them and tell me if there is something wrong or missing.
Kind Regards,
Nicholas
|
|
|
Re: Importing UML profile in an Architecture model [message #1801783 is a reply to message #1800721] |
Sat, 26 January 2019 18:44 |
|
Hi Nicolas,
After so many attempts, I have managed to create a working UML profile editor, with stereotypes that extend UML::Dependency. Thanks very much for your advice!
However, when I move on to creating stereotypes that extend UML::Association I ran into problems. Somehow Papyrus was not able to locate the stereotype for the edges, any idea why this may be the case?
Cheers!
Will
Research Associate
Department of Computer Science
University of York
|
|
|
Re: Importing UML profile in an Architecture model [message #1801784 is a reply to message #1801754] |
Sat, 26 January 2019 18:50 |
|
Hello Nicholas,
I believe the following change to your elementtypesconfiguration should solve your problem:
<?xml version="1.0" encoding="UTF-8"?>
<elementtypesconfigurations:ElementTypeSetConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:applystereotypeadvice="http://www.eclipse.org/papyrus/uml/types/applystereotypeadvice/1.1" xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.2" xmlns:stereotypematcher="http://www.eclipse.org/papyrus/uml/types/stereotypematcher/1.1" xmi:id="org.example.sampleProfile.elementTypes" identifier="org.example.sampleProfile.elementTypes" name="SampleProfile" metamodelNsURI="http://www.eclipse.org/uml2/5.0.0/UML">
<elementTypeConfigurations xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" xmi:id="org.example.sampleProfile.SampleSystem" identifier="org.example.sampleProfile.SampleSystem" name="SampleSystem" hint="UML::Class" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
<iconEntry xmi:type="elementtypesconfigurations:IconEntry" xmi:id="_UTWX8iCaEemeGsPzIEbgXQ" iconPath="/icons/full/obj16/Class.gif" bundleId="org.eclipse.uml2.uml.edit"/>
<matcherConfiguration xmi:type="stereotypematcher:StereotypeApplicationMatcherConfiguration" xmi:id="_UTWX8yCaEemeGsPzIEbgXQ" profileUri="http://org.example.profile/SampleProfile">
<stereotypesQualifiedNames>SampleProfile::SampleSystem</stereotypesQualifiedNames>
</matcherConfiguration>
<specializedTypes xmi:type="elementtypesconfigurations:MetamodelTypeConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations#org.eclipse.papyrus.uml.Class"/>
</elementTypeConfigurations>
<elementTypeConfigurations xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" xmi:id="_hxW3gCGSEemwT888A0Ae8Q" identifier="org.example.sampleProfile.SampleSystem.shape" name="Sample System Shape" hint="Class_Shape" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
<specializedTypes xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" href="platform:/plugin/org.example.architecture/resources/sampleprofile.elementtypesconfigurations#org.example.sampleProfile.SampleSystem"/>
<specializedTypes xmi:type="elementtypesconfigurations:SpecializationTypeConfiguration" href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/umldi.elementtypesconfigurations#org.eclipse.papyrus.umldi.Class_Shape"/>
</elementTypeConfigurations>
<adviceBindingsConfigurations xmi:type="applystereotypeadvice:ApplyStereotypeAdviceConfiguration" xmi:id="_UTWX9CCaEemeGsPzIEbgXQ" description="Apply Stereotype SampleSystem" identifier="org.example.sampleProfile.sampleSystem" target="org.example.sampleProfile.SampleSystem">
<stereotypesToApply xmi:type="applystereotypeadvice:StereotypeToApply" xmi:id="_UTWX9SCaEemeGsPzIEbgXQ" stereotypeQualifiedName="SampleProfile::SampleSystem" updateName="true">
<requiredProfiles>SampleProfile</requiredProfiles>
</stereotypesToApply>
</adviceBindingsConfigurations>
</elementtypesconfigurations:ElementTypeSetConfiguration>
Cheers!
Will
Research Associate
Department of Computer Science
University of York
|
|
|
Re: Importing UML profile in an Architecture model [message #1801801 is a reply to message #1801784] |
Sun, 27 January 2019 06:42 |
|
Hi,
OK I have fixed my example with stereotypes that extend UML::Association - the semantic element to extend turns out to be UML::AssociationBase (used UML::Association before and did not work).
Thanks very much Nicolas for your kind help. Much appreciated!
Cheers,
Will
Research Associate
Department of Computer Science
University of York
|
|
| |
Re: Importing UML profile in an Architecture model [message #1801805 is a reply to message #1801803] |
Sun, 27 January 2019 13:51 |
|
Hi,
The following elementtypesconfigurations is used (same as you found from Google)
platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations#org.eclipse.papyrus.uml.AssociationBase
I would assume that Papyrus uses somewhat wrapping mechanisms for semantic elements, and then relate to UML semantic elements at runtime.
Need clarifications though, hopefully Nicolas would help answer this question.
Cheers!
Will
Research Associate
Department of Computer Science
University of York
|
|
| | |
Re: Importing UML profile in an Architecture model [message #1804547 is a reply to message #1804546] |
Thu, 28 March 2019 15:39 |
Nicholas Pacini Messages: 24 Registered: June 2014 |
Junior Member |
|
|
Hello Simon,
I've made a bit of progress about this work, but I've not fully solved it.
Currently I'm looking at the available SysML palettes and I'm trying to replicate the same Element Types configuration for my Stereotypes (when applicable).
Of course this method has some shortcomings, for instance I'm not able to create elements with a Stereotype that extends UML::Constraint, because there is no SysML Stereotype that extends it!
I can share the (updated) sample profile and architecture which consists of:
org.example.architecture - which contains the architecture, the elementtypes definitions and the palette definition
org.example.profile - which is the static profile that defines the sample stereotypes.
In particular, regarding the palette definition, I have defined four ToolConfiguration to create as many stereotyped elements . The one that extends Constraint (Criticality Level) is not working, the other three seem fine.
I hope it can be of help...
...and maybe you or someone else will find the solution!
Regards,
Nicholas
|
|
| | | | |
Re: Importing UML profile in an Architecture model [message #1804562 is a reply to message #1804557] |
Thu, 28 March 2019 18:01 |
Simon Kuzin Messages: 18 Registered: February 2019 Location: Singapore |
Junior Member |
|
|
Thanks Nicholas,
I've made your workspace working this way. You really made my day :)
I was trying to make a "quick and dirty" prototype, without packaging the typedefs into a plugin. Obviously it doesn't work this way.
Thanks for pointing me to to the palette topic. Yep it's my case as well. Final goal of my exercises is to migrate Archimate DSML to Photon.
Without palette migration tool i would have to re-define tools for all 56 language elements manually.
[Updated on: Thu, 28 March 2019 18:01] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Tue Sep 24 06:13:19 GMT 2024
Powered by FUDForum. Page generated in 0.11191 seconds
|