Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "VIATRA2/Case Studies"

(The Importer)
(23 intermediate revisions by 12 users not shown)
Line 1: Line 1:
= VIATRA2 Examples =
+
= Hello world =
  
== Importer of a Simple XML-based Language ==
+
We created a full-fledged solution for the Hello World case at TTC 2011, which focused on providing a set of simple tools that can be used for introducing new users to transformation tools and languages.
  
=== Introduction ===
+
* Problem description at [http://rvg.web.cse.unsw.edu.au/eptcs/paper.cgi?TTC2011.4 EPTCS]
 +
* Solution description at [http://rvg.web.cse.unsw.edu.au/eptcs/paper.cgi?TTC2011.25 EPTCS]
 +
* Demonstrator: [http://is.ieis.tue.nl/staff/pvgorp/share/?page=LookupImage&vdiNameSearch=viatra SHARE]
  
There is a third party editor given, which can export into an XML file. We need to represent this model in the [[VIATRA2 Model Space]]. Native importers are used to create models in the model space of VIATRA2. This example shows how to build an importer that can instantiate a model in the model space based on a file.
+
= Simple Examples =
  
There are two essential components of an importer:
+
* [[VIATRA2/Activity Diagrams to Petri Nets |Transforming UML Activity Diagrams into Petri Nets]]
* '''A metamodel''' : The metamodel describes the language, which we want to create an importer for. The metamodel can be regarded as a representation of the language's abstract syntax.  
+
This tutorial example presents a transformation from a core subset of UML2 Activity Diagrams to the domain of Petri-nets (also known as Place/Transition Nets). The example is meant to be the first one to read after completing the Hello World tutorial. As an important point, the tutorial includes an exercise for readers, to help them learn transformation development.  
* '''An importer plug-in''' : This is the implementation of the importer. Its basic task is to explore the input file, and instantiate the elements of the metamodel accordingly.
+
  
 +
* [[VIATRA2/Native importer creation |Importing a simple XML file (Car workflow)]]
 +
This example explains how to create a VIATRA2 native importer for a simple XML-based modeling language. The importer is used to read your files, and produce VIATRA2 models in the model space so that you can create transformations for your language.
  
=== Example: Car workflow ===
+
* [[VIATRA2/Examples/Generating Axis2 Configuration | Generating Axis2 configuration from UML4SOA models]]
  
The example we would like to use as the pilot example is a workflow description language. A file describes the activities of drivers of cars in a scenario. So we have the participants (the drivers), and the timeline. This workflow however, does not cope with use decisions along the scenario, only a sequential execution of activities is possible extended with concurrency. Hence, it is basically an interval editor. Each interval represents an activity.  
+
This example shows an usage of VIATRA2 for web service configuration generation. It uses an extended UML format which is capable to model services. The  transformations generate web service stubs, security configuration and reliability configuration from the model for Axis2 platform.
  
 +
* [[VIATRA2/Examples/performability analysis | Model-driven performability analysis]]
 +
This example demonstrates a method for the performability analysis of service configurations with reliable messaging.
  
[[Image:cwf.png|frame|Fig.1 The graphical concrete syntax of the language.]]
+
* [[VIATRA2/Examples/MTBE | Model transformation by example]]
 +
This short review demonstrates the usage of the VIATRA2 framework to realize a new approach that can derive model transformation rules from an initial prototypical set of interrelated source and target models, which describe critical cases of the model transformation problem in a purely declarative way.
  
 +
* [[VIATRA2/Examples/FamiliesToPersons | Families to Persons transformation]]
 +
This transformation creates the [[ATL/Tutorials_-_Create_a_simple_ATL_transformation | FamiliesToPersons transformation of ATL]] recreated in VIATRA2. The transformation program is the work of Tassilo Horn, University of Koblenz-Landau.
  
Fig. 1 represents a possible graphical concrete syntax of the language.This example has two participants, John Doe and Jane Doe. They are having a chat conversation from 12:00 till 12:09. Meanwhile Jane listens to a song, and John goes on listening the radio.
+
= Detailed examples =
  
[[Image:cwf_xml.png|frame|Fig.2 The XML notation of the workflow.]]
+
* [[VIATRA2/Model based development of AJAX user interfaces | Model based development of AJAX user interfaces]]
 +
A complete example covering model building, manipulating and code generation workflow applicable to XML-like languages.
  
The XML representation of the example workflow can be seen on Fig. 2. We have one <tt> <carworkflow> </tt>. The carworkflow describes the activities of the drivers of two <tt> <car></tt>s. The <tt><activity></tt>(ie's) attributes also define the additional attributes.
+
* [[VIATRA2/Ecore2Genmodel | Transforming EMF Ecore models to GenModel]]
 +
A complete example detailing the TTC 2010 Ecore2GenModel case study solution.
  
[[Image:cwf_xsd.png|frame|Fig.3 The XSD Schema definition of the language.]]
+
* [[VIATRA2/BPELVerif | Verification of BPEL processes]]
 +
A complete example covering the generation of SAL representations of single BPEL processes.
 +
 +
* [[VIATRA2/BPELCoop | Verification of cooperating BPEL processes]]
 +
A complete example detailing the generation of SAL representations of abstracted BPEL process cooperations.
  
 +
= SHARE images for Transformation Tool Contests =
  
Fig. 3 shows the XSD representation of the language. Based on the XSD definition of the language the metamodel can easily be written (See Fig.4).
+
VIATRA2 has participated in numerous transformation tool contests (GraBaTs, TTC series). The "executable paper" environment [http://is.ieis.tue.nl/staff/pvgorp/share/?page=Home SHARE] hosts immediately reproducible versions of these solutions, in the form of fully prepared virtual machine images. Request a session on [http://is.ieis.tue.nl/staff/pvgorp/share/?page=LookupImage&vdiNameSearch=viatra one of the VIATRA2 images] to see our tool in action!
 
+
[[Image:cwf_vtml.png|frame|Fig.4 The metamodel of the language in the syntax of the VIATRA2 Textualt Metamodeling Language.]]
+
 
+
The usual way of creating a metamodel based on an XSD schema: First complex types should be identified by entities in VIATRA2. For the representation of containment relations and cross references between XML tags we have multiple options. Here simple relations are only used. However, for the containment a good idea could be to derive them from a containment supertype. So to represent that a car workflow has cars as containmnet simply a relation is used. In this simple example attributes are similarly handled. The line <tt>relation(application,activity,String)</tt> indicates that an entity the type of whom is activity may have a reference to an application.  
+
 
+
Please note the following:
+
* In the metamodel attributes and containments are not distinguished. If it is needed however, many solutions exist. One possible is that we define two supertypes, one for the containment, the other for the attributes. In order to do that most probably, XML tags and attributes also need supertypes.
+
* The names of entities are recommended to be identical with the names of the complex types in the Schema. The names of the relations should reflect the names of entities the actual complex type may contain. This makes the build of the importer easier, and more maintainable.
+
 
+
 
+
=== The Importer ===
+
 
+
Once the metamodel is ready, the importer has to be written. In order to write an importer the Eclipse extension point <tt>hu.bme.mit.viatra.core2.modelimport</tt> has to be extended. The extension point should refer to a class implementing the interface <tt>hu.bme.mit.viatra.imports.NativeImporter</tt>. The schema of the interface is the following:
+
<tt>
+
  package hu.bme.mit.inf.hidenets.eval.plugin.carwfimporter;
+
  import java.io.InputStream; 
+
  import hu.bme.mit.viatra.errors.VPMRuntimeException;
+
  import hu.bme.mit.viatra.framework.IFramework;
+
  import hu.bme.mit.viatra.imports.NativeImporter;
+
 
+
  public class CarWorkflowImporter implements NativeImporter {
+
 
+
  public void process(InputStream f, IFramework fw)
+
  throws VPMRuntimeException {
+
  }
+
 
+
  public void processFile(String f, IFramework fw)
+
                        throws VPMRuntimeException {
+
  }
+
  }
+
</tt>
+
 
+
The framework is going to call the method <tt>processFile</tt>. It is recommended to create an <tt>InputStream</tt> of the file and then call the <tt>process</tt> method. So the relevant part of the importer should be placed into the method <tt>process</tt>.
+
The outline of an importer (the <tt>process</tt> method) like this:
+
 
+
Get the <tt>IModelManager</tt> interface like this: <tt>IModelManager mm = fw.getTopmodel().getModelManager();</tt>
+
 
+
Get the meta elements (elements of the viatra metamodel) from the modelspace:
+
E.g.:<tt>IEntity META_car = mm.getEntityByName(<fully qualified name of the entity as string>)</tt> for all the entities.
+
E.g.:<tt>IRelation META_car_activity = mm.getRelationByName(<fully qualified name of the relation>)</tt> for all the relations.
+
 
+
Explore the input model. E.g. make a DOM tree and do a depth first search. Every time an element is reached it has to be instantiated in the VIATRA2 model space also like this:  
+
  <tt>
+
  IEntity vCar = mm.newEntity("car",value,vCarWorkflow);
+
  mm.newInstanceOf(META_car,vCar);
+
  </tt>
+
The first argument is the name of the
+
entity in the modelspace. Most of the time irrelevant.
+
value is a String which is going to be the value of the
+
new entity. Presuming that the car workflow entity has
+
already been instantiated,we give it as container.
+
 
+
'''VERY IMPORTANT:''' from the modeling point of view the container of the new entity is also irrelevant. Pattern matching for VIATRA2 containment is not recommended. Containment from the point of view of the model is going to be represented with the appropriate relations. The VIATRA2 containment helps to organize the model space so that it remains comprehensible.
+
Also don't forget the second line: declare that the new entity has the type of car.
+
 
+
Now the relation has to be instantiated that represents the XML containment in our model:
+
  <tt>
+
  IRelation vCarWorkflow_car = mm.newRelation("carworkflow_car",vCarWorkflow,vCar);
+
  mm.newInstanceOf(META_CarWorkflow_car,vCarWorkflow_car);
+
  </tt>
+
Running these steps in a recursive manner is going to create a tree reflecting the XML tree.
+
 
+
However, in the XML there are usually crossreferences between the tags like the <tt>target</tt> attribute of the tag <tt>activity</tt>. There is another phase needed for resolving these after the containment tree is ready. The simplest way to do it is to put all entities into a HashMap with the key how they are referenced. When the references are resolved we just instantiate relations like the one above.
+
 
+
 
+
[[User:Kovmate.gmail.com|Kovmate.gmail.com]] 09:54, 9 June 2008 (EDT)
+

Revision as of 10:45, 21 January 2014

Hello world

We created a full-fledged solution for the Hello World case at TTC 2011, which focused on providing a set of simple tools that can be used for introducing new users to transformation tools and languages.

  • Problem description at EPTCS
  • Solution description at EPTCS
  • Demonstrator: SHARE

Simple Examples

This tutorial example presents a transformation from a core subset of UML2 Activity Diagrams to the domain of Petri-nets (also known as Place/Transition Nets). The example is meant to be the first one to read after completing the Hello World tutorial. As an important point, the tutorial includes an exercise for readers, to help them learn transformation development.

This example explains how to create a VIATRA2 native importer for a simple XML-based modeling language. The importer is used to read your files, and produce VIATRA2 models in the model space so that you can create transformations for your language.

This example shows an usage of VIATRA2 for web service configuration generation. It uses an extended UML format which is capable to model services. The transformations generate web service stubs, security configuration and reliability configuration from the model for Axis2 platform.

This example demonstrates a method for the performability analysis of service configurations with reliable messaging.

This short review demonstrates the usage of the VIATRA2 framework to realize a new approach that can derive model transformation rules from an initial prototypical set of interrelated source and target models, which describe critical cases of the model transformation problem in a purely declarative way.

This transformation creates the FamiliesToPersons transformation of ATL recreated in VIATRA2. The transformation program is the work of Tassilo Horn, University of Koblenz-Landau.

Detailed examples

A complete example covering model building, manipulating and code generation workflow applicable to XML-like languages.

A complete example detailing the TTC 2010 Ecore2GenModel case study solution.

A complete example covering the generation of SAL representations of single BPEL processes.

A complete example detailing the generation of SAL representations of abstracted BPEL process cooperations.

SHARE images for Transformation Tool Contests

VIATRA2 has participated in numerous transformation tool contests (GraBaTs, TTC series). The "executable paper" environment SHARE hosts immediately reproducible versions of these solutions, in the form of fully prepared virtual machine images. Request a session on one of the VIATRA2 images to see our tool in action!

Back to the top