M2M with ATL - · PDF fileM2M with ATL . 2 TDT4250 - Model ... concrete syntax defined with...

12
Meta.ppt 1 TDT4250 - Model-driven Development of Information Systems, Autumn 2009 M2M with ATL

Transcript of M2M with ATL - · PDF fileM2M with ATL . 2 TDT4250 - Model ... concrete syntax defined with...

Meta.ppt 1

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

M2M with ATL

2

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

M2M - model-to-model transformations

Preferable to M2T

allows extensive validation of transformation

easier to chain transformations

simplifies post-processing, incl. encoding

Problems

more abstract

3

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Example: Ecore-based state lang. to SCXML

Source language

defined using Ecore

concrete syntax defined with Xtext grammar (not important for

the transformation, but shows that text can also be models)

Target language

SCXML, an XML-based language defined by W3C:

http://www.w3.org/TR/2009/WD-scxml-20091029/

text-based, but has an XML Schema, so we can effectively

derive an Ecore model

Two possibilities

transform til Ecore model and serialize

transform directly to text

4

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Example: Ecore-based state lang. to SCXML

Transformation

source and target models have similar concepts

states, transitions, events, conditions, actions

some differences

internal transitions correspond to transitions without a target

enter and exit actions are modeled as internal transitions

what about and-decomposition?

implicit in the source language

explicit in SCXML: <parallel> ... </parallel>

scripting

scripts occur in events, conditions and actions

mostly support in SCXML (extension)

5

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Main elements of ATL transformations

Declare source and

target models

the actual location of models and meta-models are defined in

the launch configuration (limits validation)

Helper methods

written using OCL

side-effect-free

helper methods that are used by the rules

Rules

defines mapping between

source and target objects

6

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Rules

Three kinds

context-free rules

used by default

lazy rules

used in special cases

called explicitly

called rules

rules with parameters

called explicitly

7

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Anatomy of rules

from part

the object(s) type(s) that

this rule defines a mapping for

to part

the resulting object(s) type(s)

initialization of features (properties), expressions refer to from part

do part

imperative code (OCL, if-then-else-endif and assignment)

refers to from- and to-parts

8

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

statemachine2scxml

from (top-level) Statemachine object

to (XML) DocumentRoot and Scxml objects

DocumentRoot can hold a single Scxml object

Scxml has a set of states and an initialstate (state id)

the states are generated from a called rule

9

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

abstractState2state

from AbstractState (parameter)

to State

transitions use a default rule

onentryActions are conditionally initialized

the sub-states (parallel or states) depend on the number of initialStates

10

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

onentryVariables

from AbstractState’s variables

to Onentry object with varActions

varActions use the default rule

do part just refer to the generated object

necessary for typing reasons

11

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

initialState2initial

from State’s initialTransition

to Initial and Transition objects

Initial object contains single transition

Transition object has a target

12

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

symbolicAction2action

Lazy rule, because it needs to be called within a

special context / for special cases

from SymbolicAction

to SendAction