<!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>SAC-OCL: A Tool for A Semi Automatic Co-evolution of OCL Constraints</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Djamel Eddine Khelladi</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Reda Bendraou</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Marie-Pierre Gervais</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Sorbonne UniversitØs, UPMC Univ Paris 06, UMR 7606</institution>
          ,
          <addr-line>F-75005, Paris</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>UniversitØ Paris Ouest Nanterre La Defense</institution>
          ,
          <addr-line>F-92001, Nanterre</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Object-Oriented Models (OOM) are widely used in ModelDriven Engineering (MDE). As a complement, OCL constraints are used to specify business rules and detailed aspects of the business domain. Automatically co-evolving OCL constraints w.r.t. the evolved OOM is challenging since alternative resolutions can be applied but also a resolution cannot be applied to any arbitrary constraint. In this paper, we present SAC-OCL an Eclipse-based tool to semi automatically co-evolve OCL constraints when an OOM evolves. In contrast to existing tools, SAC-OCL proposes alternative resolutions for an impacted OCL constraint and proposes only the appropriate resolutions that can be applied on the impacted constraint. Our evaluation on six case studies shows an average correct co-evolution rate of 92%.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        In Model-Driven Engineering , Object-Oriented Models (OOM) play an essential
role to capture the dierent aspects of a system [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. This covers the system’s
architecture, its data structure or its design and GUI classes. A OOM alone
is insucient to capture all the relevant aspects and information of a domain
specication [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. To overcome this limitation, the Object Constraint Language
(OCL) [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] is used to dene constraints on top of OOMs. For instance, the
Unied Modeling Language (UML) [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] metamodel (an OOM) in version 2.4.1
contains more than 750 OCL constraints expressing well-formedness rules.
      </p>
      <p>Whenever an OOM is evolved, its OCL constraints may become invalid and
need to be co-evolved accordingly. However, existing tools have so far overlooked
two main issues: 1) the existence of multiple and semantically dierent
resolutions, and 2) a resolution can be applicable only to a subset of OCL constraints .</p>
      <p>1) An impacted OCL constraint by an OOM evolution can be resolved with
syntactically and/or semantically dierent resolutions. For instance, the change
"multiplicity generalization of a property p from a single value to multiple values"
requires the OCL constraints to work on a collection of values, e.g. by introducing
an iterator. Alternative resolutions must be considered since multiple iterators
with dierent semantics exist, e.g. forAll(), exists() etc.</p>
      <p>
        2) A given resolution strategy is not always applicable for all OCL constraints.
Figure 1 illustrates this issue. It depicts an evolution of an OOM where the
property score is pushed from the superclass Course to the subclass Project. The
two constraints become invalid because score is no more accessible in Course.
The rst constraint that uses the pushed property score through the reference
courses, can be co-evolved by introducing an If expression that rst checks
whether courses references an instance of the subclass Project so that score
is accessible. In contrast, the second OCL constraint whose context (i.e. the
element on which an OCL constraint is specied) is dened on the pushed
property score, is co-evolved dierently by updating its context. Clearly, a resolution
strategy cannot be applied for all impacted OCL constraints by the same change.
Existing tools [
        <xref ref-type="bibr" rid="ref1 ref10 ref2 ref3 ref9">3, 2, 10, 9, 1</xref>
        ] neither consider the two above issues, nor interact
with the user.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] we addressed these issues by presenting an ecient approach for a
semi automatic co-evolution of OCL constraints. We proposed a set of
resolutions while considering alternative resolutions per impacted OCL constraint. We
identied with a systematic analysis three inuencing factors that we rely on to
propose the appropriate resolutions that can be applied to an impacted OCL
constraint. To detect the OOM’s evolution we use our previous tool [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ].
      </p>
      <p>This paper presents SAC-OCL a tool that supports our previous work with
a graphical user interface in the form of an Eclipse plugin. It allows to co-evolve
OCL constraints that are impacted by the OOM’s evolution. To demonstrate
the usefulness of SAC-OCL, we validate it on six open-source case studies. The
results show that we are able to co-evolve the impacted OCL constraints near
to the user intent by reaching an average correct co-evolution rate of 92%.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Tool’s Description</title>
      <p>
        The conceptual framework of SAC-OCL has been already published in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. In this
section we present an overview of its main aspects. Figure 2 shows the workow
phases of the tool: 1 detecting OOM’s evolution, 2 identifying impacted OCL
constraints, 3 proposing alternative and the appropriate resolutions for each
impacted OCL constraint, and 4 applying automatically the resolutions.
      </p>
      <p>The entry point of our tool is the detected OOM’s changes during evolution
1 . We start by loading the evolution trace and the specied OCL constraints
to be parsed. Phase 2 runs an impact analysis to identify the impacted OCL
constraints that need to be co-evolved. After that, the appropriate resolutions
are proposed for each impacted constraint 3 . The user conrms the resolution
to be applied for each impacted constraint among the proposed alternative ones.
Finally, the selected resolutions are automatically performed in phase 4 .
2.1</p>
      <sec id="sec-2-1">
        <title>OOM’s Evolution</title>
        <p>
          During evolution two types of changes are considered in phase 1 : a) Atomic
changes that are additions, removals, and updates of a metamodel element, and
b) Complex changes that consist in a sequence of atomic changes combined
together [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ]. Our previous tool AD-ROOM [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] considers all atomic changes and
seven complex changes: move property, pull property, push property, extract super
class, atten hierarchy, extract class, and inline class [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
2.2
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>Identication of Impacted OCL Constraints</title>
        <p>To identify the impacted OCL constraints we run an impact analysis at the level
of the Abstract Syntax Tree (AST) of the OCL constraints (phase 2 ). Before
identifying where an AST is impacted, we compute the Table 1 that lists for
each metamodel element e, all OCL constraints using e with references to the
AST nodes using e. Those references will be further used in the resolution step.</p>
        <p>Thus, for each change on an OOM element ei, we access the impacted OCL
constraints and we access exactly the impacted AST nodes. Note that during
the co-evolution, Table 1 is updated accordingly w.r.t. the applied resolutions.
For instance, when a rename element e occurs, it is also renamed in the table.
2.3</p>
        <p>
          Resolutions and Selection Process of the Appropriate Ones
In [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ] we rst conducted a systematic analysis that allowed us to identify three
inuencing factors that must be considered to propose the appropriate
resolutions for an impacted OCL constraints. The three factors are highlighted in the
framebox here under.
        </p>
      </sec>
      <sec id="sec-2-3">
        <title>1. The OOM change of an element e.</title>
        <p>2. Location of the impacted element e in an OCL constraint:
(a) e is used in the context of an OCL constraint
(b) e is used in the OCL expression through a navigation path.
3. The context of the impacted constraint, to know from which class the
impacted element is accessed.</p>
        <p>
          We then proposed a set of resolutions to co-evolve the impacted OCL
constraints (can be found in [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]). When dening each resolution we already specify
under which inuencing factors each resolution will be proposed. Each resolution
is implemented as a transformation function that updates the AST by adding,
removing, or updating nodes.
        </p>
        <p>When an OCL constraint is impacted by an OOM change, the process of
Figure 3 is used to select a subset of the appropriate resolutions to be proposed
to the user (phase 3 ). It starts with all the available resolutions from Table
?? and excludes a subset of resolutions based on the inuencing factors. The
rst factor we consider is the metamodel change that excludes resolutions that
are not associated to the given change (step 1). After that the two last factors
are similarly considered (step 2 and 3) to further reduce the set of appropriate
resolutions. This process is followed for each impacted part of an OCL constraint.
3</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Implementation</title>
      <p>
        The tool is implemented as an Eclipse IDE plugin to ease its use by software
engineers who are already familiar with development IDEs like Eclipse. It
supports the co-evolution of OCL constraints dened in an OCL le on both Ecore
[
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] and UML CD [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] models. The core functionalities are implemented with
Java (4568 LoC) interfacing with our AD-ROOM [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] plugin.
      </p>
      <p>Figure 4 part 1 shows the OOM to be evolved. Figure 4 part 2 shows the
OCL constraints to be co-evolved. In a rst step, the OOM evolution (atomic and
complex changes) are taken as input with the OCL constraints. After performing
the impact analysis, the impacted OCL constraints are highlighted to the user</p>
      <p>Fig. 4: Screenshot of the Eclipse plugin Tool SAC-OCL.
as well as the impacting reason (i.e. the OOM change) for a prompt and a better
understanding, as shown in Figure 4 part 3. Figure 4 part 4 shows the subset
of the proposed resolutions that the user chooses from in a dropdown menu for
each impacted OCL constraint. The user’s eort is to select the resolutions to
be applied automatically afterwards (phase 4 ). See the demonstration video:
https://youtu.be/qLn2u0J2Wow.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Evaluation</title>
      <p>We evaluated our tool on six open-source case studies that are Ecore
metamodels (OOMs) with their associated OCL constraints from the OMG specication,
namely: the UML Class Diagram (UML CD), the Structured Metrics metamodel
(SMM), the Unied Prole for DoDAF/MoDAF (UPDM), the National
Information Exchange Model (NIEM), the EXPRESS Information Modeling Language
(EXPRESS), and the Requirements Interchange Format (ReqIF).</p>
      <p>
        The evaluation process consisted in comparing how the OCL constraints
were manually co-evolved in practice against how the same OCL constraints are
co-evolved with our tool. In the experiment, the authors play the user role. We
aimed at co-evolving the OCL constraints as close as possible to the co-evolution
in practice, for an objective comparison. We highlight the obtained results.
Here we give a succinct related work to OCL co-evolution. Demuth et al. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]
proposed an approach for OCL co-evolution based on templates. They provided
11 templates that dene a xed structure for OCL constraints. Hassam et al.
[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] proposed to co-evolve OCL constraints using QVT [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] a transformation
language. Similarly, Markovic et al. [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] proposed to refactor, based on QVT, OCL
constraints annotated on UML class diagrams when these last evolve. Kusel et
al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] discussed the impact of metamodel evolution on OCL expressions and
proposed to resolve impacted expressions. Cabot et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] focused on the
metamodel change delete element. In particular, they aimed at removing only a sub
part of the OCL constraint that is using the deleted element.
      </p>
      <p>
        All existing approaches [
        <xref ref-type="bibr" rid="ref1 ref10 ref2 ref3 ref9">2, 3, 10, 1, 9</xref>
        ] consider only the metamodel change as
a factor to propose a resolution. Thus, they dene for each metamodel change
only a unique resolution. In contrast, we propose alternative resolutions while
considering three inuencing factors instead of one, i.e. the OOM change.
6
      </p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>We presented SAC-OCL a tool for a semi automatic co-evolution of OCL
constraints dened on OOMs. SAC-OCL is designed to consider alternative
resolutions and to propose the appropriate resolutions for each impacted OCL
constraint. It is implemented as a plugin for the Eclipse IDE a wide-spread
development environment for software developers. The evaluation illustrates our
tool’s ability to co-evolve OCL constraints near to the user intent while releasing
the burden of manual co-evolution from the user.</p>
      <p>Acknowledgment. The research leading to these results has received funding
from the industrial innovation Project MoNoGe under grant FUI - AAP no. 15.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>J.</given-names>
            <surname>Cabot</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Conesa</surname>
          </string-name>
          .
          <article-title>Automatic integrity constraint evolution due to model subtract operations</article-title>
          .
          <source>In Conceptual Modeling for Advanced Application Domains</source>
          , pages
          <fpage>350362</fpage>
          . Springer,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>A.</given-names>
            <surname>Demuth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. E.</given-names>
            <surname>Lopez-Herrejon</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Egyed</surname>
          </string-name>
          .
          <article-title>Supporting the co-evolution of metamodels and constraints through incremental constraint management</article-title>
          .
          <source>In MODELS</source>
          , pages
          <fpage>287303</fpage>
          .
          <string-name>
            <surname>Jan</surname>
          </string-name>
          .
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>K.</given-names>
            <surname>Hassam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sadou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. L.</given-names>
            <surname>Gloahec</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Fleurquin</surname>
          </string-name>
          .
          <article-title>Assistance system for ocl constraints adaptation during metamodel evolution</article-title>
          .
          <source>In CSMR</source>
          , pages
          <fpage>151160</fpage>
          . IEEE,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>M.</given-names>
            <surname>Herrmannsdoerfer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. D.</given-names>
            <surname>Vermolen</surname>
          </string-name>
          , and
          <string-name>
            <surname>G. Wachsmuth.</surname>
          </string-name>
          <article-title>An extensive catalog of operators for the coupled evolution of metamodels and models</article-title>
          . In B.
          <string-name>
            <surname>Malloy</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Staab</surname>
          </string-name>
          , and M. v. d. Brand, editors,
          <source>SLE</source>
          , pages
          <fpage>163182</fpage>
          .
          <string-name>
            <surname>Jan</surname>
          </string-name>
          .
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>J.</given-names>
            <surname>Hutchinson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Whittle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rounceeld</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Kristoersen</surname>
          </string-name>
          .
          <article-title>Empirical assessment of mde in industry</article-title>
          .
          <source>In ICSE'11</source>
          , pages
          <fpage>471480</fpage>
          . ACM,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>D. E.</given-names>
            <surname>Khelladi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bendraou</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.-P.</given-names>
            <surname>Gervais</surname>
          </string-name>
          .
          <article-title>Ad-room : a tool for automatic detection of refactorings in object-oriented models</article-title>
          .
          <source>In The 38th ICSE</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>D. E.</given-names>
            <surname>Khelladi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Hebig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bendraou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Robin</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.-P.</given-names>
            <surname>Gervais</surname>
          </string-name>
          .
          <article-title>Detecting complex changes during metamodel evolution</article-title>
          .
          <source>In CAISE'15</source>
          , pages
          <fpage>264278</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>D. E.</given-names>
            <surname>Khelladi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Hebig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Bendraou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Robin</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.-P.</given-names>
            <surname>Gervais</surname>
          </string-name>
          .
          <article-title>Metamodel and constraints co-evolution: A semi automatic maintenance of ocl constraints</article-title>
          .
          <source>In International Conference on Software Reuse</source>
          , pages
          <fpage>333349</fpage>
          . Springer,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>A.</given-names>
            <surname>Kusel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Etzlstorfer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Kapsammer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Retschitzegger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Schoenboeck</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Schwinger</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Wimmer</surname>
          </string-name>
          .
          <article-title>Systematic co-evolution of ocl expressions</article-title>
          .
          <source>In 11th APCCM</source>
          <year>2015</year>
          , volume
          <volume>27</volume>
          , page 30,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <given-names>S.</given-names>
            <surname>Markovic</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Baar</surname>
          </string-name>
          .
          <article-title>Refactoring OCL annotated UML class diagrams</article-title>
          .
          <source>Softw Syst Model</source>
          ,
          <volume>7</volume>
          (
          <issue>1</issue>
          ):
          <fpage>2547</fpage>
          ,
          <string-name>
            <surname>Feb</surname>
          </string-name>
          .
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. G. Mezei,
          <string-name>
            <given-names>T.</given-names>
            <surname>Levendovszky</surname>
          </string-name>
          , and
          <string-name>
            <given-names>H.</given-names>
            <surname>Charaf</surname>
          </string-name>
          .
          <article-title>An optimizing ocl compiler for metamodeling and model transformation environments</article-title>
          .
          <source>In Software Engineering Techniques: Design for Quality</source>
          , pages
          <fpage>6171</fpage>
          . Springer,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>OMG.</surname>
          </string-name>
          <article-title>Object constraints language (ocl). www</article-title>
          .omg.org/spec/OCL/,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. OMG. Query/views/transformations (qvt). www.omg.org/spec/QVT/,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14. OMG.
          <article-title>Unied modeling language (uml). www</article-title>
          .omg.org/spec/UML/,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <given-names>D.</given-names>
            <surname>Steinberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Budinsky</surname>
          </string-name>
          , E. Merks, and
          <string-name>
            <given-names>M.</given-names>
            <surname>Paternostro</surname>
          </string-name>
          .
          <article-title>EMF: eclipse modeling framework</article-title>
          .
          <source>Pearson Education</source>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>