Create class diagram

Class diagram

Create Magik Exemplars

Step 1

At first you need to expand class folder from palette. Palette contains Magik UML elements like exemplars, slots etc. which can be dropped into the editor area.

Step 2

Select and put into the editor area a new mixin exemplar (Class > mixin). This will create a new UML class with mixin stereotype.

Get mixin from palette

Step 3

Change exemplar name to point. (Use one mouse click, F2 shortcut or Properties view > General > Name).

Change name

Step 4

We can change exemplar types by switching to other dedicated stereotypes. To change element stereotype:

  1. Select mixin in diagram and goto Properties view > Profile.

    select profile in properties

  2. Click on Add button In the pop-up dialog remove mixin and add slotted stereotype. This action changes element type from mixin to slotted exemplar.

    add stereotype dialog

Step 5

Stereotypes contain specific properties used in code generation. In this case we edit pragma for slotted exemplar. To do this expand the tree from profile stereotype.

Step 6

Change classify level by double selecting present value and choosing restricted value in dialog.

edit classify level

Step 7

Change topic name to modeling. To assign a string value to property use Add button button.

Magik Properties (Slot, Shared Variable, Shared Constant and Enum element)

Magik Properties are available directly in palette or by manually applying other stereotype for selected property. In this tutorial we will create two slots.

Step 1

Goto the palette, expand Property folder and select slot element.

slot

Step 2

Drop slot element in point mixin

drop slot

Step 3

Change name of this slot to x

Step 4

Create second slot repeating previous steps.

Step 5

Change name of this slot to y

point mixin

Step 6

Now we will add comments for new slots. Goto Documentation view.

Step 7

Select x and write comment: x coordinate

Step 8

Select y and write comment: y coordinate

add comment

Step 9

We can quickly manage our slots generation in Properties view > Profile by expanding stereotype tree and editing property values.

slot options

Magik Operations

Step 1

Goto palette, expand Operation folder and select method.

Step 2

Drop method into point exemplar and rename it to change_location

method

Step 3

Select method in diagram and goto Properties view > General > OwnedPanameter

Step 4

Click on Add button

Step 5

Select UML tab

Step 6

Type x_coordinate for parameter name and press OK.

panameter

Step 7

Create second parameter with y_coordinate as name.

Step 8

Select method and goto Documentation view.

Step 9

Type Changes coordinates to location specified by x_coordinate and y_coordinate as a comment.

Related tasks

Code generation
Create new model
First steps