<!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>Checking Transformation Model Properties with a UML and OCL Model Validator</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>
        <contrib contrib-type="author">
          <string-name>Lars Hamann</string-name>
          <email>lhamann@informatik.uni-bremen.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Frank Hilken</string-name>
          <email>fhilken@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 studies model transformations in the form of transformation models connecting source and target metamodels. We propose to analyze transformation models with a UML and OCL tool on the basis of an implementation of relational logic on top of Kodkod. Within this approach it is feasible to prove transformation model consistency, i.e., to automatically construct a valid metamodel model instance. Certain properties implied by the transformation model, e.g. whether a particular property is preserved by the transformation, can be inspected as well. As an example, the paper uses the well-known transformation between ER schemata and relational database schemata.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Our work has links to related approaches. Different notions of consistency and
instanciability as considered here have also been proposed in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Our work is
based on Alloy [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and Kodkod [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. The implementation of the model validator
that we employ is grounded on a translation of UML and OCL concepts into
relational logic as described in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Application of transformation models using
the same example as employed here, however with different underlying
metamodels and focusing on transformation refinement, has been studied in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. The
application of Alloy in the context of graph transformations has been recently
proposed in [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. Additional material for the example can be found in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
The rest of this paper is structured as follows. Section 2 describes the running
example which is used throughout the paper. Section 3 sketches how to apply
the model validator in the context of the example. Section 4 shows how
transformation models can be inspected with regard to consistency. Section 5 applies our
technique for checking transformation model consequences. Section 6 shortly
discusses translation and solving times. Section 7 closes the paper with a conclusion
and future work.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Transformation Model Example</title>
      <p>
        The running example in this paper is the well-known transformation between
Entity-Relationship (ER) and relational database schemata. We study this
transformation in form of a transformation model as introduced in [
        <xref ref-type="bibr" rid="ref2 ref5">5, 2</xref>
        ]. A
transformation model is a descriptive model where the relationship between source and
target is purely characterized by the (source,target) model pairs determined by
the transformation. A transformation model consists in our approach of a plain
UML class diagram with restricting OCL invariants. Typically, there is an anchor
class for the source model, an anchor class for the target model, and a connecting
class for the transformation. There are OCL invariants for restricting the source
metamodel, for the target metamodel, and for the transformation.
In Fig. 1 the class diagram and the invariant names for the example are pictured.
All details of the example can be found in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. The example transformation model
has four parts: a base part with datatypes and attributes for concepts commonly
employed in the ER and relational model; a part for ER schemata (ErSchema)
with the concepts Entity, Relationship, and Relend (relationship end); a
part for relational database schemata (RelDBSchema) incorporating relational
schemata (RelSchema); finally, a part for the transformation (Trans). [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
discusses also the semantics. Therefore, some classes here are marked in their names
as belonging to the syntax (ErSyn, RelSyn).
      </p>
      <p>
        We have used the terms source and target, but transformation models are
direction-neutral due to the central employment of associations. We will say that
we ‘transform a source ER schema into a target relational database schema’, but
formally the class diagram does not indicate any direction. In our view,
transformation models can be looked at as a form of bidirectional transformations.
Currently our model validator does not support the computation of strings in
a satisfactory way. In particular, we need string computations for relational
attributes in connection with ER attribute names and relationship end names.
Through this, we can establish a connection between the source and the target
model. Thus, in contrast to [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], we model names (for example, of entities or
attributes) as integers and have to pose certain restrictions on the use of the
underlying integers and strings. However, through a derived attribute nameS, we
are able to represent the ‘integer names’ formally as string values. For example,
we will calculate: 20 = 2*10+0 =~ ‘2.concat(0)’ ~= ’C’.concat(’A’) = ’CA’.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Applying the USE Model Validator</title>
      <p>We explain the application of the USE model validator by showing how the tool
has to be configured in order to construct a model transformation between an
example ER schema and a corresponding relational database schema. The needed
configuration is shown in Fig. 2 and the resulting generated object diagram,
which captures both schemata, is pictured in Fig. 3.</p>
      <p>In a model validator configuration, the population of (a) classes, (b) associations,
(c) attributes and (d) datatypes is determined. Classes, attributes and datatypes
are displayed in the configuration table in black-on-white, and associations in
black-on-light-grey. (a) A class needs an integer upper bound for the maximal
number of objects in that class, and an optional lower bound may be given.
(b) Associations may also have a lower and upper bound for the number of links
or their population may be left open and be thus determined through the
(upper bounds for the) participating classes. (c) Attributes may be determined by
specifying an enumeration of allowed values or by the set of values derived from
the value set of the corresponding datatype. (d) The numerical datatypes
Integer and Real may be configured through an enumeration (e.g., Set{42,44,46}
or Set{3.14, 6.28, 9.42}) or with lower and upper bounds for the interval of
allowed values with an additional step value for Real (for example, resulting in
Set{-8..7} or Set{-1, -0.5, 0, 0.5, 1}). The datatype String may be determined by
an enumeration (e.g., Set{‘UML’,‘OCL’,‘MDE’}) or through a lower and upper
bound for the number of automatically generated String literals (resulting in,
for example, Set{‘String1’,...,‘String7’}).</p>
      <p>The example configuration requires (among other restrictions) the following:
(a) there is exactly one transformation object (in class Er2Rel Trans), and there
are exactly two relational schemas (in class RelSyn RelSchema); (b) the links
in association ErSyn OwnershipErSchemaEntity between ErSyn ErSchema and
ErSyn Entity are not explicitly restricted, but only implicitly through the
upper bounds of the participating classes, and there is no link in the association
ErSyn OwnershipRelshipAttribute, which means that in the constructed ER
schema there will be no relationship attribute; (c) the attribute isKey is
allowed to take values from the enumeration Set{false,true} (recall that in UML
and OCL more than two truth values are available); (d) the datatype Integer is
allowed to take values from the interval [0..127].</p>
      <p>The automatically generated transformation in Fig. 3 is displayed in form of the
constructed object diagram and in form of a visual resp. textual domain-specific
representation of the ER schema (in traditional ER notation) resp. the relational
database schema (as textual SQL table declarations). In particular, the two
relationship ends E and J of the relationship HE are represented as attributes ED
and JD in the relational schema HE, because the attribute D constitutes the key
in entity HD and in the relational schema HD. If there would be a composed key in
the entity HD, say attributes DA and DB, the relational schema HD has to contain
four attributes EDA, EDB, JDA, and JDB. Thus, the key attribute names on the
relational side have to be composed from the relationship end and attribute
names from the ER side.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Checking Transformation Model Consistency</title>
      <p>The configuration table in Fig. 4 shows three configurations needed to check
for (1) weak consistency, (2) class instanciability, and (3) class and association
instanciability. With option (1) we mean that at least one valid object diagram
can be found, even with no objects at all or empty populations for a single class,
provided the model and the configuration allows this; option (2) means all classes
are instantiated with non-empty populations; option (3) means that all classes
and all associations are instantiated. The three options are determined by the
first, second, and third column of the parts displayed in Fig. 4 with
white-ondark-grey. The essential differences between the three options are displayed in
the following table.</p>
      <sec id="sec-4-1">
        <title>Class</title>
        <p>Association</p>
        <p>weak class
consistency instanciability
0..UpperBound 1..UpperBound
0..* 0..*
class and association
instanciability
1..UpperBound
1..UpperBound
The first option states an upper bound for class population, but no lower bound
for class population, and no restriction for association population. The second
option additionally requires all classes to be populated by at least one object.
The third option additionally demands that all associations must be populated
by at least one link. As UpperBound we have chosen in the example the integer 9
which results in manageable execution times. Depending on the considered
transformation model, this number may be different. However, the table shows the
principle approach to handle consistency and (the two kinds of) instanciability
in our context.</p>
        <p>The object diagrams together with the ER schemata and the SQL table
definitions in Figs. 5, 6, and 7 show the results of applying the USE model validator
in the example transformation model for proving (by example) weak
consistency, class instanciability, and class and association instanciability. As the
requirements increase, more and more concepts from the metamodel have to be
employed by the model validator. In Fig. 5 only entities and attributes are
generated on the ER side (indeed only one entity and one attribute), in Fig. 6
additionally relationships and relationship ends show up, and finally in Fig. 7
also relationship attributes occur. The ‘Object count’ window and the ‘Link
count’ window in Fig. 5 are the means in the USE tool to shortly check the class
and association population in an overview. In the weak consistency case there
are no relationships and no relationship end objects, and accordingly there are
no links for relationships. For the case described in Fig. 6 (class instanciability),
the ‘Link count’ window would show (if displayed) zero links for the association
ErSyn OwnershipRelshipAttribute indicating that there are no relationship
attributes.
5</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Checking Implications of the Transformation Model</title>
      <p>Below an additional ad-hoc invariant is specified. The invariant expresses a
connection between the key attributes on the ER and the relational side. This
invariant is added to the model invariants, and the model validator is started
with the weak consistency configuration from Fig. 4 which is the least
restrictive configuration (potentially allowing the maximum set of object diagrams).
The model validator reports that the model with the additional invariant is not
satisfiable.
context self:Er2Rel_Trans
inv erHasOnlyKeyAttrs_relHasSomeNonKeyAttrs:
self.erSchema.entity.attribute-&gt;
union(self.erSchema.relship.attribute)-&gt;</p>
      <p>select(a|a.isKey=false)-&gt;isEmpty() and
self.relDBSchema.relSchema.attribute-&gt;</p>
      <p>select(a|a.isKey=false)-&gt;notEmpty()
unsatisfiable: erSchema.hasOnlyKeyAttrs() and</p>
      <p>not relDBSchema.hasOnlyKeyAttrs()
valid: erSchema.hasOnlyKeyAttrs() implies</p>
      <p>relDBSchema.hasOnlyKeyAttrs()
Of course, the model validator has checked only a finite number of object diagram
candidates which are determined by the stated upper bounds. If we conclude
from this fact that the model together with the added invariant is generally
unsatisfiable, then the negated invariant must be valid for the transformation
model. We argue that the unsatisfiability ends up in showing that the following
property can be formally deduced: if there are only key attributes on the ER
side, then there are also only key attributes on the relational side, i.e. non-key
attributes cannot exist on the relational side. This is an example where we can
show that a property, which can be formulated on the source and target side of
the transformation, is preserved when considering the direction from the source
to the target. We think that the strength of our approach is its genericity: the
very same properties can be checked to any transformation model, whichever
the considered metamodels are; another strength can be seen in the relative ease
of using our approach.
6</p>
    </sec>
    <sec id="sec-6">
      <title>Translation and Solving Times</title>
      <p>The table below states translation and solving times. The translation time is
the time for translating the configuration into a Kodkod relational formula.
The solving time is the time the Kodkod solver needs to compute the
answer. The most complex task took about 8 minutes on a standard laptop.
We used the Kodkod default solver, but faster solvers are available. Please
be aware of the fact that the underlying transformation model has about
20, partly non-trivial OCL constraints. The most complex constraint (see
forRelSchemaExistsOneEntityXorRelship in [6, page 8]) requires that for
every attribute in the relational database schema there either has to be an
equivalent entity attribute or a relationship attribute in the ER schema. This constraint
is about 20 lines long and has five nested quantifiers.</p>
      <sec id="sec-6-1">
        <title>ER schema with binary association</title>
        <p>
          Weak consistency
Class instanciability
Class and association instanciability
Implied property (‘ER keys’ vs. ‘rel. keys’)
Larger example from [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ]
We have presented an approach for automatically checking transformation model
features: consistency, class instanciability, class and association instanciability,
and property preservation by the transformation model. The implementation of
our model validator is based on the relational model finder Kodkod.
Future work could consider to study invariant independence, i.e., minimality of
transformation models. One can also deliver to the model validator a partial
solution and let the validator automatically complete the transformation.
Furthermore, checking for unique results (constructing further results beyond first
found solutions) is feasible. The handling of strings must be improved. Last but
not least, larger case studies must check the practicability of the approach.
        </p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Amrani</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lucio</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Selim</surname>
            ,
            <given-names>G.M.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Combemale</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dingel</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vangheluwe</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Traon</surname>
            ,
            <given-names>Y.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cordy</surname>
            ,
            <given-names>J.R.:</given-names>
          </string-name>
          <article-title>A Tridimensional Approach for Studying the Formal Verification of Model Transformations</article-title>
          . In Antoniol, G.,
          <string-name>
            <surname>Bertolino</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Labiche</surname>
          </string-name>
          , Y., eds.
          <source>: Proc. Workshops ICST</source>
          , IEEE (
          <year>2012</year>
          )
          <fpage>921</fpage>
          -
          <lpage>928</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Bezivin</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Bu¨ttner,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Gogolla</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Jouault</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Kurtev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            ,
            <surname>Lindow</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.</surname>
          </string-name>
          : Model Transformations? Transformation Models! In Nierstrasz,
          <string-name>
            <given-names>O.</given-names>
            ,
            <surname>Whittle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Harel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            ,
            <surname>Reggio</surname>
          </string-name>
          , G., eds.
          <source>: Proc. 9th Int. Conf. Model Driven Engineering Languages and Systems (MoDELS'2006)</source>
          , Springer, Berlin, LNCS
          <volume>4199</volume>
          (
          <year>2006</year>
          )
          <fpage>440</fpage>
          -
          <lpage>453</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. Bu¨ttner,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Egea</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Guerra</surname>
          </string-name>
          , E.,
          <string-name>
            <surname>de Lara</surname>
          </string-name>
          , J.:
          <article-title>Checking Model Transformation Refinement</article-title>
          . In Duddy,
          <string-name>
            <given-names>K.</given-names>
            ,
            <surname>Kappel</surname>
          </string-name>
          , G., eds.
          <source>: Proc. Inf. Conf. ICMT. LNCS 7909</source>
          , Springer (
          <year>2013</year>
          )
          <fpage>158</fpage>
          -
          <lpage>173</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cabot</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Claris´o,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Riera</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          :
          <article-title>Verification of UML/OCL Class Diagrams using Constraint Programming</article-title>
          .
          <source>In: ICST Workshops</source>
          , IEEE Computer Society (
          <year>2008</year>
          )
          <fpage>73</fpage>
          -
          <lpage>80</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Tales of ER and RE Syntax and Semantics</article-title>
          . In Cordy,
          <string-name>
            <given-names>J.R.</given-names>
            , L¨ammel, R.,
            <surname>Winter</surname>
          </string-name>
          , A., eds.: Transformation Techniques in Software Engineering,
          <string-name>
            <surname>IBFI</surname>
          </string-name>
          , Schloss Dagstuhl,
          <source>Germany (2005) Dagstuhl Seminar Proceedings</source>
          <volume>05161</volume>
          . 51 pages.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Gogolla</surname>
          </string-name>
          , M., Hamann, L.,
          <string-name>
            <surname>Hilken</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>Checking Transformation Model Properties with a UML and OCL Model Validator: Additional Material</article-title>
          .
          <source>Technical report</source>
          , University of Bremen (
          <year>2014</year>
          ) http://www.db.informatik.uni-bremen.de/ publications/intern/GHH2014addon.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Jackson</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Software Abstractions: Logic, Language, and Analysis</article-title>
          . MIT Press (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Kuhlmann</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gogolla</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <string-name>
            <surname>From</surname>
            <given-names>UML</given-names>
          </string-name>
          and
          <article-title>OCL to Relational Logic and Back</article-title>
          . In France, R.,
          <string-name>
            <surname>Kazmeier</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Breu</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Atkinson</surname>
          </string-name>
          , C., eds.
          <source>: Proc. 15th Int. Conf. Model Driven Engineering Languages and Systems (MoDELS'2012)</source>
          , Springer, Berlin, LNCS
          <volume>7590</volume>
          (
          <year>2012</year>
          )
          <fpage>415</fpage>
          -
          <lpage>431</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Torlak</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jackson</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          : Kodkod:
          <string-name>
            <given-names>A Relational</given-names>
            <surname>Model</surname>
          </string-name>
          <article-title>Finder</article-title>
          .
          <source>In: Proc. Int. Conf</source>
          .
          <article-title>Tools and Algorithms for the Construction and Analysis of Systems (TACAS'</article-title>
          <year>2007</year>
          ).
          <source>(2007) LNCS</source>
          <volume>4424</volume>
          ,
          <fpage>632</fpage>
          -
          <lpage>647</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          , Bu¨ttner,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Lamo</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y.</surname>
          </string-name>
          :
          <article-title>Verification of Graph-based Model Transformations Using Alloy</article-title>
          . In Hermann, F.,
          <string-name>
            <surname>Sauer</surname>
          </string-name>
          , S., eds.
          <source>: Proc. Workshop</source>
          Graph Transformation and
          <article-title>Visual Modeling Techniques (GTVMT'</article-title>
          <year>2014</year>
          ), ECEASST, Electronic Communications, journal.ub.tu-berlin.de/eceasst/. To appear. (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>