<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Experimenting with Multi-Level Models in a Two-Level Modeling Tool</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Martin Gogolla</string-name>
          <email>gogolla@informatik.uni-bremen.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Database Systems Group, University of Bremen</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper discusses two ways to establish the connection between two levels in a multi-level model. The first approach uses normal associations and generalizations under the assumption that the multi levels are represented in one UML and OCL model. The second approach views a middle level model both as a type model and as an instance model and introduces operations to navigate between the type and instance level. The paper reports on some experiments that have been carried out.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Metamodeling has become a major topic in software engineering research [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7,
16</xref>
        ]. There are, however, a lot of discussions about central notions in connection
with metamodels like potency or clabject where no final conceptual definition has
been achieved. On the other hand, software tools for metamodeling are beginning
to be developed [
        <xref ref-type="bibr" rid="ref2 ref9">9, 2</xref>
        ].
      </p>
      <p>Metamodeling is closely connected to multi-levels models because the
instantiation of a metamodel is a model. That model, when viewed as a type model, may
be instantiated again and can then be viewed as an instance model. Proceeding
this way, at least three model levels arise.</p>
      <p>This paper discusses two ways to establish the connection between two levels in
multi-level models. The first approach uses ordinary associations and
generalizations under the assumption that the multi levels are represented in one UML
and OCL model. The second approach views a middle level model both as a type
model and as an instance model and introduces operations in order to navigate
between the type and instance level. The paper reports on some experiments
that have been carried out. The first approach joins the metamodels of several
levels into one model as in our previous work [12]. Details about the first
approach can be found in [13]. The second approach has not been put forward in
a paper yet.</p>
      <p>
        Our work has links to other related or similar approaches. The tool Melanie [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
is designed as an Eclipse plug-in supporting strict multi-level metamodeling and
support for general purpose as well as domain specific languages. Another tool
is MetaDepth [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] allowing linguistic as well as ontological instantiation with
an arbitrary number of metalevels supporting the potency concept. In [16] the
authors describe an approach to flatten metalevel hierarchies and seek for a
levelagnostic metamodeling style in contrast to the OMG four-layer architecture. The
approach in [14] also transforms multi-level models into a two-level model and
focusses on constraints. Similar to our approach employing UML and OCL, the
work in [17] uses F-Logic as an implementation basis for multi-level models
including constraints. A conceptual clean foundation for multi-level modeling
is discussed in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] studies model constraints and [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] discusses multi-level
connections in presence of a multi-level architecture distinguishing between a
linguistic and an ontologic view on modeling.
      </p>
      <p>The structure of the rest of the paper is as follows. Section 2 gives a small example
for establishing the multi-level connection with associations and generalizations.
Section 3 discusses the second approach that uses operations to connect the
multi-levels. The contribution is closed with a conclusion and future work in
sect. 4.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Connecting Multi-Levels with Associations and</title>
    </sec>
    <sec id="sec-3">
      <title>Generalizations</title>
      <p>
        The first approach connects multi-levels with usual model elements: associations
and generalizations. The example in Fig. 1 shows a substantially reduced and
abstracted version of the OMG four-level metamodel architecture with modeling
levels M0, M1, M2, and M3. Roughly speaking, the figure states: Ada is a Person,
Person is a Class, and Class is a MetaClass. The figure does so by formally
building an object diagram for a precisely defined class diagram including an
OCL invariant that requires cyclefreeness when constructing instance-of
connections. The distinction between MetaClass and Class is that when MetaClass
is instantiated something is created that can be instantiated on two lower levels
whereas for Class instantiation can only be done on one lower level. The model
has been formally checked with the tool USE [
        <xref ref-type="bibr" rid="ref10 ref11">11, 10</xref>
        ]. In particular, we have
employed the features supporting UML generalization constraints as discussed
in [
        <xref ref-type="bibr" rid="ref1">1, 15</xref>
        ].
      </p>
      <p>Concepts on a respective level Mx are represented in a simplified way as a class
Mx. All classes Mx are specializations of the abstract class Thing whose objects
cover all objects in the classes Mx. On that abstract class Thing one association
Instantiation is defined that is intended to represent the instance-of
connections between a higher level object and a lower level: an object of a lower level
is intended to be an instance of an object on a higher level. The association
Instantiation on Thing (with role names instantiater and instantiated)
is employed for the definition of the associations Typing0, Typing1, and Typing2
between Mx and Mx+1 all having roles typer and typed. The role typer is a
redefinition of instantiater, and typed is a redefinition of instantiated. The
multiplicity 1 of typer narrows the multiplicity 0..1 of instantiater.</p>
      <p>Fig. 1. Ada, Person, Class, MetaClass within Single Object Diagram.
In the abstract class Thing the transitive closure instantiatedPlus() of
instantiated is defined by means of OCL. Analogously, instantiaterPlus()
is defined for instantiater. The closure operations are needed to define an
invariant in class Thing requiring Instantiation links to be acyclic.
The class diagram from the left side of Fig. 1 is made concrete with an object
diagram on the right side. The fact that the three associations Typing0, Typing1,
and Typing2 are all redefinitions of association Instantiation is reflected in
the object diagram by the three dashed links for association Instantiation
with common role names instantiater and instantiated (dashed links in
contrast to continuous links for ordinary links). Viewing Instantiation as a
generalization (in terms of redefinition) of all Typingx associations allows to use
the closure operations from class Thing on objects from classes M0, M1, M2 or
M3. Thus the displayed OCL expressions and their results reflect the following
facts: object Person is a (direct resp. indirect) instantiation of objects Class and
MetaClass; objects Ada and Person are (direct resp. indirect) instantiations of
object Class.</p>
      <p>Metamodeling means to construct models for several levels. The metamodels
on the respective level should be described and modeled independently (e.g., as
M0, M1, M2, and M3). The connection between the models should be
established in a formal way by a typing association (e.g., Typing0 gives a type object
from M1 to a typed object from M0). The Typing associations are introduced
as redefined versions of the association Instantiation from (what we call) a
multi-level superstructure. This superstructure contains the abstract class Thing
which is an abstraction of all metamodel elements across all levels and
additionally contains the association Instantiation and accompanying constraints.
Because Instantiation is defined as union, an Instantiation link can only
connect elements of adjacent levels, i.e., the Typingx links are level-conformant
and strict. The aim of the devices in the superstructure is to establish the
connection between metamodel levels in a formal way and to provide support for
formally restricting the connections.
3</p>
    </sec>
    <sec id="sec-4">
      <title>Connecting Multi-Levels with Operations</title>
      <p>
        The second approach for connecting multi-levels is based on viewing one model
both as a type model and as an instance model. In Fig. 2 an example as
elaborated with USE [
        <xref ref-type="bibr" rid="ref10 ref11">11, 10</xref>
        ] is shown. The object diagram on the left side is essentially
equivalent to the class diagram on the right side. The displayed example can be
realized in USE in this way, however, there is currently no option to connect
the two equivalent representations in form of the class diagram and the object
diagram. Additional features would be needed.
      </p>
      <p>In Fig. 4 such a connection is indicated with (a) one operation accessing a
model element through its String-valued name $_$ : String -&gt; ModelElement
and (b) one operation returning the String-valued name of a model
element #_# : ModelElement -&gt; String.</p>
      <p>Apart from the two new operations dollar $ and sharp # some new modeling
features for UML and OCL would be needed as well: (a) OCL clauses (for
elements such as invariants or pre- and postconditions) should allow parameters
that represent variables for model elements and (b) the new operations dollar
and sharp should be allowed in expressions for model elements in clauses (e.g.,
for a class or an attribute). The following examples try to give an impression of
the aimed functionality.
parameter[rs:RelSchema]
let relSchemaClass = $rs.name$ in -- in this example: $rs.name$=rs
let keyAttr = $rs.attr-&gt;any(a|a.isKey=true).name$ in
context relSchemaClass inv keyAttrUnique:
relSchemaClass.allInstances-&gt;forAll(x,y |</p>
      <p>x&lt;&gt;y implies x.keyAttr&lt;&gt;y.keyAttr)
parameter[rs:RelSchema]
let relSchemaClass = $rs.name$ in
let keyAttr = $rs.attr-&gt;any(a|a.isKey=true).name$ in
context x,y:relSchemaClass inv ’keyAttrUniqueIn’ + #rs#:
x&lt;&gt;y implies x.keyAttr&lt;&gt;y.keyAttr
In these examples it is assumed that there is exactly one key attribute for each
class. When these parameterized features become actualized, then in this case
the following invariants would be required. It is an open question whether the
actualization is implicit or explicit: The actualization mechanism may be
considered as being implicit for all actual features that are available in the model, or
the actualization mechanism may be considered as being something the modeler
has to explicitly ask for.
context Town inv keyAttrUnique:</p>
      <p>Town.allInstances-&gt;forAll(x,y | x&lt;&gt;y implies x.name&lt;&gt;y.name)
context Country inv keyAttrUnique:</p>
      <p>Country.allInstances-&gt;forAll(x,y | x&lt;&gt;y implies x.name&lt;&gt;y.name)
context x,y:Town inv keyAttrUniqueInTown:</p>
      <p>x&lt;&gt;y implies x.name&lt;&gt;y.name
context x,y:Country inv keyAttrUniqueInCountry:
x&lt;&gt;y implies x.name&lt;&gt;y.name</p>
      <p>Fig. 2. Example for Multiple Representations of Middle Level Model.</p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>This paper is based on the idea to describe different metamodels in one model
and to connect the metamodels either (a) with generalizations and associations
employing appropriate UML and OCL constraints or (b) with special operations
allowing to navigate between different multi-levels in a model. The paper does
not claim to present final results, but some experiments and ideas in the context
of multi-level models.</p>
      <p>
        Future research includes the following topics. We would like to work out for our
approach formal definitions for notions like potency or strictness. The notion of
powertype will be given special attention in order to explore how far this concept
can be integrated. Our tool USE could be extended to deal with different
metamodel levels simultaneously. So far USE deals with class and object diagram.
In essence, we think of at least a three-level USE (cubeUSE) where the middle
level can be seen at the same time as an object and class diagram, as has been
sketched in the second approach in this paper. Furthermore, larger examples and
case studies must check the practicability of the proposal.
12. Gogolla, M., Favre, J.M., Bu¨ttner, F.: On Squeezing M0, M1, M2, and M3 into a
Single Object Diagram. In et al., T.B., ed.: Proc. MoDELS’2005 Workshop Tool
Support for OCL and Related Formalisms, EPFL (Switzerland),
LGL-REPORT2005-001 (2005)
13. Gogolla, M., Sedlmeier, M., Hamann, L., Hilken, F.: On Metamodel
Superstructures Employing UML Generalization Features. In Atkinson, C., Grossmann,
G., Ku¨hne, T., de Lara, J., eds.: Proc. Int. Workshop on Multi-Level
Modelling (MULTI’2014), http://ceur-ws.org/Vol-1286/, CEUR Proceedings, Vol. 1286
(2014) 13–22
14. Guerra, E., de Lara, J.: Towards Automating the Analysis of Integrity Constraints
in Multi-Level Models. [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] 63–72
15. Hamann, L., Gogolla, M.: Endogenous Metamodeling Semantics for Structural
UML 2 Concepts. In Moreira, A., Scha¨tz, B., Gray, J., Vallecillo, A., Clarke, P.J.,
eds.: MoDELS. Volume 8107 of LNCS., Springer (2013) 488–504
16. Henderson-Sellers, B., Clark, T., Gonzalez-Perez, C.: On the Search for a
LevelAgnostic Modelling Language. In Salinesi, C., Norrie, M.C., Pastor, O., eds.:
CAiSE. Volume 7908 of LNCS., Springer (2013) 240–255
17. Igamberdiev, M., Grossmann, G., Stumptner, M.: An Implementation of
MultiLevel Modelling in F-Logic. [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] 33–42
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Alanen</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Porres</surname>
            ,
            <given-names>I.: A Metamodeling</given-names>
          </string-name>
          <string-name>
            <surname>Language Supporting Subset</surname>
            and
            <given-names>Union</given-names>
          </string-name>
          <string-name>
            <surname>Properties</surname>
          </string-name>
          .
          <source>Software and System Modeling</source>
          <volume>7</volume>
          (
          <issue>1</issue>
          ) (
          <year>2008</year>
          )
          <fpage>103</fpage>
          -
          <lpage>124</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Atkinson</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>: Multi-Level Modeling with Melanie</article-title>
          .
          <source>Commit Workshop</source>
          <year>2012</year>
          (
          <year>2012</year>
          )
          <article-title>commit</article-title>
          .wim.uni-mannheim.de/uploads/media/commitWorkshop Atkinson.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Atkinson</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gerbig</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          , Ku¨hne, T.:
          <article-title>A Unifying Approach to Connections for Multi-Level Modeling Foundations</article-title>
          .
          <source>In: Proc. Int. Conf. Models (MODELS</source>
          '
          <year>2015</year>
          ).
          <article-title>(</article-title>
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Atkinson</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gerbig</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          , Ku¨hne, T.:
          <article-title>Opportunities and Challenges for Deep Constraint</article-title>
          .
          <source>In: Proc. Int. Workshop OCL</source>
          and Textual
          <string-name>
            <surname>Modeling</surname>
          </string-name>
          (OCL'
          <year>2015</year>
          ).
          <article-title>(</article-title>
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Atkinson</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grossmann</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          , Ku¨hne, T.,
          <string-name>
            <surname>de Lara</surname>
          </string-name>
          , J., eds.
          <source>: Proc. MODELS'2014 Workshop on Multi-Level Modelling (MULTI'2014). Volume 1286 of CEUR Workshop Proceedings., CEUR-WS.org</source>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Atkinson</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          , Ku¨hne, T.:
          <string-name>
            <surname>Model-Driven Development</surname>
          </string-name>
          :
          <article-title>A Metamodeling Foundation</article-title>
          .
          <source>IEEE Software 20(5)</source>
          (
          <year>2003</year>
          )
          <fpage>36</fpage>
          -
          <lpage>41</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. B´ezivin, J.:
          <source>On the Unification Power of Models. Software and System Modeling</source>
          <volume>4</volume>
          (
          <issue>2</issue>
          ) (
          <year>2005</year>
          )
          <fpage>171</fpage>
          -
          <lpage>188</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Clark</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gonzalez-Perez</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Henderson-Sellers</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          :
          <article-title>A Foundation for Multi-Level Modelling</article-title>
          . [
          <volume>5</volume>
          ]
          <fpage>43</fpage>
          -
          <lpage>52</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9. de Lara, J.,
          <string-name>
            <surname>Guerra</surname>
          </string-name>
          , E.:
          <article-title>Deep Meta-modelling with MetaDepth</article-title>
          . In Vitek, J., ed.:
          <source>TOOLS (48)</source>
          . Volume 6141 of LNCS., Springer (
          <year>2010</year>
          )
          <fpage>1</fpage>
          -
          <lpage>20</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Employing the Object Constraint Language in Model-Based Engineering</article-title>
          . In Gorp, P.V.,
          <string-name>
            <surname>Ritter</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rose</surname>
          </string-name>
          , L., eds.
          <source>: Proc. 9th European Conf. Modelling Foundations and Applications (ECMFA</source>
          <year>2013</year>
          ), Springer, LNCS
          <volume>7949</volume>
          (
          <year>2013</year>
          )
          <fpage>1</fpage>
          -
          <lpage>2</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Bu¨ttner,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Richters</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.:</surname>
          </string-name>
          <article-title>USE: A UML-Based Specification Environment for Validating UML and OCL</article-title>
          .
          <source>Science of Computer Programming</source>
          <volume>69</volume>
          (
          <year>2007</year>
          )
          <fpage>27</fpage>
          -
          <lpage>34</lpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>