<!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>Suitability of Active Rules for Model Transformation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Lingzhe Liu</string-name>
          <email>lliu@rsm.nl</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Manfred A. Jeusfeld</string-name>
          <email>manfred.jeusfeld@acm.org</email>
        </contrib>
      </contrib-group>
      <abstract>
        <p>Model transformation promises faster and higher-quality system development processes by automating certain development steps. There are numerous proposals such as QVT and triple graph grammars that are applied in practical design environments. To our surprise, active rule systems have not yet been considered as a platform to execute model transformations. We investigate in this paper the suitability of active rule systems via a case study. An empirical analysis of the complexity is provided as well. It turns out that active rules support the basic functional requirements but some extensions to their execution engine and join order optimization would be needed.</p>
      </abstract>
      <kwd-group>
        <kwd />
        <kwd>Model-driven architecture</kwd>
        <kwd>model transformation</kwd>
        <kwd>active rule</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>The model-driven architecture aims at lifting software development to a higher,
more abstract level [KWB2003]. If mappings exists that translate from a more
abstract model towards a more concrete one, then the effort would be shifted from
coding towards modeling.</p>
      <p>To realize the vision, models for all abstractions levels (specification, design,
implementation) are represented as instances of meta models, in particular
MOFbased. The state of the art of model transformation is materialized in tools based on
QVT, and on triple graph grammars (TGGs). Surprisingly, there was so far no attempt
to use active rules for the task of model transformation. The models can be
represented in an active database, and active rules can encode the transformations
between models. In particular, fine-grained incremental updates can be supported.</p>
      <p>In this paper, we investigate in more detail the suitability of active rules for the task
model transformation. In the subsequent chapter, we study the state of the art in model
transformation and establish the requirements that a solution based on active rules
should fulfill. Afterwards, a case study on realizing a UML-to-Relational-Database
mapping is presented.
2</p>
    </sec>
    <sec id="sec-2">
      <title>State of the Art</title>
      <p>Model transformation has a language aspect and a tool aspect [CH2003,CH2006].
The transformation language encodes the specification of the model transformation,
i.e. what elements should be transformed. The transformation tool provides the engine
interpreting the specification, i.e. realizes how the transformation is performed.</p>
      <p>Model-to-code transformation can be regarded as a special case of model-to-model
transformations, since models can be explicated as a linear textual representation.
Declarative approaches are contrasted to imperative approaches. The latter describe
the steps of transforming source models to target models, while the former describe
the relations between elements of the source and target models. Imperative
approaches hence amalgamate the tooling aspect with the language aspect. We pick
two declarative transformation languages to extract concrete requirements for model
transformation: QVT (query-view-transformation) and TGG (triple graph grammars).
Both languages are rule-oriented, .i.e. the transformation is specified by a set of
transformation rules.
2.1</p>
      <p>QVT-Core</p>
      <p>QVT [QVT2009,Ecl2011,JK2006,XLH*2007,Kur2008] comes in three flavors,
QVT-Relations (defining transformations as a set of relations), QVT-Core (defining
the semantics of QVT-Relations with a simpler set of language construct), and
QVTOperational (imperative flavor of QVT). We concentrate subsequently on QVT-Core.</p>
      <p>QVT-Core is multi-directional in nature. The same rule can be read in both
directions, but only if the underlying logic of the transformation is the same.
Modularity is supported by defining modules containing transformations, which
themselves contain the individual mappings. The smaller parts inherit context settings
from the larger parts. A transformation rule in QVT-Core distinguishes three areas: the
left hand side (source model), the right-hand side (target model), the middle area
(traceability objects represented as ordinary model elements). The latter maintain the
dependencies between the generated elements of the target model and the elements of
the source model(s). The transformation rule makes a test (“guard pattern”) on all
three areas, checking which elements exists, and demands in its “bottom pattern”,
which elements in the target and middle areas shall be generated for a given element
on the source side (“realized variables”). Variables are bound to elements that may
stem from different models.</p>
      <p>QVT-Core can specialize transformation rules via a refinement feature. It inherits
all mappings from the refines rule that are not overruled or removed. Moreover, there
is a nesting mechanism which binds variables at the higher level that are then used at
the nested levels.
2.2</p>
      <p>TGG</p>
      <p>Triple-graph grammars [KS2006] extend graph grammars by a middle graph that
basically represents the traceability objects between a left-hand side (LHS) and the
right hand side (RHS). Both the LHS and the RHS state dependencies between
elements of the source model(s) and elements of the target model(s). The LHS
represents the current state of the transformation, i.e. the pre-condition. The RHS
declares which elements are present after application of the rule, adding new
traceability objects and new objects in the target model, and possibly also in the
source model. Besides the test on (non-) existence of nodes and links, TGGs also
support cardinality pattern, e.g., that a node has exactly n others nodes linked to it.</p>
      <p>Since TGGs are by nature non-deterministic, the actual decision on rule execution
is done by the transformation tool [Agra2003]. Round-trip transformation with graph
grammars is supported by the Fujuba tool [GZ2005].
3</p>
    </sec>
    <sec id="sec-3">
      <title>Case Study: UML-RDBMS</title>
      <p>The complexity of the modeling language leads to complex specifications of the
model transformation. The purpose of this section is to find out whether ECA rules
scale for realistic model transformations, both in terms of specification complexity
(here: size of the specification) and the execution time. We use the ECA rule
implementation of ConceptBase for both purposes. It is in principle Turing-complete
and allows to represent models of many different modeling languages due to its
metamodeling facility.</p>
      <p>The QVT-Core example transformation UML-RDBMS [OMG 2009] is the
benchmark transformation. It consists of 366 lines of QVT-Core code to transform a
(simplified) UML class diagram to a relational schema including primary and foreign
key specifications. As QVT also employs mapping objects, they form the basis for
defining the ECA rules1. For example, consider the QVT rule packageToSchema:
map packageToSchema in umlRdbms {
uml () { p:Package }
rdbms () { s:Schema }
where () {
p2s:PackageToSchema|
p2s.umlPackage = p;
1</p>
      <p>A detailed presentation of the representation of the QVT-style mapping with ECA rules is
given in [Liu2010]. The full example including all ECA rules is online at
http://merkur.informatik.rwth-aachen.de/pub/bscw.cgi/3015942.</p>
      <p>p2s.schema = s; }
map { where () {
p2s.name := p.name;
p2s.name := s.name;
p.name := p2s.name;
s.name := p2s.name; } } }
Its representation as an ECA rules for the direction towards RDMS is:
UnmatchedPackage in QueryClass isA UPackage with
constraint
c1: $ exists name1/String
(~this name name1) and
(not (~this matchable FALSE)) and
(not exists p2s1/PackageToSchema
(p2s1 umlPackage ~this) and
(p2s1 name name1)
end</p>
      <p>)$
create_p2s_tr_s in ECArule with
mode m: Deferred
inTrans intrans : umlRdbms
nonMappingRuleFlag mf: FALSE
exedirn exedir2: SimpleRdbms {* Mapping Direction *}
ecarule
mr_p2s_s : $ p/UPackage
name1/String p2s1/PackageToSchema
tr/Transformation
ON Ask exeTrans[tr/trans] {* top level mapping *}
IF NEW (p in UPackage) and
(p in UnmatchedPackage) and
(p name name1)
DO CALL CreateIndividual(P2S,p2s1),</p>
      <p>Tell (p2s1 in PackageToSchema),
Tell (p2s1 name name1),</p>
      <p>Tell (p2s1 umlPackage p)
end</p>
      <p>$</p>
      <p>The first clause UnmatchedPackage defines an auxiliary query checking whether
the source model has not yet been mapped. The ECA rule create_p2s_tr_s uses
the tag 'IF NEW' to indicate that the condition is tested against the new database
state, i.e. including the updates done by previous ECA rule executions. The translation
of the QVT-Core specification UML-RDBMS to ECA rules required 1504 lines of
code. This includes about 400 lines of code for the specification of the meta models of
UML class diagrams and RDBMS. It should be noted that the QVT-Core rules are
bidirectional. Hence, at least two ECA rules had to be coded per QVT-Core rule. Still,
the ECA rule coding is about 4 times longer. Of the 34 ECA rules, 16 are in mode
'Deferred' and 18 in mode 'Immediate'. Additionally, 38 query classes are defined to</p>
      <p>To check the performance of the ECA
rule representation, we created five
UML class diagrams with 8, 16, 24, 32,
and 40 types (classes and associations)
and measured the transformation times.</p>
      <p>In the first run t1 (see chart on the
right), the conditions of the ECA rules
where evaluated in the order in which
they occurred.
check the structure of the source model and the current state of the model
transformation. In combination, the ECA rules support both mapping directions.
The X- axis represents the input model 5 10 15 20 25 30 35 40 45
size, the Y-axis is the transformation
time in seconds. This is almost an intractable performance with a polynomial
regression function close to O(n⁴). The reason is the lack of query optimization on the
conditions of the ECA rules. Hence, we included several optimizations strategies in
the ECA system of ConceptBase leading to the following execution times:</p>
      <p>The best variant t6
is almost linear and 35
orders of magnitude 30
better than variant t1! 25
It has a small 20 tt32
iqsudauderattoicthfea'cItForNEthWat' 1105 ttt654
construct. 5
ConceptBase uses
tabling for evaluating 0 5 10 15 20 25 30 35 40 45
derived predicates
and queries. The tabled extensions of the predicates speed up the computation.
However, when the condition is evaluated against the new database state, then the old
extension is no longer valid and has to be re-computed. This re-computation happens
for each ECA rule execution. One can expect that an incremental update of the tabled
predicate extensions would remove the small quadratic factor from the transformation
time. The transformation of an input model of size 40 requires about 7.5 seconds on a
2.4 GHz CPU. A considerable portion is due to the relatively expensive Tell operation
of ConceptBase. It maintains several indexes to store facts and each Tell includes
transformations from names to identifiers, and from identifiers to memory addresses.
Transformation Approach</p>
      <p>TGGs
LHS
LHS
RHS
(read w/ attribute
constraints)
RHS
(write w/ attribute
assignments)
graphical spec., w/
simple constraints
and assignments</p>
      <p>ECA rules
On-part and IF-part
IF-part
IF-part, QueryClass
DO-part
IF-part, assignments
in DO-part
bi-directional
unidirectional</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>The purpose of this paper was not to present yet another model transformation
approach. We rather explored the suitability of existing active rule systems to
implement model transformations. This was not investigated before. We argue that
active rules are a quite natural platform for model transformation. The main result is
that active rules are suitable for the task. The coding overhead is manageable, and
there is practically no performance penalty. From the viewpoint of active rules, the
modularity and bi-directionality are shortcomings that need to be addressed. We
believe that modularity can be defined with a suitable meta model. Bi-directionality
requires a code generation approach, e.g. generating ECA rules from a QVT-Core
specification. This is in close reach as the case study indicates.</p>
      <p>Active rules provide more expressive power than the other approaches, e.g. for
analyzing the source/target models and the current state of the transformation. The
generation of ECA rules from the more abstract QVT or TGG specification is subject
to future work. Further research shall also focus on properties like termination and
confluence of the ECA rules, and the use of metrics in mapping rules.</p>
      <p>- -
This paper is a companion paper for the demonstration of the active-rule based
model transformation at the CAiSE 2012 Forum. The active rules of the case study
are available from
They can be executed with the ConceptBase system available from</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [AH1988]
          <string-name>
            <given-names>S.</given-names>
            <surname>Abiteboul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Hull</surname>
          </string-name>
          .
          <article-title>Data Functions, Datalog and Negation (Extended Abstract)</article-title>
          .
          <source>Proc. ACM SIGMOD</source>
          , Chicago, USA,
          <fpage>143</fpage>
          -
          <lpage>153</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [AKS2003]
          <string-name>
            <given-names>A.</given-names>
            <surname>Agrawal</surname>
          </string-name>
          , G. Karsai, G.,
          <string-name>
            <given-names>F.</given-names>
            <surname>Shi</surname>
          </string-name>
          .
          <source>Graph Transformations on DomainSpecific Models. Technical Report</source>
          , Vanderbilt Univ.,
          <string-name>
            <surname>Nov</surname>
          </string-name>
          .
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [AWH1995]
          <string-name>
            <given-names>A.</given-names>
            <surname>Aiken</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Widom</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Hellerstein</surname>
          </string-name>
          .
          <article-title>Static analysis techniques for predicting the behavior of active database rules</article-title>
          .
          <source>ACM TODS 20</source>
          (
          <issue>1</issue>
          ):
          <fpage>3</fpage>
          -
          <lpage>4</lpage>
          ,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>[AFN2010] M. Arenas</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Fagin</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Nash</surname>
          </string-name>
          .
          <article-title>Composition with target constraints</article-title>
          .
          <source>Proc. ICDT'</source>
          <year>2010</year>
          , Lausanne, Switzerland, March
          <volume>20</volume>
          -22,
          <year>2010</year>
          ,
          <fpage>129</fpage>
          -
          <lpage>142</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [CLST2010]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calegari</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Luna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Szasz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Tasistro</surname>
          </string-name>
          .
          <article-title>A Type-Theoretic Framework for Certified Model Transformations</article-title>
          .
          <source>Proceedings of SBMF'2010</source>
          , Springer LNCS 6527,
          <fpage>112</fpage>
          -
          <lpage>127</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [CH2003]
          <string-name>
            <given-names>S.</given-names>
            <surname>Czarnecki</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Helsen</surname>
          </string-name>
          .
          <source>Classification of Model Transformation Approaches OOPSLA'03 Workshop on Generative Techniques in the Context of Model-Driven Architecture.</source>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [CH2006]
          <string-name>
            <given-names>S.</given-names>
            <surname>Czarnecki</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Helsen</surname>
          </string-name>
          .
          <article-title>Feature-based survey of model transformation approaches</article-title>
          .
          <source>IBM Syst. J.</source>
          ,
          <volume>45</volume>
          (
          <issue>3</issue>
          ):
          <fpage>621</fpage>
          -
          <lpage>645</lpage>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>[DGG1995] K.R. Dittrich</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Gatziu</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <article-title>Geppert: The Active Database Management System Manifesto: A Rulebase of ADBMS Features</article-title>
          . Springer, LNCS
          <volume>985</volume>
          ,
          <string-name>
            <surname>Springer</surname>
            <given-names>1995</given-names>
          </string-name>
          <source>, ISBN 3-540-60365-4</source>
          ,
          <fpage>3</fpage>
          -
          <lpage>20</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [Ecl2011]
          <string-name>
            <given-names>Eclipse</given-names>
            <surname>Foundation</surname>
          </string-name>
          .
          <article-title>Model 2 Model (M2M)</article-title>
          . Online http://www.eclipse.org/m2m/.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [GZ2005]
          <string-name>
            <given-names>H.</given-names>
            <surname>Giese</surname>
          </string-name>
          ,
          <string-name>
            <surname>A</surname>
          </string-name>
          . Zündorf (eds.).
          <source>Fujuba Days</source>
          <year>2005</year>
          . Proceedings, Paderborn, Germany,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [KWB2003]
          <string-name>
            <given-names>A.</given-names>
            <surname>Kleppe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Warmer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Bast</surname>
          </string-name>
          . MDA Explained:
          <article-title>The Model Driven Architecture: Practice and Promise</article-title>
          . Addison-Wesley:Boston,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <surname>[Jeu2009] M.</surname>
          </string-name>
          <article-title>A, Jeusfeld. Metamodeling and method engineering with ConceptBase</article-title>
          . In Jeusfeld,
          <string-name>
            <given-names>M.A.</given-names>
            ,
            <surname>Jarke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Mylopoulos</surname>
          </string-name>
          ,
          <string-name>
            <surname>J</surname>
          </string-name>
          . (eds):
          <source>Metamodeling for Method Engineering</source>
          ,
          <fpage>89</fpage>
          -
          <lpage>168</lpage>
          . The MIT Press,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [JK2006]
          <string-name>
            <given-names>F.</given-names>
            <surname>Jouault</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Kurtev.</surname>
          </string-name>
          <article-title>On the architectural alignment of ATL and QVT</article-title>
          .
          <source>Proceedings ACM Symposium on Applied Computing</source>
          , Dijon, France,
          <source>April 23-27</source>
          ,
          <year>2006</year>
          ,
          <fpage>1188</fpage>
          -
          <lpage>1195</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [Kur2008]
          <string-name>
            <given-names>I.</given-names>
            <surname>Kurtev</surname>
          </string-name>
          .
          <article-title>State of the Art of QVT : A Model Transformation Language Standard</article-title>
          .
          <source>Data Engineering</source>
          <volume>5088</volume>
          (ii):
          <fpage>377</fpage>
          -
          <lpage>393</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [Liu2010]
          <string-name>
            <given-names>L.</given-names>
            <surname>Liu</surname>
          </string-name>
          .
          <article-title>Active Rules for Model Transformation</article-title>
          .
          <source>Master thesis</source>
          . Tilburg University, The Netherlands,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          <string-name>
            <surname>[Nic1982] J.-M. Nicolas</surname>
          </string-name>
          .
          <article-title>Logic for Improving Integrity Checking in Relational Data Bases</article-title>
          .
          <source>Acta Inf</source>
          .
          <volume>18</volume>
          :
          <fpage>227</fpage>
          -
          <lpage>253</lpage>
          ,
          <year>1982</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [QVT2009]
          <article-title>Meta Object Facility (MOF) 2</article-title>
          .0 Query/View/Transformation Specification Version 1.1, Object Management Group,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [XLH*2007]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Xiong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Takeichi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Mei</surname>
          </string-name>
          .
          <article-title>Towards automatic model synchronization from model transformations</article-title>
          .
          <source>Proceedings 22nd IEEE/ACM Intl. Conf. on Automated Software Engineering.</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>