# SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

### Sidebar

• Tips and Tricks
• Internal

# Assignment 08: Model Driven Engineering - Layers, Profiles

Release date: Monday, 09.12.13 - Due date: Sunday, 15.12.13, 23:59

## Task 39: Warm-Up for Meta-Models

8=4+4 Points

a) Describe in your own words, with at least a sentence for each, the meta levels M0, M1, M2 and M3. If it helps you in your explanation, you can also give a concrete example (another than the one in b)) and explain it.

b) This lecture is named “Advanced Topics in Software Construction 2013” and has the identification number “13ws-12475” (or “MA-INF 3212” if you are a Computer Science student). Use this information as starting point (M0) and derive M1 from it with the help of a UML class diagram. After you have created M1, how do M2 and M3 look like?

## Task 40: Meta Model for Transportation Diagrams

16=2+3+2+2+2+2+3 Points

[Taken with minor modifications from the exam 2012.]

As a starting point we placed the file `A08_T40-T41_Models` in your repository.
 Figure 1: The voyage of five barrels of single malt Figure 2: Transportation Diagram showing the same voyage whiskey from Edinburgh to its twin city Munich  Some domains have their own graphical modeling languages. The MOF-approach allows us to implement these modeling languages. This task gives an example. You will have to fill in some gaps.

The transport of goods e.g. from Edinburgh in Scotland to Munich in Germany (Figure 1) can be visualized in a Transportation Diagram (Figure 2). Such a diagram1) consists of one row for each vehicle and another row for the ground level, the ports. Voyages are visualized as lines within a row. These lines are connected by arrows visualizing the process of loading and unloading goods. A suggestion for the abstract syntax of Transportation Diagrams is given as a metamodel (Figure 3). An instance of this metamodel represents an instance of a Transportation Diagram (Figure 4 represents Figure 2 in abstract syntax).

Figure 2 models the transport visualized in Figure 1. Figure 4 represents the model Figure 2 and is an instance of Figure 3. Your task is to complete the figures:

a) Complete the Transportation Diagram (Figure 2) so that it models as well how the goods reach Munich from Hamburg. You can find the figure as an image in the astah file.

b) Complete the Meta Model (Figure 3) so that it represents all elements of the Transportation Diagram. You need to add two classes and add their associations with navigability, multiplicities (if not “1..1”) and maybe composition ends.

 Figure 3: Metamodel of Transportation Diagrams Figure 4: The Transportation Diagram instance in abstract syntax  c) To which metalevel does Figure 2 belong? Why?

d) To which metalevel does Figure 3 belong? Why?

e) To which metalevel does the Meta-Object Facility (MOF) belong? How does Figure 3 relate to the MOF?

f) Complete the representation of the Transportation Diagram in abstract syntax (Figure 4). You need to add two instance specifications with their attribute values and all their links.

g) Why did we work with MOF here and did not just create a UML profile? What are the advantages/disadvantages of the MOF-based approach?

## Task 41: UML Profile for Use Case Slices

14[+2] = 5+2+3+2+2[+2] Points

[Taken with minor modifications from the exam 2012.]

As a starting point we placed the file `A08_T40-T41_Models` in your repository.

a) Define a UML profile that allows to create Analysis Object Models with use case slices. For that purpose we need the stereotypes: «use case slice», «non-use case specific slice», «extend», «include», «use», «aspect». As a starting point you find some of the metaclasses of the UML.

Don't let the complex model below scare you. If you know how profiles are defined, the task is straightforward!

 Excerpt of the UML Meta-Model b) To which metalevel does the profile belong? Why?

c) UML Profiles vs. MOF-based meta-models: What are the general advantages/disadvantages of UML profiles compared to Ecore/MOF-based meta-models?

d) Explain how one can see in the class diagram you created, that we may draw a class within an «aspect»?

e) Explain how one can see in the class diagram above, that «extend» may connect e.g. «use case slice»?

f) (optional) Describe in OCL the condition, that dependencies with the stereotype «extend» may only connect packages with the stereotype «use case slice» or «non-use case specific slice».2)

## Task 42: Regular Expressions (optional)

[6=2+3+1 Points]

In the lecture we suggested that there is an analogy between the meta levels of UML and meta levels for regular expressions.

Given the following grammar for regular expressions in Backus-Naur Form:

`<RE> ::= <Terminal> | <RE><RE> | <RE>"|"<RE> | <RE>"*" | "("<RE>")"`

a.) What is the corresponding level for this grammar? Explain your decision.

b.) Are there levels above and below? Name them all and give for each an example.

c.) In UML the top level conforms to itself, what is the equivalent for the Backus-Naur Form?

1)
We invented this specification based on the example in “Domain Driven Design”.
2)
This questions is really a challenge and probably much more work than the rest of this task. Here are some pieces: Figure 18.4 in the UML Superstructure tells you how to navigate between an instance of a stereotype and the instance of the extended metaclass. At the bottom of page 19 of the OCL standard, you find a useful way to work with optional (multiplicity 0..1) associations. oclIsKindOf(..) described in Section 7.6.9 of the OCL standard is probably helpful as well. 