How to Define Custom Model Element Properties?
Unified Modeling Language (UML) is a visual modeling language invented primarily for the analysis, design and implementation of software-based systems as well as for modeling processes. UML is well-defined, providing a rich notation set that makes the language applicable to different types of systems, domains and processes. However, as a general-purpose modeling language UML may not cater adequately to specific problem domain. The introduction of UML extension mechanisms was aimed to tackle this problem.
The UML extension mechanisms enable you to customize and extend the UML semantics, making the language more suitable for specific problem domains. You can create new model element types by creating stereotypes, which derive from existing UML types. You can add and define domain-specific properties for both new and existing UML types using tags. The values of tags are known as tagged values.
Visual Paradigm supports profiles, stereotypes, and tagged values. The focus of this tutorial will be on tagged values. You will see how to add and define tags to a UML model element type, ready to be used by the modeler. You will also see how to enter the values during modeling and how to visualize the tagged values on the diagram. We will draw a UML activity diagram for an order processing system to demonstrate the use of default tagged values.
Defining Default Tagged Values
- Create a new project by selecting Project > New from the application toolbar. In the New Project window, enter Order Processing as the project name and click Create Blank Project.
- Select Window > Configuration > Configure Default Tagged Values... from the application toolbar. This shows the Configure Default Tagged Values window.
- The left-hand side lists the notations defined natively by UML, BPMN, and other modeling languages supported by Visual Paradigm. You can add your own properties to a supported type of notation by selecting the type and adding the default tagged values. Let's try with a UML action. At the top left corner of the Configure Default Tagged Values window, enter Action as the search text.
- Select Action from the list.
-
Now, you can add your own properties to a UML action by adding tags. When you create actions later, you can enter the value of the tags created here. Let's say we want to associate each UML action with a Web Form. Add a tag Form-ID that acts as a reference to the corresponding Web Form. Click Add at the bottom right and select Text from the popup menu.
Besides text tags, you can add other kinds of tags, like the model element tag that allows specifying a reference to a model element as a value, and a boolean tag that allows specifying either true or false as a value, etc. - Enter Form-ID as the tag name.
- Let's say our ID has FRM- as a prefix. We can specify it as the default value of the tag so that when you create actions, you do not need to enter FRM- repeatedly.
- Click OK to confirm the changes.
Entering Tagged Values
Create an activity with actions. Enter the form ID for each of the created actions.
- Create an activity diagram Order Processing.
- Draw a diagram that looks like this:
- Supply the form ID associated with each action. Let's do this one by one. Right-click on the Login action and select Open Specification... from the popup menu.
- Open the Tagged Values page.
- Enter the form ID for the Login action: FRM-01.
- Click OK to confirm.
-
Set the form ID for the remaining actions:
Action Form ID Create Order FRM-02 Enter Payment Details FRM-02 Confirm Order FRM-03
Showing Tagged Values on the Diagram
You can optionally show the tagged values on the action shapes in the diagram. Right-click on the diagram background and select Presentation Options > Show Tagged Values > Show All from the popup menu. Resize the shape. The diagram should look like this: