Mia-DSL

What is it ?

Mia-Software provides Mia-Transformation, Mia-Generation and Mia-Modernization to implement your own model transformations. These products are delivered with UML metamodels (1.3, 1.4, 2.0 and 2.1).


However, if your models are expressed with your own Domain-Specific Language (DSL), Mia-DSL (ex-Mia-MetamodelFactory) is the solution to transform these models into code (with Mia-Generation) or other models (with Mia-Transformation).


Just give the definition of your DSL (expressed with MOF, eCore, DTD or XSD) to Mia-DSL and it will automaticaly integrate your DSL into Mia-Generation and/or Mia-Modernization (Mia-Transformation is based on EMF, and so does not require Mia-DSL : please refer to the Mia-Transformation manual).


Three components are generated by Mia-DSL :

  • A Java implementation of your DSL
  • A model reader to load your models into Mia-Generation or Mia-Modernization
  • A model writer to save your models from Mia-Modernization


Depending on the way you define your DSL, the generated readers and writers will read or write these formats :

  • MOF
    • XMI files compliant with the MOF description of your DSL
  • eCore
    • XMI files compliant with a MOF description of your DSL
    • EMF files compliant with the eCore description of your DSL
  • DTD
    • XMI files compliant with a MOF description of your DSL
    • XML files compliant with the DTD description of your DSL
  • XSD
    • XMI files compliant with a MOF description of your DSL
    • XML files compliant with the XSD description of your DSL

Examples

Let's say you have :

  • a DSL named MyDomain
  • a XSD file named MyDomain.xsd defining your DSL
  • a XML file named Domain1.xml compliant with this XSD


Here are three examples of what you can achieve once you have launched Mia-DSL on MyDomain.xsd :

 

  • Generate Java code from MyDomain files
    • Define MyDomain to Java generation rules with Mia-Generation
    • Load Domain1.xml into Mia-Generation
    • Apply your MyDomain to Java rules to produce Java files

     

  • Translate MyDomain files into UML models
    • Define MyDomain to UML transformation rules with Mia-Transformation
    • Load Domain1.xml into Mia-Transformation
    • Apply MyDomain to UML rules to produce UML models
    • Save the UML models in XMI format
    • Load the UML models into your UML modeler

     

  • Translate UML models into MyDomain files
    • Define UML to MyDomain transformation rules with Mia-Transformation
    • Export a UML model from your UML modeler in XMI format
    • Load the UML model into Mia-Transformation
    • Apply UML to MyDomain rules to produce a MyDomain model
    • Save the MyDomain model in XML format

Prerequisites for Standard Generation

Software

Version

Mia-Generation (with at least an evaluation developer license)

4.10.2 (or greater)

Java Development Kit

JDK 5.0 (or greater)

Prerequisites for Mia-to-EMF generation

Software

Version

Mia-Generation (with at least an evaluation developer license)

6.0.0 (or greater)

Mia-Moderrnization (with at least a full developer license)

2.0.0 (or greater)

EMF

2.1.x (or greater)

Java Development Kit

JDK 5.0 (or greater)

Prerequisites for Mia-to-DTD generation

Software

Version

Mia-Generation (with at least an evaluation developer license)

6.0.0 (or greater)

Mia-Modernization (with at least a full developer license)

2.0.0 (or greater)

Java Development Kit

JDK 5.0 (or greater)

Prerequisites for Mia-to-XSD generation

Software

Version

Mia-Generation (with at least an evaluation developer license)

6.0.0 (or greater)

Mia-Modernization (with at least a full developer license)

2.0.0 (or greater)

Java Development Kit

JDK 5.0 (or greater)

How does it works ?

The Metamodel Factory is designed to build a Java archive, which enables Mia-Software tools to deal with a metamodel you designed.
Here are the main steps for the Metamodel Generation :

  1. Define a metamodel, with a modeling tool
  2. Generate Java source files from this metamodel using the Metamodel Generator
  3. Compile and package the generated Java code
  4. Deploy a metamodel into Mia-Generation or Mia-Transformation

 

1 - Define a metamodel

The first step is to define your metamodel :

  • To use the standard generation, use a UML Case tool compatible with Mia-Generation. This can be Rational Rose, Poseidon, or any UML Case tool with an XMI export.
  • To use the EMF based generation, use Eclipse, with the EMF plug-ins.
  • DTD and XSD based generation do not require you to use a given tool. Many XML tools editors released visual or textual DTD/XSD editors. Even a notepad could do the job.

 

Here are the UML elements you can use to define a metamodel for the standard generation :

 

 

Note : the metamodel is defined using a UML Case tool for practical reasons, since almost everyone has a UML modeling tool (there are some free editions of UML modeling tools, like Poseidon CE 2.6), while MOF modeling tools are not widely available

When using a XSD file, ensure that the schema element contains the XML Schema namespace declaration, for example,

 

to top of page

 

2 - Generate Java source files

The second step is to create a Java component that will enable Mia tools to handle this new metamodel. This Java component is generated using Mia-Metamodel Factory.

 

 

The generator then generates some Java source files and configurations files. The next step is to package them into a Java archive, which is done automatically by Mia-Metamodel Factory

 

to top of page

 

3 - Compile and package the generated Java code

Mia-Metamodel Factory handles automatically the source code compilation and packaging process. However, if, for example, you wish to manually modify the source code, you can do this step manually. To do so, just run the "compile.bat" script located in the generation directory you selected.

 

 

Note that for the DTD based generator, if you need the XML connector to be included to your metamodel (required to load and/or write XML files compliant with the given DTD), please use the "compileWithXML.bat" script instead.

 

to top of page

 

4 - Deploy a metamodel into Mia-Generation or Mia-Modernization

Mia-Metamodel Factory proposes to deploy automatically the metamodel Java component. If you want to do it manually, you just need to copy the directory which contains the generated metamodel Java archive.

 

 

to top of page