<!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>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>@From ( Init . class ) @To ( Off . class ) class Initialize extends Transition</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Eotvos Lorand University, Faculty of Informatics</institution>
          ,
          <addr-line>Budapest</addr-line>
          ,
          <country country="HU">Hungary</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Gergely Devai</institution>
          ,
          <addr-line>Tibor Gregorics, Melinda Toth, Domonkos Asztalos, David Janos Nemeth, Gabor Ferenc Kovacs, Boldizsar Nemeth, Zoltan Gera, Andras Dobre , Balazs Gregorics, Andras Nagy, Martin Budai, Zsolt Kulik, and Kristof Kanyo</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>The name txtUML stands for textual, executable, translatable UML. It is an Eclipse-based tool built on top of JDT, Xtext/Xbase and Papyrus UML. The tool is designed for textual model editing. This makes storage, version control, compare and merge processes, editing and searching easier and more e cient. The tool supports two textual syntaxes for modeling: the standalone syntax, which is designed to be clean and short, and alternatively, the txtUML Java API, which can be used to de ne models as standard Java programs. The tool supports the generation of graphical UML diagrams from the textual descriptions: class and state machine diagrams. The layout of the diagrams can be controlled by a simple textual diagram layout language. Models can be seamlessly integrated into Java programs: they can be executed and debugged. Generated state machine diagrams can be animated during model execution to further enhance comprehension of model dynamics. Compatibility with other tools is ensured by generating standard UML models in EMF-UML2 format. This representation is the input for our model compiler, which generates C++ code.</p>
      </abstract>
      <kwd-group>
        <kwd>executable modeling</kwd>
        <kwd>textual modeling</kwd>
        <kwd>UML</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        This demonstration presents the framework txtUML, which stands for textual,
executable, translatable UML. It is a tool for software development according to
the executable UML paradigm [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
      <p>
        The project was started in 2014, and the development is done by the
ModelDriven Development Research Group of Eotvos Lorand University, Budapest.
It is open source [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ] on GitHub under the Eclipse Public License [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. The
development is supported by Ericsson Hungary and the tool is currently used
in pilot projects at the company. The txtUML framework is distributed as a set
of Eclipse plugins. Installation instructions and detailed user documentation is
available on the project website [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ].
? This work is supported by Ericsson Hungary.
      </p>
    </sec>
    <sec id="sec-2">
      <title>Similar Tools</title>
      <p>This subsection presents open source UML tools with model execution
capabilities or textual syntaxes.</p>
      <p>
        BridgePoint [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] uses an early fork of UML extended with a proprietary
action language. It uses graphical modeling for class and state modeling, and
textual modeling on the action code level. It is now maintained by a company
named OneFact and has been open sourced [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. In contrast to BridgePoint,
txtUML supports textual modeling for all layers of the modeling language and
visualizes the model via generated diagrams. Furthermore, txtUML is compatible
with the latest UML standard.
      </p>
      <p>
        Papyrus UML [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] is an Eclipse UML framework that aims at providing
customizable graphical editor support for the full UML standard. Papyrus has an
extension, called Moka [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], which contains an interpreter that executes fUML [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]
models and animates diagrams. This interpreter is based on the reference
implementation of fUML and is not designed for high performance. By contrast,
txtUML's model execution is based on on-the- y translation to Java to provide
better performance.
      </p>
      <p>
        Alf [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] is an OMG standard de ning textual syntax for fUML. An Alf editor
is being integrated into Papyrus [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ] in order to provide a textual model editing
alternative. As state machines are not part of fUML and Alf, this modeling layer
is currently not handled by the solution.
      </p>
      <p>
        Moliz [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] is a testing and debugging framework for fUML activities. It de nes
a test speci cation language and extends the fUML reference implementation
with debugging and tracing capabilities. The execution traces are used to decide
if a given test case passes or fails. This project also uses graphical model editors
and the aforementioned fUML reference implementation.
      </p>
      <p>
        Umple [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], eTrice [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and the Papyrus UML-RT [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] are modeling
environments for both graphical and textual model editing. Unlike txtUML, these tools
lack an abstract action language: Umple allows modeling code mixed in Java,
PHP, C++ and Ruby and its code generator emits code in these languages, while
eTrice allows action code in Java or C written in the models as string literals
which are propagated to the generated code. UML-RT uses the same strategy
with C++. None of the approaches allows execution and debugging on the model
level. The diagram generation methodology is also di erent: The referenced tools
use autolayout algorithms, while txtUML allows the user to de ne the layout of
diagrams using a concise DSL.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Textual Syntaxes</title>
      <p>
        Textual modeling has many advantages over editing models in graphics [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Most
importantly, model storage, version control, compare and merge functionalities
can be provided by o -the-shelf, reliable tools. Text editors are more advanced
and stable compared to currently available open source graphical model editors,
and it is often faster to input text than graphics. The txtUML tool provides two
textual syntaxes for modeling:
{ X txtUML: Standalone syntax designed to be short and clean. It is supported
by an Xtext-based editor [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ].
{ J txtUML: In this case, the model is a standard Java program, which uses
the txtUML Java API. Therefore this is an embedded language in Java.
      </p>
      <p>The standalone syntax is easier to use, especially for users not familiar with
Java. On the other hand, the Java syntax can be used in any Java development
environment so that a project using this syntax will not depend on a new editor
and a new language. The two syntactic variants are closely related: In fact,
XtxtUML models are on-the- y translated to JtxtUML models while they are
edited in Eclipse. This is the basis for model execution.
signal ButtonPress ;</p>
      <p>class ButtonPress extends Signal {}
class Machine {
initial Init ;
state Off ;
state On ;
}
}
}
}
transition Initialize {
from Init ;
to Off ;
transition SwitchOn {
from Off ;
to On ;
trigger ButtonPress ;
transition SwitchOff {
from On ;
to Off ;
trigger ButtonPress ;
class Machine extends ModelClass {
class Init extends Initial {}
class Off extends State {}
class On extends State {}
}</p>
      <p>Fig. 1. Two syntactic variants of the txtUML language
(Left: Standalone syntax, Right: Embedded language in Java)
syntax, while the Java version uses inheritance from Signal, ModelClass and
Transition. These classes are provided by the txtUML Java API. Properties of
the transitions are expressed by Java annotations (e.g. @From) in Java, while
attribute-like syntax with keywords (e.g. from) is used in the standalone version.</p>
      <p>The txtUML language covers a subset of UML. We summarize the supported
elements below:
{ Component modeling : Interfaces containing signals; ports; connectors
{ Class modeling : Classes with attributes and operations; simple binary
associations; compositions; (single) inheritance
{ State modeling : Simple and composite states; transitions triggered by signals;
guards; choice states
{ Behavior modeling : Action code can be written in operations of classes,
entry and exit actions of states and e ects of transitions. Supported base types
are int, double, boolean and String with the usual arithmetic and logic
expressions, variables and assignment. Control structures (loops, branches),
attribute access and operation calls are supported. UML-speci c actions:
creation and deletion of objects; linkage and unlinkage via associations and
connectors; reading links; sending signals; accessing signal data in entries,
exits and e ects.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Diagram</title>
    </sec>
    <sec id="sec-5">
      <title>Generation</title>
      <p>
        While textual modeling is practical for editing models, graphical diagrams are
better for understanding them. For this reason txtUML can generate standard
UML diagrams from the models in the format of the Papyrus UML
framework [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]. As of release 0.4.1, class diagrams and state machine diagrams are
supported. We are working on composite structure diagrams at the time of
writing this paper.
      </p>
      <p>txtUML allows users to in uence the layout of the generated diagrams by
textual diagram descriptions. A simple DSL, realized by Java annotations, is
de ned for this purpose. The most important layout statements are the following:
{ @Above, @Below, @Left and @Right de ne that two given diagram elements
are placed next to each other vertically or horizontally.
{ @North, @East, @South and @West place the two given diagram elements
in two di erent half-plains of the diagram, but gives no further constrains
on the distance of the elements.
{ @TopMost, @BottomMost, @EastMost and @WestMost place the given
elements on the corresponding side of the diagram.
{ @Row, @Column and @Diamond can layout multiple elements at once in
the given shape.
{ @Show declares that the given elements have to appear on the diagram, but
gives no further constraint on their placement.
}
}
class MicrowaveOven ;
class Lamp ;
class Magnetron ;
composition LampsOfOven {
container MicrowaveOven oven ;
1..* Lamp lamp ;
composition MagnetronOfOven {
container MicrowaveOven oven ;
1 Magnetron magnetron ;</p>
    </sec>
    <sec id="sec-6">
      <title>5 Execution and Model Compilation</title>
      <p>No matter which syntactic variant of txtUML is selected to implement a model,
it can be seamlessly integrated into Java programs. The txtUML Java API can
be used to create objects of classes in the model, link them via the associations
(if needed) and send signals to them. Such a Java main function, executing the
(completed) model of Figure 2, is shown in Figure 4.
public static void main ( String [] args ) {</p>
      <p>ModelExecutor . Settings . setExecutorLog ( true );
MicrowaveOven oven = Action . create ( MicrowaveOven . class );
Action . start ( oven );
Action . send ( new DoorOpened () , oven );
Action . send ( new DoorClosed () , oven );
Action . send ( new Start () , oven );
Action . send ( new DoorOpened () , oven );</p>
      <p>ModelExecutor . shutdown () ;</p>
      <p>The usual Java debugging functionalities of Eclipse (breakpoints, stepping,
viewing values of variables etc.) are available for txtUML model code as well,
also for the standalone syntax. While the model is executed or debugged, it is
possible to animate the generated state machine diagrams, as shown in Figure 5.</p>
      <p>If the target platform is not compatible with Java, then model compilers
have to be used. As the rst step of the transformation, we turn txtUML models
into EMF-UML2 models, which is the de facto standard format of UML in the
Eclipse environment. This can be used as platform-independent input for code
generators.</p>
      <p>The txtUML project includes a work-in-progress code generator for C++. It
can generate single and multithreaded C++ programs, and users can con gure
which classes of the model should run in which thread.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>1. Mixed textual/graphical modelling in Papyrus-RT. https://wiki.polarsys.org/ images/0/04/TextualModelingForModelingDays.v2.pdf</mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Eclipse</given-names>
            <surname>Public</surname>
          </string-name>
          License - v 1.0. https://www.eclipse.org/legal/epl-v10.html
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>3. eTrice. http://www.eclipse.org/etrice/</mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>4. Executable Translatable UML Open Source Editor. https://www.xtuml.org</mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Forward</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Badreddin</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lethbridge</surname>
          </string-name>
          , T.C.: Umple:
          <article-title>Towards Combining Model Driven with Prototype Driven System Development</article-title>
          .
          <source>In: Rapid System Prototyping (RSP)</source>
          ,
          <year>2010</year>
          21st IEEE International Symposium on. pp.
          <volume>1</volume>
          {
          <issue>7</issue>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Gregorics</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gregorics</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kovacs</surname>
            ,
            <given-names>G.F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dobre</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Devai</surname>
          </string-name>
          , G.:
          <article-title>Textual Diagram Layout Language and Visualization Algorithm</article-title>
          .
          <source>In: Model Driven Engineering Languages and Systems (MODELS)</source>
          ,
          <year>2015</year>
          ACM/IEEE 18th International Conference on. pp.
          <volume>196</volume>
          {
          <fpage>205</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. Gronniger, H.,
          <string-name>
            <surname>Krahn</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rumpe</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schindler</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Volkel, S.: Textbased Modeling.
          <source>In: 4th International Workshop on Software Language Engineering</source>
          (
          <year>2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Mellor</surname>
            ,
            <given-names>S.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Balcer</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jacoboson</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          :
          <string-name>
            <surname>Executable</surname>
            <given-names>UML</given-names>
          </string-name>
          :
          <article-title>A foundation for modeldriven architectures</article-title>
          .
          <source>Addison-Wesley Longman Publishing Co., Inc</source>
          . (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Mijatov</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Langer</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mayerhofer</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kappel</surname>
          </string-name>
          , G.:
          <article-title>A Framework for Testing UML Activities Based on fUML</article-title>
          .
          <source>In: Proceedings of the 10th International Workshop on Model Driven Engineering</source>
          ,
          <article-title>Veri cation and Validation (MoDeVVa) co-located with 16th</article-title>
          <source>International Conference on Model Driven Engineering Languages and Systems (MODELS</source>
          <year>2013</year>
          ). pp.
          <volume>1</volume>
          {
          <issue>10</issue>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Moka</surname>
          </string-name>
          . http://wiki.eclipse.org/Papyrus/UserGuide/ModelExecution
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11. Object Management Group:
          <article-title>Action Language for Foundational UML (ALF), standard, version 1.0.1</article-title>
          . http://www.omg.org/spec/ALF/ (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12. Object Management Group:
          <article-title>Semantics of a Foundational Subset for Executable UML Models (fUML), standard, version 1.1</article-title>
          . http://www.omg.org/spec/FUML/1.1/ (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. OneFact:
          <article-title>BridgePoint xtUML tool</article-title>
          . http://onefact.net
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Papyrus</surname>
          </string-name>
          . https://www.eclipse.org/papyrus/
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Seidewitz</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tatibouet</surname>
          </string-name>
          , J.: Tool Paper:
          <article-title>Combining Alf and UML in Modeling Tools { An Example with Papyrus {</article-title>
          .
          <source>In: OCL 2015{15th International Workshop on OCL and Textual Modeling: Tools and Textual Model Transformations Workshop Proceedings</source>
          . p.
          <volume>105</volume>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16. txtUML:
          <article-title>Textual Executable Translatable UML</article-title>
          . http://txtuml.inf.elte.hu/
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17. txtUML:
          <string-name>
            <surname>Textual Executable Translatable</surname>
            <given-names>UML</given-names>
          </string-name>
          {
          <article-title>Open source repository</article-title>
          . https://github.com/ELTE-Soft/txtUML
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <surname>Xtext</surname>
          </string-name>
          . http://www.eclipse.org/Xtext/
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>