PTL: A
Model Transformation Language based on Logic
Programming
Jesus Almendros (1)
Luis Iribarne (2)
(1) Information System Group
jalmen@ual.es
http://www.ual.es/~jalmen
(2) Applied Computing Group
Luis.Iribarne@ual.es
http://www.ual.es/~liribarn
University of Almeria
04120 Almeria
SPAIN
Abstract
In this paper we present a model transformation language based on logic programming. The language, called PTL (Prolog based Transformation Language),
can be considered as a hybrid language in which ATL-style rules are
combined with logic rules for defining transformations. ATL-style rules
are used to define mappings from source models to target models while
logic rules are used as helpers. The language has been implemented so
that a Prolog program is automatically obtained from a PTL program.
Thus, PTL makes use of Prolog as a transformation engine. The encoding
of PTL programs by Prolog is based on a Prolog library for handling
meta-models. We have equipped our language with debugging and tracing
capabilities which help developers to detect programming errors in PTL
rules. Debugging detects PTL rules that cannot be applied to source
models, and tracing shows rules and source elements used to obtain a
given target model element. The proposed language can be also used for
model validation, that is, for checking pre and post conditions as well
as invariants of transformations. We have developed an Eclipse plugin
allowing edition of PTL programs, handling of models and meta-models as
well as debugging, tracing and validation.
Contents
1. PTL interpreter, Debugger and Tracer
2. Example of transformation
3. Instructions
4. Examples of models
5. Diagrams
6. Auxiliary
7. Eclipse plugin
1.- PTL interpreter, Debugger and Tracer
Source: ptl.pl
[home]
2.- Example of transformation
a) Metamodel to Entity Relationship: mm2er.ptl
b) EntityRelationship to Relational: er2rl.ptl
c) Relational to Metamodel: rl2mm.ptl
[home]
3.- Instructions
a) Install SWI-Prolog from www.swi-prolog.org.
b) Start swi-prolog.
c) Load Prolog-based ATL interpreter:
?- [ptl]
d) Call
transformation example:
?-
transform(['mm2er.ptl','er2rl.ptl','rl2mm.ptl']).
e)
Extras:
e.1) Debugging:
?-
debugging(['mm2er.ptl','er2rl.ptl','rl2mm.ptl']).
e.2)
Tracing:
?-
tracing(['mm2er.ptl','er2rl.ptl','rl2mm.ptl'],XMI_Id).
where
XMI_Id is
the XMI Id of some target element.
[home]
4.- Examples of models
XMI sources: model-A.xmi, model-B.xmi
[home]
5.- Diagrams
[home] [PNG]
[PDF]
[home] [PNG] [PDF]
[home] [PNG] [PDF]
[home] [PNG] [PDF]
[home] [PNG] [PDF]
[home] [PNG] [PDF]
[home] [PNG] [PDF]
[home]
6.- Auxiliary
a) From XMI to Metamodel: xmi2mm.pl
b) From
Metamodel to XMI: mm2xmi.pl
c) Loading
of
XMI files: loading.pl
d) Writing
of
XMI files: writing.pl
[home]
7.- PTL Eclipse plugin
To install the Eclipse plugin:
1. Install SWEProlog from http://www.swi-prolog.org.
2. Download Eclipse plugin: [PTL plugin]
3. Unzip the file and copy the content into the "features" and "plugin" folders.
4. Configure PTL interpreter in Eclipse preferences.
5. Create a "Transformation tool" project in Eclipse.
6. Create source code in folder "Transformers".
7. Run transformation, debugger, tracer and validator from Menu.
[home]
(c) Jesús Almendros and Luis Iribarne
University of Almeria, 2013
Department of Informatics
Almeria, Spain