AMW Use Case - Data mapping between relational database and XML

AMW Logo

This use case presents a weaving model that captures the relationships between a metamodel with flat structures and foreign keys relationships (representing a relational database) and a metamodel that contains nested structures (representing an XML base).


The data mapping between relational databases and XML documents is a typical problem in many organizations. We illustrate this data mapping problem using two simple library metamodels (as shown below). The metamodel of Library 1 contains two flat tables that are related by foreign key constraints. The metamodel of Library 2 contains also nested relationships between their elements (Books and Subjects). The objective is to execute the data translation between models conforming to these two metamodels.

RDBMS and XML metamodels

We define a metamodel extension that enables to create declarative links between these metamodels. The metamodel (dbtoxmlweavingmm.km3) can be downloaded in the Zoo of weaving metamodels. This metamodel extension is loaded in the AMW plug-in to create a weaving model between Library 1 and Library 2 metamodels. This weaving model is illustrated in the figure below (in the middle panel). It shows the model elements that are designed with a vocabulary specific to the problem domain (e.g., FK, Nested, Child, etc.).

Weaving model in the AMW plug-in

The weaving model (Mw) is used as specification to produce transformation models (see the Figure below). The weaving model is completely independent of the output transformation metamodel. This enables to produce transformations in different target languages, such as ATL, XSLT, or SQL-like languages. The transformation models are extracted to the corresponding concrete syntax. The output transformation performs the data mapping between the two libraries.

A single weaving model is used to produce different transformation models

Download and examples


This example implements a weaving model that defines the relationships between a simple relational metamodel and a XML metamodel. The weaving model is used to produce ATL transformations.

Example HowTo

This document contains step-by-step instructions explaining how to execute the example.


The publication titled "Applying Generic Model Management to Data Mapping" presents the conceptual basis of the approach and how it is applied to generic data mapping problems. It uses the "DB to XML" scenario for the experimental validation.

Related use cases


Matching is the generic process that creates weaving models. This use case gives a general overview of the matching process, and how it is handled by AMW and ATL.

Tool interoperability

This use case shows how weaving models are used to capture the semantic heterogeneities between different tools' metamodels. We use two well known bug tracking tools, Mantis and Bugzilla.

Metamodel comparison

This use case demonstrates how weaving models are used to compare different metamodels and to produce executable model transformations (we use two metamodels used to define embedded software in the avionics industry).

Bridge between SQL and KM3

This use case shows how weaving models and model transformations are used to translate SQL-DDL (Data Definition Language) into KM3 (a modeling technical space) and to translate KM3 into SQL.

Merge of geographical information (GML) and statistical data

This use case presents a weaving model used to define a merge operation between a metamodel with geographical information (an extension of GML) and a metamodel with statistical data into a graphical representation (SVG).

System Architecture (SA) management

This use case shows how to map the overlapping concepts of different views of a complex system. It uses a System Architecture (SA) framework called DoDAF (Department of Defense Architecture Framework).