XQuery as Model Transformation Language


Jesus Almendros  (1)
Luis Iribarne
(1)
Jesus J. Lopez-Fernandez (2)
Angel Mora-Segura (2)



(1)  Department of Informatics
University of Almeria
SPAIN
 

(2)  Escuela Politecnica Superior
Universidad Autonoma de Madrid
SPAIN




Abstract


XQuery is a programming language designed for querying XML documents. XQuery can be used, in particular, for transforming XML documents. Model Driven Engineering is an emerging approach for software development and it emphasizes the construction of models from which the implementation is derived  by applying model transformations. Most of languages for describing models (UML, BPM, Petri Nets, WebML, etc) have an XML-based representation (XMI, XPDL, PNML, IFML, etc). Thus XQuery can be used for describing transformations in many modeling languages.  In this paper we propose a framework for model transformation in XQuery. Our proposal aims to provide the elements for using XQuery as transformation language. With this aim, our framework provides a mechanism for automatically obtaining  an XQuery library for a given meta-model. Meta-models are defined as XML schemas, and the XQuery library serves to query and create elements of an XML Schema. Transformations abstract from XML representation, in the sense of, elements from meta-models are encapsulated by XQuery functions.  We have also studied how to use our framework for model validation. Source and target models are validated by considering pre and post conditions on transformations, and transformations are validated by considering invariants. The framework has been tested with a case study of transformation in UML, where the XML-based representation of models is achieved by the standardized language XMI.




Contents


1. Generator of XQuery libraries from XML-Schemas
2. Example of transformation
3. Instructions
4. Diagrams
5. Model Validator
6. Material


[home]





1.- Generator of XQuery libraries from XML-Schemas



Sources:

generator.xq
generator_test.xq
createLib.xq
readLib.xq


[home]





2.- Example of transformation



a) Metamodel to Entity Relationship: mm2er.xq

b) EntityRelationship to Relational: er2rl.xq

c) Relational to Metamodel: rl2mm.xq


[home]





3.- Instructions



The following instructions concern to the case study of the paper.

a) Install BaseX from
www.baseX.org.

b) Start baseX.

c) Download models, meta-models and libraries (see below).

d) Load and execute the following files:

- mm2er.xq

- er2rl.xq

- rl2mm.xq
           


[home]






4.- Diagrams




[home] [PNG] [PDF] [XMI]




[home] [PNG] [PDF] [XMI]




[home] [PNG] [PDF] [UML-XSD] [XMI-XSD] [MM-XSD] [UML-XQ] [XMI-XQ] [MM-XQ]



[home] [PNG] [PDF] [XSD] [XQ]



[home] [PNG] [PDF] [XSD] [XQ]





[home]






5.- Model Validator

        
  
a) XML Schema Validator: validator.xq


b) Semantic Validator: verification.xq


 


[home]








6.- Material

        

XTL.zip
  



[home]






Jesus Almendros
Luis Iribarne
Jesus J. Lopez-Fernandez
Angel Mora-Segura