Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2005-2006 The ATHENA Consortium. 6-3b. Atlas Transformation Language (ATL) Tutorial / Exercise,

Similar presentations


Presentation on theme: "© 2005-2006 The ATHENA Consortium. 6-3b. Atlas Transformation Language (ATL) Tutorial / Exercise,"— Presentation transcript:

1 © 2005-2006 The ATHENA Consortium. 6-3b. Atlas Transformation Language (ATL) Tutorial / Exercise,

2 2 © 2005-2006 The ATHENA Consortium. Exercise Objective –Hands-on experience with ATL –Develop a PIM4SOA information to XSD model transformation References –The Atlas Transformation Language Home Page http://www.sciences.univ-nantes.fr/lina/atl –ATL in Eclipse http://www.eclipse.org/gmt/atl/ Technical requirements –Eclipse 3.2 –EMF 2.2.0 –ATL needs: antlr-2.7.5 mdr-standalone

3 3 © 2005-2006 The ATHENA Consortium. Transformation overview Ecore PIM4SOA meta-model ATL PIM4SOA-2-XSD XSD meta-model outputXSD modelPIM conforms to is tranformed into

4 4 © 2005-2006 The ATHENA Consortium. PIM4SOA metamodel

5 5 © 2005-2006 The ATHENA Consortium. Simple XSD metamodel

6 6 © 2005-2006 The ATHENA Consortium. The mapping mapped to

7 7 © 2005-2006 The ATHENA Consortium. The input model

8 8 © 2005-2006 The ATHENA Consortium. Create an ATL project

9 9 © 2005-2006 The ATHENA Consortium. Models and metamodels

10 10 © 2005-2006 The ATHENA Consortium. Create an ATL file

11 11 © 2005-2006 The ATHENA Consortium. ATL rules and helpers Two kind of rules –Matched rules: Declarative transormation Specify source and target Specify the way to generate target –Called rules: Imperative transformation Seen as some kind of helpers Helpers –Viewed as equivalent to Java methods –Factorized code called from different points in transformation

12 12 © 2005-2006 The ATHENA Consortium. Document2Schema rule Document2Schema{ from doc : PIM4SOA!Document to sch : XSD!XSDSchema( document <- doc.name, targetNamespace <- 'http://www.w3.org/2001/XMLSchema') }

13 13 © 2005-2006 The ATHENA Consortium. Entity2ComplexType helper context PIM4SOA!Entity def : getAssociations() : PIM4SOA!Entity = PIM4SOA!Association.allInstances() ->select(assoc | assoc.container = self); rule Entity2ComplexType{ from ent : PIM4SOA!Entity to ct : XSD!XSDComplexType( name <- ent.name, xsd_attribute <- Sequence{ent.attribute}, xsd_element <- ent.getAssociations() ) }

14 14 © 2005-2006 The ATHENA Consortium. Association2Element and Attribute2Attribute rule Association2Element{ from assoc : PIM4SOA!Association to el : XSD!XSDElement( name <- assoc.name, type <-assoc.contained) } rule Attribute2Attribute{ from att : PIM4SOA!Attribute to el : XSD!XSDAttribute( name <- att.name, type <- att.type ) }

15 15 © 2005-2006 The ATHENA Consortium. ItemType2SimpeType rule ItemType2SimpleType{ from it : PIM4SOA!ItemType( -- transform only ItemTypes and not Entities it.oclIsKindOf(PIM4SOA!Entity)= false ) to st : XSD!XSDSimpleType( name <- it.name )

16 16 © 2005-2006 The ATHENA Consortium. Run the file

17 17 © 2005-2006 The ATHENA Consortium. The result <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsd="http:///xsd">

18 18 © 2005-2006 The ATHENA Consortium. This course has been developed under the funding of the EC with the support of the EC ATHENA-IP Project. Disclaimer and Copyright Notice: Permission is granted without fee for personal or educational (non-profit) use, previous notification is needed. For notification purposes, please, address to the ATHENA Training Programme Chair at rg@uninova.pt. In other cases please, contact at the same e-mail address for use conditions. Some of the figures presented in this course are freely inspired by others reported in referenced works/sources. For such figures copyright and all rights therein are maintained by the original authors or by other copyright holders. It is understood that all persons copying these figures will adhere to the terms and constraints invoked by each copyright holder.rg@uninova.pt


Download ppt "© 2005-2006 The ATHENA Consortium. 6-3b. Atlas Transformation Language (ATL) Tutorial / Exercise,"

Similar presentations


Ads by Google