class-diagramemfeclipse-emfeclipse-emf-ecoreecore

Model composition where instance of class is used multiple times


I want to model the following scenario:


Example:

Message position

Message movement


This is what i modeled in Sirius so far Sirius model

The issue here is that I cannot link the message position twice to the message movement. Can you please provide a approach of modelling this problem?


Solution

  • Your modelization is lacking one "layer" to represent your "message type" / "message instance" structure.

    I think what you need to do is something a bit like this:

    Then you end user must first create a MessageType instance, called "position" and a second one called "movement". Then create three MessageInstance instances, two pointing towards MessageType "movement" and one containing the first two MessageInstance instances.

    I would also advise seriously thinking about how you want to name your concepts, because there is a potential confusion between an Ecore instance of one of your EClass and the fact that you are effectively modeling a type/instance structure.