Creating an ECore project

Follow the TP2 instructions step by step until step 4

Step 4: Generating Class Diagram

After carefully following the previous 3 steps mentioned in TP2, now we're ready to generate class diagram

1

Right click on FiniteStateMachine.ecore then click on "Initialize Ecore Diagram..."

2

Select the first option then click "Next>"

3

Select FSMPackage and give your diagram a proper name then click "Finish"

4

Double click on the frame and wait until the class diagram shows up

Step 5: Advanced model configurations

Step 5.1: Defining constraints

circle-exclamation
1

Add new EAnnotation child

add the first EAnnotation child and select the "EAnnotation - http://www.eclipse.org/emf/2002/ECore" variation

2

Configuring constraint value

then click on it and this dialog window will appear:

write "SingleInitialState" to Value field then click Add button, then it will appear in Feature section

click OK button.

3

Add another EAnnotation child to Automaton class

this time we will select the "EAnnotation - http://www.eclipse.org/emf/2002/ECore/OCL" variation

4

Configuring the new EAnnotation

The new annotation will appear under Automaton class with name "OCL".

Now you have to right-click on it, then add new child "Details Entry"

In properties view, set the following values:

Property
Value

Key

SingleInitial

Value

self.states->select(isInitial)->size() <= 1

Finally it should appear like this:

Step 5.2: Data configuration

in the TP2 instructions it was mentioned:

NamedElement :

- name: EString (required=true)

State:

- isInitial: EBoolean (defaultValue=false)

- isFinal: EBoolean (defaultValue=false)

Transition:

-garde: EString (required=true)

Event:

- code: EString (required=true, unique=true)

However these are not real available options, it's only few rules to configure data which translates to:

Mentioned option
Equivalent in EMF - Properties view

required = true

Lower Bound = 1

defaultValue = false

Default Value Literal = false

unique = true

unique = true

.

Last updated