ATL Reference Manual

30
ATL: Atlas Transformation Language Reference Manual - version 0.09 - 2005 by ATLAS group LINA & INRIA Nantes

description

Manual ATL

Transcript of ATL Reference Manual

ATL: Atlas Transformation Language Reference Manual - version 0.09 - 2005 by ATLAS group LINA & INRIANantes Content 1Introduction....................................................................................................................... 1 1.1QVT................................................................................................................................ 1 1.2ATL and QVT................................................................................................................ 1 1.3OCL................................................................................................................................ 1 1.4Objectives and Rationale................................................................................................ 1 2Grammar............................................................................................................................ 1 2.1Context-Free Grammar .................................................................................................. 1 2.2Grammar Notation.......................................................................................................... 2 3Lexical Structure ............................................................................................................... 2 3.1Encoding......................................................................................................................... 2 3.2Lexical Translations ....................................................................................................... 3 3.3Unicode Escapes ............................................................................................................ 3 3.4Line Terminators ............................................................................................................ 3 3.5Input Elements and Tokens ............................................................................................ 4 3.6White Space.................................................................................................................... 4 3.7Comments....................................................................................................................... 4 3.8Identifiers ....................................................................................................................... 4 3.9Keywords ....................................................................................................................... 5 3.10Separators ....................................................................................................................... 6 3.11Operators ........................................................................................................................ 6 3.12Infix Operators ............................................................................................................... 6 4Data Model ........................................................................................................................ 7 4.1OclAny ........................................................................................................................... 7 4.2Model Elements.............................................................................................................. 7 4.3Primitive Types .............................................................................................................. 8 4.3.1The Boolean Type .................................................................................................. 8 4.3.2The String Type...................................................................................................... 9 4.3.3Numeric Types ....................................................................................................... 9 4.4Collections.................................................................................................................... 11 4.4.1Set......................................................................................................................... 12 4.4.2OrderedSet............................................................................................................ 13 4.4.3Bag ....................................................................................................................... 14 4.4.4Sequence............................................................................................................... 15 4.4.5Iterator Expressions.............................................................................................. 16 4.5Tuples ........................................................................................................................... 18 4.6Enumerations................................................................................................................ 18 5ATL Programs................................................................................................................. 18 5.1Modules........................................................................................................................ 18 5.1.1Header Section ..................................................................................................... 19 5.1.2Import Section...................................................................................................... 19 5.2Queries ......................................................................................................................... 19 5.3Libraries ....................................................................................................................... 19 6OCL Expressions............................................................................................................. 20 6.1The If Expression ......................................................................................................... 20 6.2The Let Expression....................................................................................................... 20 7Helpers ............................................................................................................................ 20 8Declarative Rules ............................................................................................................ 21 9Imperative Constructs ..................................................................................................... 22 10Execution Semantics ....................................................................................................... 22 I.References ....................................................................................................................... 24 ATL User Manual 1Introduction ATL,theAtlasTransformationLanguage,istheATLASINRIA&LINAresearchgroup answertotheOMGMOF[5][6]/QVTRFP[6].Itisamodeltransformationlanguage specifiedbothasametamodelandasatextualconcretesyntax.Itisahybridofdeclarative andimperative.Thepreferredstyleoftransformationwritingisdeclarative,whichmeans simplemappingscanbeexpressedsimply.However,imperativeconstructsareprovidedso thatsomemappingstoocomplextobedeclarativelyhandledcanstillbespecified.AnATL transformationprogramiscomposedofrulesthatdefinehowsourcemodelelementsare matched and navigated to create and initialize the elements of the target models.1.1QVT QVT is an acronym for Query, View and Transformation. This is how they are described in QVT RFP [6]: Queries take as input a model, and select specific elements from that model. Views are models that are derived from other models. Transformations take as input a model and update it or create a new model. 1.2ATL and QVT ATLsupportsQVTqueries,QVTviewsandQVTtransformations.Nevertheless,thereare some minor differences. ATL programs perform queries and transformations. Since views are modelsandATLprogramstakemodelsasinputand,ingeneral,producemodelsasoutput, views are a specific case of the input or of the output of ATL programs.TherearetwokindsofexecutableATLprograms,namelymodulesandqueries.Modules transformmodelstomodelswhilequeriesdomodelstotexttransformations.Finally,ATL supports libraries which allow defining repetitive pieces of code in one place.1.3OCL ATLisbasedonOCL[7],theObjectConstraintLanguage.ATLsupportsOCLexpressions (see chapter 6) and it has a type model (see chapter 4) that is very similar to the one of OCL.1.4Objectives and RationaleTheobjectiveofATLisatransformationlanguagethatontheonehandisclosetothe standardsandontheotherhandverypowerfulandeasytouse.Arichsetoftoolshasbeen built for ATL development [1] under Eclipse. TheJavaLanguageSpecification[3]isagoodandwell-knownexampleofalanguage specification. For this reason, the specification in this ATL Reference Manual is based on it. It contains a similar document structure and uses the same context-free grammar. 2Grammar To describe ATL, an EBNF-like context-free grammar has been chosen. 2.1Context-Free Grammar Context-freegrammarsareacommonwaytodescribecomputerlanguages.Context-free grammars consist of production rules. These have an abstract symbol called a nonterminal on their left-hand side. On their right hand side they have a sequence of nonterminal and terminal symbols defining the syntax of the left-hand side nonterminal.Page 1 ATL Reference Manual 2.2Grammar Notation Nonterminalandterminalsymbolsareshowninf i xedwi dt h.Furthermore,nonterminal symbols are shown in italic. The declaration of the nonterminal on the right-hand side is introducedbythenameofthenonterminalandfollowedbyasemicolon.Oneormore alternativeright-handsidesthenfollowonsucceedinglinestodefinethecontentofthe nonterminal. This example defines an if-expression: IfExpression : i f ( Expression) t henExpressionel seExpressionendi f Anif-expressionconsistsofanif-then-else-endifstructure.Theifisfollowedbya Boolean expression. The then and the else introduce each an expression. The else-part is not optional. The words one of introduce alternatives: BooleanLiteral:oneoft r uef al se which is shorthand for: BooleanLiteral: t r ue f al se Left-side terminals or nonterminals can be declared optional with the opt keyword. Input : InputElementsopt The above means that an input may consist of input elements but an input may also be empty. Ifalineistooshort,thecontentcanbesplitonseverallines.Whilealternativesstartatthe same indention, split lines have additional indention. TargetPatternElement : Identifier : MetamodelClassPath ( Assignements) Identifier : di st i nctoptMetamodelClassPathf or each( Identifieri nIdentifier)( Assignements) The definition contains two alternatives starting with the nonterminal identifier. The second left side alternative is split on two lines. 3Lexical Structure 3.1Encoding ATL programs are written using the Unicode character set. Except for comments, identifiers, andthecontentsofcharacterandstringliterals,allinputelementsinanATLprogramare formedonlyfromASCIIcharacters(orUnicodeescapeswhichresultinASCIIcharacters). Information about the Unicode encoding standard can be found in the Unicode Standard [9]. ASCII characters are the first 128 characters of the Unicode character encoding. Page 2 ATL Reference Manual 3.2Lexical Translations The lexical translation of an ATL program in the form of a raw Unicode character stream can be summarized in three steps: 1.AfirsttranslationsteptransformstheUnicodeescapesintherawstreamofUnicode (in general ASCII) characters to the corresponding Unicode characters.2.Asecondtranslationsteptakestheresultofstep1andtranslatesitintoastreamof input characters and line terminators. 3.A third translation step takes the result of step two and translates it into a sequence of inputelements.Afterdiscarding comments andwhitespacesthe result comprises the tokens that are the terminal symbols of the syntactic grammar. 3.3Unicode Escapes ImplementationsfirstrecognizeUnicodeescapesintheirinput,translatingtheASCII characters \u followed by four hexadecimal digits to the Unicode character with the indicated hexadecimal value, and passing all other characters unchanged. This translation step results in a sequence of Unicode input characters: UnicodeInputCharacter :UnicodeEscape RawInputCharacter UnicodeEscape :\UnicodeMarkerHexDigitHexDigitHexDigitHexDigit \ anyUni codechar act er Uni codeMar ker:u UnicodeMarkeru RawInputCharacter:anyUni codechar act er but not HexDigit : oneof0123456789abcdef ABCDEF The \, the u, and hexadecimal digits are all ASCII characters. For example, \u2297 is the Unicode encoding of the character " " and \n is the encoding of the CR character (carriage return). 3.4Line TerminatorsForthesecondlexicaltranslationsteplineterminatorsandinputcharactershavetobe identified. This is how they are defined: LineTerminator : t heASCI I LFchar act er , al soknownas" newl i ne"t heASCI I CRchar act er , al soknownas" r et ur n"t heASCI I CRchar act er f ol l owedbyt heASCI I LFchar act er InputCharacter : Uni codeI nput Char act er but not CRor LF Page 3 ATL Reference Manual 3.5Input Elements and Tokens Veryimportantforthelexicaltranslationareinputelements,andtokens.Aninputelement canbeawhitespace,acommentoratoken.Tokensrepresenttheterminalsymbolsofthe syntactic grammar (e.g. keywords, identifiers, literals and operators). Input : InputElementsopt InputElements : InputElement InputElements InputElement InputElement : WhiteSpace Comment Token Token : Identifier Keyword Literal Separator Operator 3.6 White Space AwhitespaceisdefinedasASCIIspace,horizontaltab,formfeedcharacters,orasline terminator. WhiteSpace : t heASCI I SPchar act er , al soknownas" space"t heASCI I HTchar act er , al soknownas" hor i zont al t ab"t heASCI I FFchar act er , al soknownas" f or mf eed"LineTerminator 3.7Comments Comments start with two consecutive hyphens and end with the line terminator. Comment : -- CharactersInLineopt LineTerminator CharactersInLine : InputCharacter CharactersInLineInputCharacter 3.8Identifiers PleasenotethatOCLidentifiersaredefinedasStringandStringasachainofcharacters which is not restricted to specific characters. myVariable is a possible name for an identifier as much as 4any-thing2:) (a mix of signs, digits and letters).Identifiers are unlimited sequences of specific Unicode characters and are defined as follows: Identifier : IdentifierChars but not Keyword, BooleanLiteral or NullLiteral UnicodeInputCharacters Page 4 ATL Reference Manual UnicodeInputCharacters : UnicodeInputCharacterUnicodeInputCharacter UnicodeInputCharacters IdentifierChars : LetterOrDigit IdentifierCharsLetterOrDigit Letter : anyUni codechar act er bet weenaandzor AandZ LetterOrDigit : anyLet t er or anyUni codechar act er bet ween0and9 Examples of identifiers are:St r i ng myVar i abl e MAX_VALUE i sLet t er Or Di gi ti- \ n The usage of inverted commas allows overwriting operators: queryTest Oper at or Def i ni t i on= ' 123' . " - " ( 2) ; helpercontextSt r i ngdef: " - " ( i : I nt eger ) : St r i ng=sel f . subst r i ng( 1, sel f . si ze( ) - i ) ; IdentifierdeclarationswithchainsofUnicodeinputcharacterscontainingnoneidentifier charactershavetobeputindoubleinvertedcommas(similarrulesapplytokeywords). However,whathasnotyetbeenspecified(andthisappliesonlytochainsofUnicodeinput characters containing none identifier characters and not to keywords) is that when identifiers areused(andnotdeclared)intheprogramdoubleinvertedcommasarenotnecessary.Thus the following code is also possible: queryTest Oper at or Def i ni t i on= ' 123' - 2; helpercontextSt r i ngdef: " - " ( i : I nt eger ) : St r i ng=sel f . subst r i ng( 1, sel f . si ze( ) - i ) ; For the declaration of overloaded operators inverted commas are obligatory. 3.9Keywords The following words are ATL keywords: Keyword : one of not andor xor i mpl i esmodul ecr eat ef r om useshel perdef cont ext r ul eusi ngder i ved t omapsTodi st i nct f or eachi n doi f t henel seendi fl et l i br ar yquer yf orPage 5 ATL Reference Manual 3.10 Separators The following nine ASCII characters are the separators (punctuators): Separator : oneof( ) {}[ ] ; ,.3.11 Operators Operators can be used by the ASCII Operator:UnaryOperator BinaryOperator The following tokens are basic operators. They are formed from ASCII characters: UnaryOperator : oneof +-% not BinaryOperator : oneof= > < = ! =+ - */ &|di vmod OperatorExpression: UnaryOperator Expression Expression.UnaryOperator ( )Expression BinaryOperator Expression Expression .BinaryOperator ( Expression) Theoperatorsarelistedinprecedenceorderwiththehighestprecedenceatthetopofthe table: Priority of operators precedence@pre brackets, dot and arrows[] () {} . =equality= logical ANDand logical OR and XORor xor logical impliesimplies 3.12 Infix Operators As in OCL, ATL has allows the use of infix operators. The binary operators +, -, *. /, ,=canbeusedinanexpressionasordinaryinfixoperatorsorin operation-like expressions. Page 6 ATL Reference Manual The following infix operator expression: a+ b is equivalent to the operation-like expression: a. +( b) 4 Data Model ATL is a strongly typed language since every expression has a type that is known at compile time.The ATL type model is very similar to the OCL type model; in particular what concerns the primitive types, the model elements and the collection types 4.1OclAny AnimportantsuperclassoftheOCLtypesystemisOclAnyfromwhich,amongothers, OclModelElement, OclType, Real, Boolean and String inherit. OclAny = OclAny : Boolean Returns true if the objects are the same, otherwise false. OclAny OclAny : Boolean Returns false if the objects are the same, otherwise true. OclAny oclIsNew : Boolean Returnstrueiftheobjectisnewlycreated(i.e.didntexistatpreconditiontime),otherwise false. OclAny oclIsTypeOf( OclType ) : Boolean Returns true if the object is of the OclType specified, otherwise false. OclAny oclIsKindOf( OclType ) : Boolean ReturnstrueiftheobjectsconformstotheOclTypespecified(thusalsotoanyofits subclasses), otherwise false. OclType allInstances : Set Returns all instances of a type (that are in a given source model). OclAny oclIsUndefined : Boolean Returns true if the object is void (void is represnted by OclVoid), otherwise false. 4.2Model Elements ModelElement Typesaredefinedby the corresponding source and target metamodels.ATL hasanabstractionlayerthatallowsadapting todifferentmetametamodelsviacorresponding adaptors.InATLitisnotallowedtopresumetheexecutionorder(namelytheorderofcreationof model elements of the target model) since this is a decision of the ATL implementation and a matter of optimization. This means that model elements of the target models are not allowed to be used on the right hand side of assertions. Page 7 ATL Reference Manual OclModelElement = OclModelElement : Boolean Returns true if the model elements are the same, otherwise false. OclModelElement OclModelElement : Boolean Returns false if the model elements are the same, otherwise true. 4.3Primitive Types TheprimitivetypesofATLcorrespondtotheOCLprimitivetypes,namelytoBoolean, String, Integer and Real. Integer and Real are numeric types.InOCLprimitivetypesareonlyvaguelyspecifiedleavingspacefordifferent implementations (e.g. there is no precision of the limits of numeric types). The ATL language specificationdoesnotintendtobemorerestrictivethanOCLbutatthesametimegivesan indication about the current implementation.These are the primitive types in ATL: PrimitiveType : Bool ean St r i ng NumericType InOCLthereisnonumerictype.TheATLnumerictypeandtheATLRealcorrespondto OCL Real. Numeric type has only been used to facilitate the specification of ATL. 4.3.1The Boolean Type The Boolean type has two values, true and false. A Boolean literal is defined as follows: BooleanLiteral :oneoft r uef al se Boolean has the following operations: BooleanOperation: one of andor xor not i mpl i es Boolean expressions determine the control flow in if-expressions. Boolean and Boolean : Boolean True if both boolean values are true, otherwise false. Boolean or Boolean : Boolean True if at least one boolean value is true, otherwise false. Boolean xor Boolean : Boolean True if exactly one boolean value is true, otherwise false. not Boolean : Boolean True if the boolean value is false, otherwise false. Boolean implies Boolean : Boolean False if the first boolean value is true and the second false, otherwise true. Page 8 ATL Reference Manual 4.3.2The String Type Strings are chains of characters. String literals are defined as follows: StringLiteral : 'StringCharactersopt ' StringCharacters : StringCharacter StringCharacters StringCharacter StringCharacter : InputCharacter but not ' or \EscapeSequence The following are examples of string literals:' ' - - t heempt ySt r i ng ' \ ' ' - - ast r i ngcont ai ni ng' ' ASt r i ng' - - ast r i ngcont ai ni ng8char act er s ' Thi si sa\ n' + - - act ual l yast r i ng- val uedconst ant' t wo- l i neSt r i ng' - - expr essi on, f or medf r omt woSt r i ng - - l i t er al s String has the following operations: StringOperation : one of concat ( ) si ze( ) subst r i ng( ) t oI nt eger ( )t oReal ( ) String concat( String ) : String The concatenation of the two String values. String size() : Integer The number of characters in the String. String substring( Integer , Integer ) : StringThe Substring between the two Integers. String toInteger() : IntegerThe Integer value that is coded in the String. String toReal() : IntegerThe Real value that is coded in the String. 4.3.3Numeric Types ATL has two numeric types, namely Integer and Real. NumericType : I nt egerReal Numeric types have the following operations: NumericOperation : one of Page 9 ATL Reference Manual *+ - / di v( ) si n( ) cos( ) f l oor ( )max( ) mi n( ) abs( ) sum( ) mod( ) r ound( ) TheATLlanguagedoesnotspecifynumericlimits.Thelimitsdependonthe implementation.ThecurrentimplementationforIntegerandRealisbasedonJava[3]and thushasthesamelimitsasthecorrespondingJavatypeswhicharejava.lang.Integerand java.lang.Double. NumericType * NumericType : NumericType The multiplication of two numeric values. NumericType + NumericType : NumericType The addition of two numeric values. NumericType - NumericType : NumericType The substraction of two numeric values. - NumericType : NumericType The negative numeric value. NumericType / NumericType : NumericType NumericType.div( NumericType ) : NumericType The division of two numeric values. NumericType.sin() : NumericType The sinus of a numeric value. NumericType.cos() : NumericType The cosinus of a numeric value. NumericType.floor() : NumericType The largest numeric value which is less or equal than the numeric value. NumericType.max( NumericType ) : NumericType The maximum of the two numeric values. NumericType.min( NumericType ) : NumericType The minimum of the two numeric values. NumericType.cos() : NumericType The absolute numeric value. Collection.sum(): NumericType The sum of all numeric values. NumericType.mod( NumericType ) : NumericType The result of modulo of the first numeric value with the second. NumericType.round() : Integer The Integer value that is closet to the numeric value. Halve values are rounded up. Page 10 ATL Reference Manual 4.3.3.1 Integer AnIntegerisawholenumber.Integerliteralexamplesare2and123.Integeristhe supertype of Real. Integer has the operations: IntegerOperation : one of Numer i cOper at i on 4.3.3.2 Real A Real is a number that may have a fractional part, an exponent, and a type suffix. Examples of Reals are 5e5f and -3.12. Real has the operations: IntegerOperation : one of I nt eger Oper at i on 4.4Collections Collection is the abstract superclass of Set, OrderedSet, Bag and Sequence. Set is a collection without duplicates. Set has no order.OrderedSet is a collection without duplicates. OrderedSet has an order.Bag is a collection in which duplicates are allowed. Bag has no order.Sequence is a collection in which duplicates are allowed. Sequence has an order.Collections contain zero to n expressions. CollectionElements : 0to1CollectionElements2toNCollectionElements

0to1CollectionElements : Expressionopt 2toNCollectionElements : Expression ,Expression Expression ,2toNCollectionElements Collection literals are defined as follows: SetLiteral : Set{CollectionElements } OrderedSetLiteral : Or der edSet{CollectionElements } BagLiteral : Bag {CollectionElements } SequenceLiteral : Sequence{CollectionElements } Examples of collections are: Page 11 ATL Reference Manual Sequence{1, 2, 3, 4, 5, 6, 7, 8} Sequence{1. . ( 4+ 4) } Sequence{1. . 8} All three sequence expressions are semantically identical. Collection has the following operations: Collection.size() : Integer The number of elements in the collection. Collection.includes( Object ) : Boolean The information of whether an object is part of a collection. Collection.excludes( Object ) : Boolean The information of whether an object is not part of a collection. Collection.count( Object ) : Integer The number of times that object occurs in the collection. Collection.includesAll( Collection ) : Boolean The information of whether all objects of a given collection are part of a specific collection. Collection.excludesAll( Collection ) : Boolean Theinformationofwhethernoneoftheobjectsofagivencollectionarepartofaspecific collection. Collection.isEmpty() : Boolean The information if a collection is empty. Collection.notEmpty() : Boolean The information if a collection is not empty.4.4.1Set Setinheritsallcollectionoperations.Additionally,sethasthefollowingsetspecific operations: Set.union( Set ) : Set The union of the first and the second set. Set.union( Bag ) : Bag The union of the set and the first bag. Set = Set : Boolean Tests if the sets contain the same elements and if this is true it returns true. Set.intersection( Set ) : Set The intersection of the first and the second set. Set. intersection( Bag ) : Bag Page 12 ATL Reference Manual The intersection of the set and the first bag. Set - Set : Set Returns a set with those elements of the first set that are not in the second. Set including( Object ) : Set Adds the object to the set. Set excluding( Object ) : Set Removes the object from the set. Set symmetricDifference( Set ) : Set Returns a set with all those set elements that are in exactly one of the sets (an not in both). Set count( Object ) : Integer Thenumberofoccurrencesofobjectintheset(becauseofthesetcharacteristicpossible results are 0 and 1, but not a number greater than 1). Set flatten() : Set Iftheelementsofthesetarenotcollectionsthesetwillbereturnedunmodified.Ifthe elements in the set are collections, the returned set will directly contain all elements of those collections. Set asSet() : Set Returns the set unmodified. Set asOrderedSet() : OrderedSet Casts the set to an ordered set. Set asSequence() : Sequence Casts the set to a sequence. Set asBag() : Bag Casts the set to a bag. 4.4.2OrderedSet Orderedsetinheritsallcollectionoperations.Additionally,orderedsethasthefollowing ordered set specific operations: OrderedSet append( Object ) : OrderedSet Appends the object at the end of the ordered set. OrderedSet prepend( Object ) : OrderedSet Inserts the object at the first place of the ordered set. OrderedSet insertAt( Integer, Object ) : OrderedSet Inserts the object at the place indicated by the Integer value in the ordered set. OrderedSet subOrderedSet ( Integer, Integer ) : OrderedSet All elements starting at the first Integer value and including the second Integer value. Page 13 ATL Reference Manual OrderedSet at( Integer ) : Object Returns the object at the position indicated by the Integer value in the ordered set. OrderedSet indexOf( Object ) : Integer Returns the position of the object in the ordered set. OrderedSet first( Integer ) : Object Returns the first object of the ordered set. OrderedSet last( Integer ) : Object Returns the last object of the ordered set. 4.4.3Bag Baginheritsallcollectionoperations.Additionally,baghasthefollowingbagspecific operations: Bag.union( Bag ) : Bag The union of the first and the second bag. Bag.union( Set ) : Bag The union of the set and the first bag. Bag = Bag : Boolean Testsifthebagscontainthesameelementsthesamenumberoftimesandifthisistrue,it returns true. Bag.intersection( Bag ) : Bag The intersection of the first and the second bag. Bag. intersection( Set ) : Set The intersection of the bag and the first set. Bag including( Object ) : Bag Adds the object to the bag. Bag excluding( Object ) : Bag Removes all occurrences of the given object from the bag. Bag count( Object ) : Integer The number of occurrences of object in the bag. Bag flatten() : Bag Iftheelementsofthebagarenotcollectionsthebagwillbereturnedunmodified.Ifthe elements in the bag are collections, the returned bag will directly contain all elements of those collections. Bag asSet() : Set Casts the bag to a set. This removes all duplicates. Page 14 ATL Reference Manual Bag asOrderedSet() : Sequence Casts the bag to an ordered set (undefined order). This removes all duplicates. Bag asSequence() : Sequence Casts the bag to a sequence (undefined order). Bag asBag() : Bag Returns the bag unmodified. 4.4.4Sequence Sequence inherits all collection operations. Additionally, sequence has the following sequence specific operations: Sequence count( Object ) : Integer The number of occurrences of object in the Sequence. Sequence = Sequence : Boolean Tests if the sequences contain the same elements in the same order and if this is true, it returns true. Sequence.union( Sequence ) : Sequence Appends the second sequence to the first sequence. Sequence flatten() : Sequence If the elements of the sequence are not collections the sequence will be returned unmodified. If the elements in the sequence are collections, the returned sequence will directly contain all elements of those collections. Sequence append( Object ) : Sequence Appends the object at the end of the sequence. Sequence prepend( Object ) : Sequence Inserts the object at the first place of the sequence. Sequence insertAt( Integer, Object ) : Sequence Inserts the object at the place indicated by the Integer value in the sequence. Sequence subSequence ( Integer, Integer ) : Sequence All elements starting at the first Integer value and including the second Integer value. Sequence at( Integer ) : Object Returns the object at the position indicated by the Integer value in the sequence. Sequence indexOf( Object ) : Integer Returns the position of the object in the sequence. Sequence first( Integer ) : Object Returns the first object of the sequence. Sequence last( Integer ) : Object Page 15 ATL Reference Manual Returns the last object of the sequence. Sequence including( Object ) : Sequence Adds the object to the sequence. Sequence excluding( Object ) : Sequence Removes all occurrences of the given object from the sequence. Sequence asSet() : Set Casts the sequence to a set. This removes all duplicates. Sequence asOrderedSet() : Sequence Casts the sequence to an ordered set. This removes all duplicates. Sequence asSequence() : Sequence Returns the sequence unmodified. Sequence asBag() : BagCasts the sequence to a bag. 4.4.5Iterator Expressions ATLsupportsOCLiteratorexpressions.Iteratorexpressionsconsistofasource,abody, iterator(s), and a result. 4.4.5.1 Collection There is a rich set of iterator expressions defined on collection. existsIf body evaluates to true for at least one element in the source collection, the exists expression returns true, otherwise false. forAll Ifbodyevaluatestotrueforatallelementsinthesourcecollection,theforAllexpression returns true, otherwise false. isUnique Ifbodyexpressionevaluatesforeachelementinthesourcecollectionadifferentvalue,the isUnique expression returns true, otherwise false. any Returns any element in the source collection for which body evaluates to true. one If body evaluates to true for exactly one element in the source collection, the one expression returns true, otherwise false. collect The collect expression returns the collection of elements which results from applying body to every member of the source set. The result is flattened.Page 16 ATL Reference Manual 4.4.5.2 Set Set allows the iterator expressions defined on collection and additionally it defined some set specific ones. select The subset of set for which the body evaluates to true. reject The subset of set for which the body evaluates to false. collectNested Returns the bag of elements which results from applying body to every member of the source set. sortedBy ReturnstheSetasanorderedset,lowervaluesgofirst.Theelementsofthesetmustbe comparable withsi ze( ) = 0) - >f i r st ( )ing;} to out : DXF2! Poi nt (name