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

VIATRA2/Case Studies

< VIATRA2
Revision as of 09:28, 9 June 2008 by Kovmate.gmail.com (Talk | contribs) (VIATRA2 Examples)

VIATRA2 Examples

Importer of a Simple XML-based Language

Introduction

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.

There are two essential components of an importer:

  • 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.
  • 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.


Example: Car workflow importer

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.


Fig.1 The graphical concrete syntax of the language.


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.

Fig.2 The XML notation of the workflow.

The XML representation of the example workflow can be seen on Fig. 2. We have one <carworkflow> . The carworkflow describes the activities of the drivers of two <car>s. The <activity>(ie's) attributes also define the additional attributes.

File:Cwf xsd.png
Fig.3 The XSD Schema definition of the language.


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).

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.

Back to the top