Vlad Varnica - Omondo - June 2009
Modified on June 10th, 2009

How to create association ends profile

I was reading Gilbert post at: http://www.eclipse.org/newsportal/article.php?id=3388&group=eclipse.modeling.mdt.uml2#3388
It seems to me that the Association Ends meta class support inside UML 2 should be explained in a different manner which would be more UML modeling oriented. This powerful new concept needs more documentation for UML users focusing on traditional object modeling and certainly not more EMF plumbing tricks.
Kenn Hussey replied on June 9th, 2009:
Your article mentions that there's no way to tell whether a property is being used as an association end, but in fact there is - a property which has a value for Property::association is effectively an assocation end. Using a keyword or stereotype to indicate this seems wasteful, especially given that an application based on UML2 can offer built-in ways to indicate this information without adding redundant semantic information.

In this article we will describe:
  1. Association ends meta class uses inside UML 2
  2. How to add a keyword
  3. How to add a stereotype

1. Association ends meta class uses inside UML 2

We should not forget that in the new UML 2.2 specification Association meta class has been replaced by Property which contains the association information. Changed on June  10 th . Please note it is not possible in UML 2 to have a differentiation between property and property related to the use of Association Ends meta class with UML profiles or icons (e.g. UML 1.x). We have therefore added a graphical information in order to be able to differentiate them by using a little arrow below the attribute icon .

If for example you create an association between two classes and click on the Property inside your diagram then you will see
the Association ends property displayed as UML Superstructure model element. Association ends support as Property is natively possible because Ecore complexity is hidden and therefore no need for EMF serialization. I mean no EMF model which requires transformation with the use of OCL because Omondo is directly using MOF with Ecore and hide all the complexity.

You have the association ends information available in:




After identifying the Association ends meta class in the UML 2 specification as a property it is important to decide which way to use in order to extend this meta class. we therefore need to select to add either a keyword or a stereotype.

We need to define which level of customization we are going to use. We can either use the Omondo profile mechanism which would add this stereotype property to extended meta classes inside a modeling project or use the Keyword option which would add this information to only the selected model element.
Please note that inside the XMI of the UML metamodel the data is saved the same way for both stereotypes and keywords. It means that the stereotype mechanism using profile is just internal mechanism related to the project properties and not a model differentiation or a modeling specification. I am therefore confused and don't know what to recommend. It is important to keep it as simple as possible and to use stereotype with profiles or to select Keyword option.

2. How to add keyword

To add keywords on an attribute element just click on the attribute > Property

Enter keyword in the Keywords field and click on the Ok button



The Keyword is immediately displayed graphically inside your diagram.
The keyword is only related to this attribute.

3. How to add a stereotype

The stereotype use is defined inside a Profile by the OMG specification. We therefore need to create a profile which will includes stereotypes and should not hard code stereotype directly inside the model. btw, users can do as they want but....
The stereotype mechanism is working at project level. It means that a UML element which meta class has been extended will own a specific stereotype property.
For more information on the Profile concept please read my previous article at: http://www.tutorial-omondo.com/profileIntro/index.html

We will only describe below how to add a stereotype on an association ends. Changed on June 10th. The stereotype name "Association ends stereotype" is only an example how to add a stereotype on an association ends and certainly not the need to add a keyword or a stereotype on a property in order to make a differenciation between properties and association ends properties. There is no modeling need to add this information because if you look inside the XMI Editor, in the property view or in the UML diagram (e.g. association ends icon) then you can see the difference.
There are three important step which should be done one after the other:
  1. Create a profile diagram
  2. Add this profile mechanism property to your project
  3. Display the stereotype inside your diagrams
1. Create a profile diagram

To create a profile you first need to create a profile diagram which will hide all complexity in order to be focused on profile definition and not on transformation plumbing.
Click on the src > New UML Diagram > UML Profile Diagram



We need to add a Meta Class inside your profile diagram.
Click on the diagram background > Import Meta Classes



We now need to select the association ends which is represented by a Property in UML 2.
Select Property and click on the Ok button



We now need to create a stereotype and give a name.
Click on the Create a Stereotype toolbar icon and drop it to the Profile Diagram


Enter the name of your stereotype in the Name field and click on the Ok button



Extend your Association End meta class using the Create an extension icon in the toolbar.



Drop the extension link from the stereotype to the meta class.



The profile has been successfully created inside the package explorer.


2.Add this profile mechanism property to your project

We need to add this profile mechanism to the project property.
Click on the project > Properties



Select UML Profiles and click on the add button.



Select your newly created diagram and click on the Ok button.



Once the Ok button has been released then your project includes now this profile mechanism.


3. Display the stereotype inside your diagrams

To display your stereotype inside your diagram you need to create a new diagram and then add this stereotype onto your UML element.
Create a Class Diagram by adding a package named "profile" then click on the package > New UML Diagram > UML Class Diagram



Create two classes using the Create a Class icon in the Class Diagram toolbar.



Add an association link between the two newly created classes by selecting the association icon in the class diagram toolbar



Enter the association property. We have decided to have on both side 1 as multiplicity and not to generate accessors.



Here is the diagram showing the association and the Association ends display as properties.
Please note that you have a different icon between Properties coming from Association ends or standard property (e.g attribute)



We now need to display the stereotype information onto the attribute inside the class diagram.
Click on the Attribute > Properties



Add a new stereotype and click on the Ok button



Select the newly created stereotype from the list. Usually newly created stereotype are at the button of the list :-)



The new stereotype is now displayed inside the class diagram.



The stereotype mechanism is the same for any diagram or meta class.