TU Wien:Model Engineering VU (Kappel)/Test 1 - 2020-11-16

Aus VoWi
Zur Navigation springen Zur Suche springen

Metamodeling[Bearbeiten | Quelltext bearbeiten]

Select the correct statements:

  • During the modeling phase the technologies used for the implementation are defined.
  • PIM models can specify functionalities defined in PSM models in more detail.
  • A business process is an example for a computation independent model.
  • UML is an example for a General Purpose (Modeling) Language.
  • In Model-Driven Software Engineering models are just pictures.
  • Changes in technology stacks do not always require changes in the domain models.
  • In Model-Driven Engineering models are primarily used for communication of ideas and alternatives.
  • A model is based on an original (= System), but it only reflects a selection of the original's properties.

To which of the 4 Metamodeling Layers does EBNF belong to?

  • M0 (Model instance)
  • M1 (Model)
  • M2 (Metamodel)
  • M3 (Meta-Metamodel)

To which of the 4 Metamodeling Layers does a SQL Statement belong to?

  • M0 (Model instance)
  • M1 (Model)
  • M2 (Metamodel)
  • M3 (Meta-Metamodel)

Which of the following statements about metamodeling in EMF are true?

  • Metamodels are models conforming to higher level metamodels. Those higher level descriptions are called meta-metamodels.
  • If an Ecore metaclass A defines a containment reference to the metaclass B, it means that an instance of metaclass A is a part of at least one instance of metaclass B.
  • Classes and relations are not a part of Ecore metamodels
  • Upon changes in the metamodel, already existing models might become invalid.
  • Meta-metamodels are mostly self-descriptive which means they conform to themselves.
  • A model by definition conforms to multiple metamodels.
  • The validity of a model can only be determined in combination with a metamodel.
  • Theoretically, the concept of meta-hierarchies is not limited to four layers.

Define a metmodel with the adapted OCL syntax for the following description: A company has multiple containers and one or more vehicles. A Container always has a capacity. A vehicle can either be a truck or a van, but each vehicle has an id, which is the same as the number plate of the vehicle. A truck can transport a container of the company but it can also drive alone. A van can either be rented, leased or bought. Use the adapted OCL syntax to describe your metamodel. Example (model in graphical syntax was also given):

class A {
 property elements: B[*] {containment};
 property main: C[0|1];
}
abstract class B {
 attribute name: EString[1];
}
class C extends B;
class D extends B {
  attribute type: E[1];
}
enum E {X, Y}

Simplified Truck-Metamodel from above was given. What name should the method have such that the scoping for the transported containers of a truck only shows containers of the same company? Java code snippet within a DeclarativeScopeProvider:

public IScope ???(Truck truck, EReference eReference) {
  Company company = (Company) truck.eContainer();
  return Scopes.scopeFor(company.containers());
}
  • scope_Truck_Container_transports
  • scope_Container_Truck
  • scope_Truck_Container
  • scope_Truck_transports
  • scope_transports_Truck
  • scope_Truck_transports_Container

OCL[Bearbeiten | Quelltext bearbeiten]

Select the correct statements about OCL

  • OCL is often used to define invariants on metamodel level
  • OCL invariants are expressions that can return boolean values as integer values
  • OCL is often used to set attribute values in models
  • OCL is often used to define invariants on meta-metamodel level
  • OCL constraints are defined on metamodel level and evaluated on model level
  • OCL is ofted used as a query language

Model and OCL constraint was given. What is the result?


Textual ML[Bearbeiten | Quelltext bearbeiten]

Which of the following statements about Xtext are correct?

  • In a grammar-first approach, the metamodel can be generated from the grammar definition.
  • With Xtext semantics can be added to domain-specific languages.
  • The Java syntax could theoretically be defined with an Xtext grammar.
  • The Xtext grammar uses EBNF.
  • Scoping has to be implemented for every cross-reference in a Xtext grammar.
  • Scoping enables the definition of the attribute visibility in a Xtext grammar.

Consider the following Xtext grammar:

Company returns Company:
 'company' name=EString '{'
 (containers+=Container)*
 (trucks+=Truck=+
 '}'
;
Container returns Container:
 'container' name=EString
;
Truck returns Truck:
 (ParkedTruck|TransportingTruck)
;
ParkedTruck returns Truck:
 'parked' 'truck' name=EString
;
TransportingTruck returns Truck:
'truck' 'transports' transports=[Container]

Select the models conforming to this grammar:

company Comp1 {
 container C1 
 container C2 
 truck T2 transports C2
 truck T3
}
company Comp1 {
 container C1 
 truck T1 transports C1
 parked truck T2
}
company Comp1 {
 parked truck T1
}
company Comp1 {
 container C1
 truck T1 transports C2
 parked truck T2
}

Graphical ML[Bearbeiten | Quelltext bearbeiten]

Select the correct statements about Sirius and Graphical Concrete Syntaxes:

  • The Sirius Creation Tools enable the creation of mappings between abstract syntax and their graphical representation.
  • Every class of a metamodel has to be covered by ate least one Sirius representation viewpoint.
  • If multiple conditional styles match to an element, all styles will be applied.
  • A viewpoint can only contain a single representation description
  • Sirius provides a default representation for undefined class mappings.
  • In an annotation based approach the metamodels are annotated within the Ecore file.
  • One abstract syntax of modeling language can be realized by multiple concrete syntaxes.
  • References can be represented as edges as well as labels.
  • The sirius runtime automatically and dynamically interprets the model and adjusts the graphical representation.

Consider a metamodel. Extend the already defined Sirius specification to achieve a person representation like in the person diagram below (child-parent different collors and borders)