Uml Class Diagram Metamodel Inheritance

Meta-Model Mechanism

The UML is based on the four-level meta-modeling architecture. Each successive level is labeled from M3 to M0 and are usually named meta-metamodel, metamodel, class diagram, and object diagram respectively. A diagram at the Mi level is an instance of a diagram at the Mi+1 level. Therefore, an object diagram (an M0-level diagram) is an instance of some class diagram (an M1-level diagram), and this class diagram is an instance of a metamodel (an M2-level diagram). The M3-level diagram is used to define the structure of a metamodel, and the Meta Object Facility (MOF) belongs to this level. The UML metamodel belongs to the M2-level.

four-level metamodel architecture

We define model instantiation checking to be the process in which an Mi-level diagram is checked to see if it is a correct instance of the corresponding Mi+1-level diagram that we claim it is an instance of. We have developed a tool that can check a user-defined model against a UML metamodel and also an object diagram against a user-defined class diagram. We label the Mi-level diagram as the instance diagram and the Mi+1-level diagram as the specification diagram.

We have developed a tool that translates a UML model (consisting of the specification diagram, OCL constraints, and the instance diagram) into an executable specification in order to perform model instantiation checking. The tool checks a user-defined model against a UML metamodel by converting the user-defined model into an object diagram based on the metamodel and checking to see if it is a valid object diagram with respect to the metamodel. The tool also checks an object diagram against a user-defined model. Model instantiation checking is done by checking graphical and OCL constraints provided in the specification class diagram to ensure that the instance diagram is valid.

The tool converts UML models into Abstract State Machines (ASMs), which was first presented by Dr Yuri Gurevich more than ten years ago. An Abstract State Machine is a state machine that computes a set of updates of its own variables by firing all possible updates based on the current state. The computation of a set of updates occurs at the same time and results in the generation of a new state. ASMs can be formally defined and can be used to define precise models of software.

We use the high-level language AsmL, which is an executable specification language based on the concept of abstract state machines that is developed by the Foundations of Software Engineering (FSE) group at Microsoft Research. It is a high-level specification language running on Microsoft's .NET framework and has language constructs such as sets and sequences and high-level operations that let the programmer specify what the program should do but not how it should be done. AsmL is also object-oriented so it is easy to translate UML classes and their features into AsmL.

Tool Architecture

tool architecture

The tool consists of four major modules:

  1. a UML specification diagram parser
  2. a UML instance diagram parser
  3. an OCL parser
  4. a library of OCL operations written in AsmL

The specification diagram parser module takes as input a UML specification diagram from a UML model that is given in an Extensible Markup Language (XML) file that is written in the XML Metadata Interchange (XMI) format. XMI is a widely used interchange format for sharing objects using XML and is developed by the OMG. The XML file containing the UML model should be valid based on a Data Type Definition (DTD) for UML 1.3, which was released by the OMG. The OCL parser extracts OCL constraints in the specification diagram and translates them into AsmL code that call OCL operations in the library of OCL operations written in AsmL. The UML instance diagram parser module reads a UML instance diagram from the same file containing the UML model.

Once read in, each parser module will extract portions of the model that it is responsible for and converts that part into an AsmL specification. The combined AsmL specification from each of the three modules will then be passed to the external AsmL compiler together with the fourth module, which is a library for OCL operations that is written in AsmL. These items are compiled and the resulting executable file can be run to perform constraint checking on the UML model. The compiled AsmL program will display model checking results to the user. The model checking tool also performs a few other consistency checks after reading in the UML model but prior to generating the AsmL specification.

UML Model Notation

  • In order to make the separation between the specification and instance diagrams within the same UML model, the input UML model has two top-level packages - one for the specification diagram and one for the instance diagram. We use a dependency relation between two top-level packages to denote the specification and the instance package respectively. The supplier of the dependency relation is the specification package while the client of the dependency is the instance package. In the figure below, the Profile package is the specification diagram package while the Instance package is the instance diagram package.

    top-level package notation

    There can be multiple top-level packages but there can only be one dependency relation among them. This notation allows developers to validate different instance diagrams against a single specification diagrams (such as multiple class diagrams against a UML profile) and also allows an instance diagram to be validated against different specification diagrams.
  • Slot values for objects in an instance diagram are provided in the documentation fields of the element in Rational Rose. However, the Rational Rose XMI export add-in does not export documentation fields in some elements such as relations, so we place slot values in Comment tags linked to the element. Tagged values for stereotyped elements are treated the same way as slot values and use the same format and keywords shown below.

    slot values in documentation fields
    slot values in documentation fields
    slot values in comment tags
    slot values in comment tags

    The format of slot values tagged values is shown below. The semicolon is optional and only needed if there are multiple slot values.

    BeginSlot slotName = slotValue; slotName2 = slotValue2 EndSlot
  • The UML uses stereotypes as a lightweight extension mechanism to allow developers to define domain-specific model elements. A stereotype in a UML profile is designated with a normal class notation with the stereotype <<stereotype>>. To indicate the base class that the stereotype extends, we use a dependency relation (also denoted with <<stereotype>>) connecting the stereotype (for example, MyClass) with its base class (for example, the meta-class Class). Tag definitions for the stereotype are represented as attributes in the class notation (not shown in the figure below).

    stereotypes and subset associations
    stereotypes and subset associations


  • The figure above also shows the notation used to denote a subset association. We use the subset notation to disambiguate between multiple associations between the same two classes or their supertypes. In the figure above, the stereotypes MyClass and MyAttr inherit two associations from their supertypes, namely the association between Classifier and Feature and the association between Classifier and StructuralFeature. We add the association end constraint "subsets ..." to each association end in the subset association to specify which of the inherited associations is the superset association.
  • Another important notation used in a specification class diagram is the representation of a enumeration. The figure below shows the definition of two enumerations, ScopeKind and VisibilityKind, in the UML metamodel. As with stereotypes, we use a class notation to define the enumeration but this time the class has the stereotype <<enumeration>>. Enumeration literals are denoted with class attributes that do not have a corresponding attribute type. The visibility of the attributes do not matter in this case.

    enumerations
    enumerations


Source: https://cs.wmich.edu/~ooda/metamodel.html

Posted by: terrianantoniettaees.blogspot.com

Posting Komentar

Lebih baru Lebih lama