<!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>iOCL: An Interactive Tool for Specifying, Validating and Evaluating OCL Constraints</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Muhammad Hammad</string-name>
          <email>hammad@simula.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Tao Yue</string-name>
          <email>tao@simula.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Shaukat Ali</string-name>
          <email>shaukat@simula.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Shuai Wang</string-name>
          <email>shuai@simula.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Simula Research Laboratory</institution>
          ,
          <addr-line>Oslo</addr-line>
          ,
          <country country="NO">Norway</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Oslo</institution>
          ,
          <addr-line>Oslo</addr-line>
          ,
          <country country="NO">Norway</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The Object Constraint Language (OCL) is frequently used to specify additional constraints on models, in addition, to the ones enforced by semantics of the models. It is a wellknown fact that due to the lack of familiarity with OCL, practitioners and even researcher to some extent are reluctant in using OCL. To help practitioners and researchers in writing OCL constraints for their specific problem at hand, we developed a tool called interactive OCL (iOCL) for interactively specifying constraints on a given model. The basic philosophy behind the tool is to present only those details (e.g., operations) of OCL to modelers that are valid at a given step of constraint specification process, in addition to helping modelers with its syntax. Our ultimate aim is to reduce the effort required to specify constraints, subsequently lowering down training cost and increasing the correctness of the constraints. iOCL is a web-based application that integrates other tools including Eclipse OCL for validation and evaluation of OCL constraints, and EsOCL for automatically generating valid instances of models that satisfy the specified constraints.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        To successfully apply a model-based engineering (MBE) solution in practice, the key
challenge to overcome is to construct required models in a cost-effective manner. For
example, applying a model-based testing solution requires test engineers to construct
test ready models in a particular modeling language (e.g., Unified Modeling
Language (UML) [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]), from which executable test cases can be generated. Constructing
such test ready models in a cost-effective manner is the key factor that determines
whether the proposed approach can be successfully applied in practice. In the past, we
have developed some MBE solutions [
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5 ref6">1, 2, 3, 4, 5, 6</xref>
        ], most of which are based on
UML and its profiles, and moreover some of which require using the Object
Constraint Language (OCL) to specify various constraints such as state invariants on
states of a state machines. Due to less acquaintance with OCL and being declarative,
practitioners and researchers are hesitant to use the OCL. To assist practitioners and
researchers in specifying OCL constraints, we developed a tool called interactive
OCL (iOCL) to interactively specify constraints.
      </p>
      <p>The underlying idea behind iOCL is to guide users through constraint specification
process step by step, in an interactive manner. There are three types of user operations
in iOCL: selection, basic value input, and text input. Through these three user
operations, a user interacts with iOCL to specify OCL constraints. The overall aim of iOCL
is to minimize the use of the value input and text input operations and maximize the
use of the selection operation; therefore, chances for users to make errors can be
reduced. In addition, it decreases the extent of OCL knowledge required from a
modeler. The selection user operation is performed by making a choice from a list of
available options provided by iOCL that are valid at a given step in constraint specification
step. Depending on the type of the UML model element, an association end
multiplicity, or even the type of a collection resulting from one or more navigations from the
contextual classifier, iOCL dynamically updates selection options at a given step of a
specification process. Regarding the basic value input user operation, users are
prompted to input basic values for basic types when necessary, at a given step of a
specification process. For example, iOCL displays a text box for users to input an
integer value for an integer type of properties. In terms of the text input user
operation, there are two situations, where users can input text in a text box.</p>
      <p>iOCL aims to automate an OCL constraint specification process as much as
possible. The key automation of iOCL is to dynamically shortlist available options at any
given step, such that a user can perform the selection user operation in a more
efficient way. With this objective in mind, iOCL systematically checks the UML model,
the already specified partial OCL constraint and the current step of the specification
process. The second key automation feature of iOCL is to categorize types of
constraints, OCL operations, and properties and only display relevant ones at a given
step. This feature helps to reduce specification effort and potential errors that a user
might make when manually writing an OCL constraint. iOCL also allows a user to
roll back to previous steps of a specification process. Moreover, iOCL automatically
takes cares of bracket pairing and automatically fills out left and right brackets thus
assisting a modeler with syntax.</p>
      <p>
        iOCL is a web-based application, which is built on various existing technologies:
Eclipse Modeling Framework (EMF) [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], Eclipse OCL [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], Eclipse UML2 [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ], and
EsOCL [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. With iOCL, specified OCL constraints can be validated to check their
syntax, and evaluated to check their correctness with predefined instances and/or with
the automated generated ones with the help of EsOCL, an OCL constraint solver.
Interested users can try iOCL here: http://dnat.simula.no:50753/IOCL
2.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Architecture of iOCL</title>
      <p>
        The architecture of iOCL is presented in Figure 1. As shown in the figure, iOCL has
five key functionalities: 1) reading an UML model, on which OCL constraints can be
specified, 2) specifying constraints, 3) validating specified constraints, 4) evaluating
the correctness of specified constraints, and 5) exporting specified OCL constraints
and relevant information. A UML is first loaded and then parsed. The obtained model
elements are stored in a model repository, which are queried by Specifier to support
the interactive specification of OCL constraints. The implementation of Constraint
Validator and Evaluator relies on three existing technologies: Eclipse UML2, Eclipse
OCL and EsOCL [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. EsOCL is a search-based OCL solver that uses various
heuristics defined based on constructs of OCL that are implemented as a fitness function.
Search algorithms, e.g., Genetic Algorithms and (1+1) Evolutionary Algorithm, can
use such fitness function to guide for solving OCL constraints.
      </p>
      <p>
        The implementation of the iOCL tool is divided into two parts: Front End and
Back End. The Back End of iOCL implements the five functionalities described
above. The Front End of iOCL is in charge of the interaction with users via user
interfaces, which is implemented with JavaServer Faces (JSF) [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], which is a well-known
framework for developing user interfaces and web applications. The Query Analyzer
is the action listener, which listens to all the actions from the Back End, and
communicates with Front End Controller. Furthermore, iOCL defines a set of view
templates, which are filled with properties and operations at runtime. Filled templates are
returned to end users.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Tool Demonstration Details</title>
      <p>In this section, we present screenshots of the key functionalities of iOCL. The
YouTube video can be found from the link below:
https://www.youtube.com/watch?v=Wgi9YYMp7Q4</p>
      <p>
        The screenshot above displays the initial interface of the tool. One can select a
model, which can be either .uml or .ecore file, to start with. For the convenience, in
the current interface, we also provide two examples available: the Royal and Loyal
case study and the UML 2.4 metamodel. The original Royal and Loyal case study is
from [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. As shown on the right hand side, all of the model elements of a loaded
model are automatically displayed in the list, from which one can select one as the
contextual element to specify an OCL constraint. One can also select the context from
the dropdown Context Selection list.
      </p>
      <p>When one selects the context, iOCL automatically displays a list of options:
Invariant, Pre Condition, Post Condition, etc. Of course, a user can also roll back to her/his
previous selection via the Back button, shown in the screenshot above.</p>
      <p>From the screenshot shown above, when a user selects the context, a list of options
is displayed in the Attribute Scope pane. When the user selects the Local Attribute
option, a dropdown list is displayed to show all the local attributes of class Customer,
as shown in the screenshot below.</p>
      <p>When the user finishes the specification, she/he can click the Validate button to
validate the syntactic correctness of the specified constraint and results will be
returned to the user in a second, as shown in the screenshot below.</p>
      <p>One can also switch from one panel to another if needed. As shown in the
screenshot below, during the specification process, one can switch to Operation Type panel,
which triggers the display of a list of operation types such as Comparison Operation.</p>
      <p>One can also evaluate the specified constraint based on predefined instances by
clicking the Evaluate button, as shown below. Relying on EsOCL, iOCL also helps in
assessing the correctness of the specified constraint. If EsOCL can solve the
constraint provides an instance, it means that the constraint is correctly specified and is
solvable. Otherwise, there are two options, either the specified constraint may have an
issue and a warning will be given to the end user or EsOCL wasn’t successful in
solving the constraint.
4.</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusion</title>
      <p>We presented an interactive OCL constraint specification tool called interactive OCL
(iOCL) with the aim of assisting modelers in interactively specifying OCL
constraints. The underlying idea behind iOCL is to present only the relevant details to a
modeler at a given step of constraint specification process in addition to pre-filling the
syntax with the aim of reducing the OCL knowledge required to specify constraints
and ultimately reducing the training cost of using OCL.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lu</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yue</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ali</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nygård</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>MBF4CR: A Model-Based Framework for Supporting an Automated Cancer Registry System</article-title>
          .
          <source>In: European Conference on Modelling Foundations and Applications</source>
          , pp.
          <fpage>191</fpage>
          -
          <lpage>204</lpage>
          . Springer, (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Hong</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tao</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shaukat</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          :
          <article-title>Model-based Incremental Conformance Checking to Enable Interactive Product Configuration</article-title>
          .
          <source>Information and Software Technology</source>
          <volume>25</volume>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Ali</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Iqbal</surname>
            ,
            <given-names>M.Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Arcuri</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Briand</surname>
            ,
            <given-names>L.C.</given-names>
          </string-name>
          :
          <article-title>Generating test data from OCL constraints with search techniques</article-title>
          .
          <source>IEEE Transactions on Software Engineering</source>
          <volume>39</volume>
          ,
          <fpage>1376</fpage>
          -
          <lpage>1402</lpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Ali</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yue</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Iqbal</surname>
            ,
            <given-names>M.Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Panesar-Walawege</surname>
            ,
            <given-names>R.K.</given-names>
          </string-name>
          :
          <article-title>Insights on the use of OCL in diverse industrial applications</article-title>
          .
          <source>In: International Conference on System Analysis and Modeling</source>
          , pp.
          <fpage>223</fpage>
          -
          <lpage>238</lpage>
          . Springer, (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Iqbal</surname>
            ,
            <given-names>M.Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ali</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yue</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Briand</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Applying UML/MARTE on industrial projects: challenges, experiences, and guidelines</article-title>
          .
          <source>SoSyM Journal</source>
          <volume>14</volume>
          ,
          <fpage>1367</fpage>
          -
          <lpage>1385</lpage>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Lu</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yue</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ali</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhang</surname>
          </string-name>
          , L.:
          <article-title>Nonconformity Resolving Recommendations for Product Line Configuration</article-title>
          .
          <source>International Conference on Software Testing, International Conference on Software Testing, Verification and Validation (ICST)</source>
          , pp.
          <fpage>57</fpage>
          -
          <lpage>68</lpage>
          , (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Object</given-names>
            <surname>Constraint</surname>
          </string-name>
          <article-title>Language (OCL)</article-title>
          , http://www.omg.org/spec/OCL/
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>Unified</given-names>
            <surname>Modeling Language</surname>
          </string-name>
          (UML), http://www.omg.org/spec/UML/2.5/
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>Eclipse</given-names>
            <surname>Modeling</surname>
          </string-name>
          <article-title>Framework (EMF)</article-title>
          , https://eclipse.org/modeling/emf/
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Eclipse</surname>
            <given-names>OCL</given-names>
          </string-name>
          , http://wiki.eclipse.org/OCL
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Eclipse</surname>
            <given-names>UML2</given-names>
          </string-name>
          , http://wiki.eclipse.org/MDT-UML2
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>JavaServer</given-names>
            <surname>Faces</surname>
          </string-name>
          (JSF), http://www.oracle.com/technetwork/java/javaee/javaserverfaces139869.html
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>[13] Jcabot/ocl-repository, https://github.com/jcabot/ocl-repository/</mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>