ATLAS - PowerPoint PPT Presentation

About This Presentation
Title:

ATLAS

Description:

ATLAS Atlas Transformation Language Thiago Ara jo ATLAS Language Transformation Hybrid Programming Language Declarative (preferred style ) Imperative (to ease ... – PowerPoint PPT presentation

Number of Views:94
Avg rating:3.0/5.0
Slides: 39
Provided by: Jacqu139
Category:

less

Transcript and Presenter's Notes

Title: ATLAS


1
ATLAS Atlas Transformation Language
  • Thiago Araújo

2
Introduction
  • Welcome Eclipse M2M Project
  • Subproject by Eclipse Modeling Project (orthers
    EMF, GMF).
  • ATLAS group LINA INRIA Nantes
  • answer to the OMG MOF/QVT RFP
  • ATL
  • Model Transformation Language (core of MDA)?
  • Toolkit ATL Integrated Environment (IDE) over
    Eclipse Platform

3
ATLAS Language Transformation
  • Hybrid Programming Language
  • Declarative (preferred style )?
  • Imperative (to ease the specification hard
    mapping)?
  • ATL transformation program
  • composed of rules
  • Besides basics model transformation
  • model querying facility
  • definition of ATL libraries

4
Overview MDA in ATL
  • Models
  • First class entities
  • Model handling
  • Transformation Model
  • Conform to Metamodel and MetametaModel
  • Defining the semantic of Models e MetaModels
  • ATL engine support
  • MOF 1.4
  • Ecore
  • ATL MetaModel
  • MOF

5
Overview ATL Transformation Example Author2Person
6
Overview ATL
  • Kind of ATL units, with .atl extension
  • ATL modules
  • ATL queries
  • ATL libraries

7
ATL Module
  • Model to transformation model
  • Fixed number of source and target models
  • Structure
  • Header
  • Define name, sources and target models
  • Import
  • Import libraries ATL
  • set Helpers
  • Equivalent a java methods
  • Contains
  • Name, context type, return, ATL expression,
    optional set parameters
  • Helpers attributes

8
Rules of Modules
  • Matched Rules
  • Declarative form
  • Keywords
  • rule
  • Sources, Targets
  • using local variables
  • from source patterns, filters
  • to target models, initialization bindings
  • do imperative code after initialization

9
Rules of Modules
  • Called Rules
  • Facilities from imperative programming
  • Particular type of helpers
  • Opposed helpers generate target model elements
  • Not include source pattern, no have from

10
Module execution modes
  • Normal execution mode
  • Default execution
  • target models differ from the source ones
  • explicit specifications
  • Refining execution mode
  • transformations between similar models
  • Element implicitly copied
  • Module with keyword refine
  • Actually only single sources and targets models

11
Module execution semantics
  • Default mode
  • Tree phases
  • module initialization
  • matching sources
  • initialization targets
  • Refining mode
  • too Tree phases
  • Difference appears in initialization phases
  • allocation and initialization implicitly
    generated

12
ATL QUERY and LIBRARY
  • ATL Query
  • Compute primitive type from set sources models
  • Generation of a textual output
  • May include helpers and attributes
  • ATL Library
  • Define set helpers
  • May include import
  • Exists no default module element
  • Cannot be executed independently

13
ATL Language
  • Based on OMG OCL
  • Data types , Declarative expression
  • Data Types

14
Data Types Operations
  • OCLType operation
  • allInstances()?
  • OCLAny operation
  • oclIsUndefined()?
  • oclIsKindOf(toclType)?
  • oclIsTypeOf(toclType)?
  • toString()?
  • oclType()?
  • asSequence(), asSet(), asBag()
  • output(s String)?
  • debug(s String)?
  • refSetValue(name String, val oclAny)?
  • refGetValue(name String)?
  • refImmediateComposite()?
  • refInvokeOperation(opName String, args
    Sequence)?

15
ATL Module and Primitive data types
  • ATL Module
  • ATL unit
  • single instance
  • refer thisModule
  • access helpers and attributes
  • resolveTemp
  • Primitives (based in OCL)?
  • Boolean
  • Integer
  • Real
  • String
  • Additional functions for assist ATL queries
  • writeTo(fileName String), println()?

16
Collection Data Types
  • Handler Collection of elements
  • Collections
  • Set, OrderedSet, Bag and Sequence
  • Syntax
  • collection_type(element_datatype)?
  • collection_typeelements
  • Common operations
  • size(), includes(ooclAny), excludes(ooclAny),
    count(ooclAny), includesAll(cCollection),
    excludes(cColection), isEmpty(), notEmpty()?
  • asBag(), asSequence(), asSet()?
  • Sequence additional operations
  • union(cCollection), flaten(), append(ooclAny),
    prepend(ooclAny)?
  • insertAt(nInteger,ooclAny), subSequence(lowerIn
    teger,upperInteger)?
  • a(nInteger), indexOf(ooclAny), first(),
    last(),including(ooclAny),
  • excluding(o oclAny)?

17
Collection's operations
  • Set data type operations
  • union(cCollection), intersection(cCollection),
    operator (sSet)?
  • including(ooclAny), excluding(ooclAny),
    symetricDifference(sSet)?
  • OrderedSet data type
  • append(ooclAny), prepend(ooclAny),
    insertAt(nInteger,ooclAny)?
  • subOrderedSet (lowerInteger, upperInteger),
    at(nInteger)?
  • indexOf(ooclAny), first(), last()?
  • union(cCollection), flatten(),
    including(ooclAny), excluding(ooclAny)?
  • Bag data type operation
  • Operations defined by OCL specification are nor
    available

18
Iterating over Collection
  • Accept Expression
  • Syntax
  • source-gtoperation_name(iterators body)?
  • Iterative expressions
  • exists(body)?
  • forAll(body)?
  • isUnique(body)?
  • any(body)?
  • one(body)?
  • collect(body)?
  • select(body)?
  • reject(body)?
  • sortedBy(body)?
  • Not support multiple iterator
  • Operator iterator()
  • source-gtiterate(iterator, variable_declaration
    init_exp body)?

19
Examples Operations on Collections
  • testing whether a set contains an element Set1,
    2, 3-gtincludes(1)?
  • evaluates to true
  • computing the union of two sequences Sequence1,
    2, 3-union(Sequence7, 3, 5)?
  • evaluates to Sequence1, 2, 3, 7, 3, 5
  • flattening a sequence of sequences
    SequenceSequence1, 2, Sequence3, 5, 2,
    Sequence1-gtflatten()?
  • evaluates to Sequence1, 2, 3, 5, 2, 1
  • collecting the names of all MOF classes
  • MOF!Class.allInstances()-gtcollect(e e.name)?
  • checking whether all the numbers in a sequence
    are greater than 2 Sequence12, 13,
    12-gtforAll(i i gt 2)?
  • o evalutes to true
  • computing the sum of the positive integer of a
    sequence using the iterate instruction Evaluates
    to 12

20
Enumeration and Tuples data types
  • Enumeration
  • Is a oclType
  • Defined in target or source model
  • Access enumeration value
  • Tuples
  • Not named
  • Full declaration required
  • Composite values
  • Each part an OCLType
  • Order not significant
  • Sintaxe
  • Tuplevar_name1 var_type1? init_exp1, ...,
    var_namen var_typen? init_expn
  • Example
  • Tupletitle 'ATL Manual', a anAuthor, editor
    'ATL Eds.'

21
Map data type
  • Not belong OCL
  • Not named
  • Full declaration required
  • Example
  • Map(Integer, MMAuthor!Author)?
  • Map(0, anAuthor1), (1, anAuthor2)
  • Common method
  • get(key oclAny)?
  • including(key oclAny, val oclAny)?
  • union(m Map)?
  • GetKeys()?
  • getValues()?

22
Model element data type
  • Defined within source and target metamodels
  • Metamodels usually define a number of different
    model elements( Class)
  • Notation metamodel!class
  • Handle several metamodel at once.
  • Generated by rules
  • Example
  • Getting the names of all primitive MOF types the
    simple way
  • MOF!PrimitiveType.allInstances()-gtcollect(e
    e.name)?

23
ATL Comments
  • 2 hyphens "--" and end at the end of the line.
  • Example
  • -- this is an example of a comment

24
OCL Declarative Expressions
  • Structure OCL code
  • Advanced declarative expressions
  • If-then-else-endif
  • Else clause can not omitted
  • Syntax

25
OCL Declarative Expressions
  • Let
  • definition variables
  • Syntax
  • let var_name var_type var_init_exp in exp
  • Useful debugging stage
  • Uses examples
  • let firstElt Real aSequence-gtfirst() in
    firstElt.square()

26
Expressions tips tricks
  • Evaluation mode OCL expression boolean
  • Opposed common programming language

27
ATL Helpers
  • Methods
  • Defined in Context
  • Context may omitted
  • Body OCL expression
  • Example
  • Attributes
  • Constants
  • accepts no parameter

28
ATL Helpers
Sintaxe
Example
29
Limitations of Helpers and Attributes
  • Signature
  • Helper name
  • Helper context
  • Not may define helpers in context collection type
  • Library unit
  • Not may helpers attributes

30
ATL Rules
  • Model elements achieved transformation rules
  • kinds of transformation rules
  • Mached rules
  • Match some of the model elements of a source
    model, and to generate from them a number of
    distinct target model elements
  • Called rules
  • Invoked from an ATL imperative block in order to
    be executed.

31
ATL imperative code
  • Imperative code matched or called rules
  • Statements
  • assignment statements
  • If
  • For
  • Not be used in ATL declarative code.

32
Statements if and for
  • ifSyntax
  • ifExample
  • forSyntax
  • forExample

33
Matched Rules
  • Convenient transformation
  • Enables to specify
  • Which source model element must be matched
  • He number and the type of the generated target
    model elements
  • The way these target model elements must be
    initialized from the matched source elements

34
Matched Rule Syntax
35
Matched Rule
  • Source pattern (FROM)?
  • Specifies the type of the source model elements
    that will be matched
  • Condition enable to target a subset of the
    transformation source model elements that conform
    to the source type
  • Local variables section (USING)?
  • Variables useds in to and do sections
  • Simple target pattern element (TO)?
  • Contains target pattern elements
  • Specified as a set of bindings

36
Matched Rule
  • Iterative target pattern element
  • Generate a set of target model elements
    conforming to a same type
  • Keyword distinct
  • Produces a target model element for each element
    belonging to a given reference ordered
    collection
  • Foreach
  • Imperative block section (DO)?
  • Sequence imperative statements
  • Initialize model elements features

37
Called Rules
  • Explicitly generate target model elements from
    imperative code
  • Entrypoint
  • has no from section

38
ATL Query
  • Query unit accepts sources modules and produces a
    single return value
  • Syntax query query_name exp
  • OCL expression
  • ATL IDE StringValue.writeTo()
Write a Comment
User Comments (0)
About PowerShow.com