« Back to Scenario Collection

Implementing a Modeling Language

Combination View Flat View Tree View
Threads [ Previous | Next ]
Implementing a Modeling Language
class relation training content scenario handson introduction modelling language documentation development approach
Answer
4/11/14 10:46 AM
This scenario illustrates the realization of a modeling language. More precisely we will build a modeling tool for the modeling language Entity Relationship (ER) Model. It is shown how to inherit classes and relation classes from the ADOxx Meta Model and how to add/configure attributes.

The scenario consisits of two parts. Part I discusses some conceptual aspects of the implementation of a modeling language with ADOxx. In particular we show how to map the generic ADOxx Meta2Model to a concrete modeling language, namely the ER language. Part II provides a step-by-step hands-on guide for the realization of an ER meta model with ADOxx.

(I) Conceptualization
  • Question: how to map the generic ADOxx Meta2Model to a concrete modeling language (ER modeling language)?

  • Answer: (1) consider what classes and relation classes are needed in order to represent the main constructs of a given language definition. (2) think of appropriate super classes (provided by the ADOxx Operationalizable Meta Model) for new classes. Account for the definition/configuration of (new) attributes so that your meta model describes the full syntax and semantics of the modeling language. (3) define an intuitive graphical notation for the classes and relation classes in order to simplify the modeling.
The following figure illustrates the above mentioned considerations:



In the following we depict the way starting from the ADOxx Meta2Model to the ADOxx Operationalizable Meta Model (which provides e.g. several different super classes with predefined attributes) to the concrete Meta Model representing the ER modeling language:



(II) Hands-On


1) Define model type:


  • Select ADOxx 1.3 Dynamic Experimentation Library.
  • Click Library attributes...
  • Go to Add-on chapter.
  • Define the model type in the Modi text field, enter:
1MODELTYPE “ER-Diagram”

2) Create a new (abstract) class, inherited from __D-construct__:


  • Select ADOxx 1.3 Dynamic Experimentation Library.
  • Click Class hierachy...
  • Click View and select Metamodel and Class hierachy.
  • Select super class __D-construct__.
  • Click New --> New class...
  • Name new class _ER-construct_ (here we apply the name convention for abstract classes: class name starts and ends with an underscore sign)
3) Make the class _ER-construct_ abstract (effect: class can not be instantiated in the Modelling Toolkit):


  • Unfold the class _ER-Construct_ in order to see all its attributes.
  • Double click the attribute ClassAbstract and check ClassAbstract.
4) Create new classes named Entity and Relation, inhereted from _ER-construct_
  • runs analogously to step 2)
5) Create new class named Attribute, inhereted from __D-construct__
  • runs analogously to step 2)
6) Configure GraphRep of Class Entity:


  • Unfold class Entity
  • Double click attribute GraphRep (Metamodel)
  • Click Dialog button
  • Enter the following LEO code:
1GRAPHREP
2PEN w:0.05cm
3RECTANGLE x:-2cm y:-.5cm w:4cm h:1cm
4ATTR "Name" x:0cm y:0cm w:c:3.5cm h:c:1cm line-break:rigorous
  • Click View in order to view the GraphRep
  • Click Apply
7) Configure GraphRep of Class Relation:
  • runs analogously to step 6), use the following LEO code:
1GRAPHREP
2PEN w:0.05cm
3FILL color:white
4POLYGON 4 x1:-1.9cm y2:1.6cm x3:1.9cm y4:-1.6cm
5ATTR "Name" w:c:2.5cm h:c:0.8cm line-break:rigorous

8) Configure GraphRep of Class Attribute:
  • runs analogously to step 6), use the following LEO code:
 1GRAPHREP
 2PEN w:0.05cm
 3ELLIPSE x:0.00cm y:0.00cm rx:3.00cm ry:0.80cm
 4ATTR "Name" y:-0.2cm w:c:2.8cm h:t
 5# Advanced Attribute Dependent Graphical Notation
 6AVAL k:"key"
 7IF ( k = "1")
 8{
 9  LINE x1:-1.7cm y1:-0.5cm x2:-1.7cm y2:0.5cm
10  LINE x1:-1.5cm y1:-0.6cm x2:-1.5cm y2:0.6cm
11}

Note that the GraphRep of class Attribute depends on the value of the attribute key; we add this attribute to class Attribute in the next step.

9) Add new attribute (Integer) to class Attribute:


  • Select class Attribute
  • Click New --> New attribute...
  • Enter attribute name: key
  • Select type: Integer
10) Add new attribute (Enumeration) to class Attribute


  • Similar to step 8): attribute name: datatype, type: Enumeration
  • Add the items String, Integer, Float to the value range and apply
11) Configure AttrRep (Metamodel) attribute of class Attribute
  • Double click AttrRep (Metamodel)
  • Set Standard value:
1NOTEBOOK
2CHAPTER "Description"
3ATTR "Name"
4ATTR "key" ctrltype:check
5ATTR "datatype" ctrltype:dropdown

12) Incude classes to model type ER-Diagram


  • Go to the Modi attribute in the Library attributes (c.f. step 1) )
  • Add the following lines in order to include the classes Entity, Relation, Attribute in the model type ER-Diagram:
1INCL "Entity"
2INCL "Relation"
3INCL "Attribute"

13) Create relation class "has"


  • Select ADOxx 1.3 Dynamic Experimentation Library.
  • Click Class hierachy...
  • Double click folder Relation classes
  • Click New --> New relationclass...
  • Enter name: has, from-class: _ER-construct_, to-class: Attribute
  • Include relation class has to model type ER-Diagram:
1INCL "has"

14) Configure GraphRep of relation class "has"
  • Use the following LEO code:
1GRAPHREP
2EDGE
3START
4FILL color:black
5ELLIPSE x:-.1cm y:0cm rx:.1cm ry:.1cm


15) Create relation class "relates"
  • Runs analogously to step 13)
  • name: relates, from-class: Entity, to-class: Relation
Result: