title: Change an association to an attribute with an ATL transformation
body: <p>I have an ecore model which represents a class diagram's metamodel: <a href="https://i.stack.imgur.com/jlMOT.png" rel="nofollow noreferrer">Class Diagram Ecore</a></p>
  <p>In the current state of things, associations between classes are managed with an &quot;Association&quot; Type, however I would like to write an ATL transformation in order to directly put the associated classes as attributes in the linked class (with the right types and multiplicities) but I did not succeed, how can I achieve this please?</p>
  <p>The ATL code I currently have simply removes the associations between the source and target model:</p>
  <pre><code>-- @path ClassDiagram=/ClassDiagram/metaModels/ClassDiagram.ecore
  
  module RemoveAsso;
  create cible : ClassDiagram from source : ClassDiagram;
  
  rule duplicateModelBase {
  from
      sourceBase : ClassDiagram!ModelBase
  to
      cibleBase : ClassDiagram!ModelBase (
          allClasses &lt;- sourceBase.allClasses,
          allInterfaces &lt;- sourceBase.allInterfaces,
          allAssociations &lt;- sourceBase.allAssociations,
          voidT &lt;- sourceBase.voidT,
          intT &lt;- sourceBase.intT,
          stringT &lt;- sourceBase.stringT,
          boolT &lt;- sourceBase.boolT
      )
  }
  
  rule duplicateClass {
  from
      sourceClass : ClassDiagram!Class
  to
      cibleClass : ClassDiagram!Class (
          name &lt;- sourceClass.name,
          attributes &lt;- sourceClass.attributes,
          methods &lt;- sourceClass.methods,
          interfaces &lt;- sourceClass.interfaces
      )
  }
  
  rule duplicateInterface  {
  from
      interfaceSource : ClassDiagram!Interface
  to
      interfaceCible : ClassDiagram!Interface (
          name &lt;- interfaceSource.name,
          methods &lt;- interfaceSource.methods,
          implementedBy &lt;- interfaceSource.implementedBy
      )
  }
  
  rule duplicateMethod {
  from
      methodSource : ClassDiagram!Method
  to
      methodCible : ClassDiagram!Method (
          name &lt;- methodSource.name,
          owner &lt;- methodSource.owner,
          returnType &lt;- methodSource.returnType,
          paramTypes &lt;- methodSource.paramTypes,
          paramNames &lt;- methodSource.paramNames
      )
  }
  
  --rule duplicateAssociationEnd {
  --from
  --  aeSource : ClassDiagram!AssociationEnd
  --to
  --  aeCible : ClassDiagram!AssociationEnd (
  --      name &lt;- aeSource.name,
  --      lowerBound &lt;- aeSource.lowerBound,
  --      upperBound &lt;- aeSource.upperBound,
  --      _class &lt;- aeSource._class,
  --      association &lt;- aeSource.association
  --  )
  --}
  
  --rule duplicateAssociation {
  --from
  --  associationSource : ClassDiagram!Association 
  --to
  --  associationCible : ClassDiagram!Association (
  --      name &lt;- associationSource.name,
  --      ends &lt;- associationSource.ends
  --  )
  --}
  
  rule duplicationVoidType {
  from
      voidTypeSource : ClassDiagram!VoidType 
  to
      voidTypeCible : ClassDiagram!VoidType (
          name &lt;- voidTypeSource.name
      )
  }
  
  rule duplicationIntegerType {
  from
      integerTypeSource : ClassDiagram!IntegerType 
  to
      integerTypeCible : ClassDiagram!IntegerType (
          name &lt;- integerTypeSource.name
      )
  }
  
  rule duplicationStringType {
  from
      stringTypeSource : ClassDiagram!StringType 
  to
      stringTypeCible : ClassDiagram!StringType (
          name &lt;- stringTypeSource.name
      )
  }
  
  rule duplicationBooleanType {
  from
      booleanTypeSource : ClassDiagram!BooleanType 
  to
      booleanTypeCible : ClassDiagram!BooleanType (
          name &lt;- booleanTypeSource.name
      )
  }
  
  rule duplicateAttribute {
  from 
      attributeSource : ClassDiagram!Attribute 
  to
      attributeTarget : ClassDiagram!Attribute (
          name &lt;- attributeSource.name,
          owner &lt;- attributeSource.owner,
          type &lt;- attributeSource.type,
          multiplicity &lt;- attributeSource.multiplicity
      )
  }
  </code></pre>