© The ATHENA Consortium. 6-3b. Atlas Transformation Language (ATL) Tutorial / Exercise,
2 © 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 –ATL in Eclipse Technical requirements –Eclipse 3.2 –EMF –ATL needs: antlr mdr-standalone
3 © The ATHENA Consortium. Transformation overview Ecore PIM4SOA meta-model ATL PIM4SOA-2-XSD XSD meta-model outputXSD modelPIM conforms to is tranformed into
4 © The ATHENA Consortium. PIM4SOA metamodel
5 © The ATHENA Consortium. Simple XSD metamodel
6 © The ATHENA Consortium. The mapping mapped to
7 © The ATHENA Consortium. The input model
8 © The ATHENA Consortium. Create an ATL project
9 © The ATHENA Consortium. Models and metamodels
10 © The ATHENA Consortium. Create an ATL file
11 © 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 © The ATHENA Consortium. Document2Schema rule Document2Schema{ from doc : PIM4SOA!Document to sch : XSD!XSDSchema( document <- doc.name, targetNamespace <- ' }
13 © 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 © 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 © 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 © The ATHENA Consortium. Run the file
17 © The ATHENA Consortium. The result <xmi:XMI xmi:version="2.0" xmlns:xmi=" xmlns:xsd="
18 © 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 In other cases please, contact at the same 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