0
votes

I am writing an ATL translation from BPMN2 to another model. The target model editor requires a GMF diagram to open the output of ATL transformation. In the following rule, I create the diagram the problem is that the diagram and the model are not written in the same file. If I choose the same file for their output one overrides the other.

rule def2mod {
    from
        b: BPMN20!Definitions
    to
        m: reo!Module,
        m : GMF!Diagram(
            type<-'Reo',
            name<-'test',
            measurementUnit<-#Pixel
        )   
}

I have posted the atl code and my input here at: https://github.com/behnaaz/BPMN2ATL.git

Merging the content of these file in one file is also not helping. The output are generated as: File 1:

<?xml version="1.0" encoding="ISO-8859-1"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_zHQiAB6HEeaECbYRnMkrCw" type="Reo" name="test" measurementUnit="Pixel"/>

File 2:

<?xml version="1.0" encoding="ISO-8859-1"?>
<reo:Module xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:channels="http://www.cwi.nl/reo/channels" xmlns:components="http://www.cwi.nl/reo/components" xmlns:reo="http://www.cwi.nl/reo" xsi:schemaLocation="http://www.cwi.nl/reo/channels Reo/reo.ecore#//channels http://www.cwi.nl/reo/components Reo/reo.ecore#//components http://www.cwi.nl/reo Reo/reo.ecore" xmi:id="_zHOFwB6HEeaECbYRnMkrCw" name="d">
  <connectors xmi:type="reo:Connector" xmi:id="_zHOFwR6HEeaECbYRnMkrCw" name="p">
    <nodes xmi:type="reo:Node" xmi:id="_zHOFwh6HEeaECbYRnMkrCw" sourceEnds="_zHOF0x6HEeaECbYRnMkrCw" sinkEnds="_zHOF2B6HEeaECbYRnMkrCw"/>
    <nodes xmi:type="reo:Node" xmi:id="_zHOFwx6HEeaECbYRnMkrCw" sourceEnds="_zHOF1h6HEeaECbYRnMkrCw" sinkEnds="_zHOF0R6HEeaECbYRnMkrCw"/>
    <nodes xmi:type="reo:Node" xmi:id="_zHOFxB6HEeaECbYRnMkrCw" name="in" sourceEnds="_zHOF0B6HEeaECbYRnMkrCw"/>
    <nodes xmi:type="reo:Node" xmi:id="_zHOFxR6HEeaECbYRnMkrCw" name="int" sinkEnds="_zHOF1B6HEeaECbYRnMkrCw"/>
    <primitives xmi:type="channels:Sync" xmi:id="_zHOFxh6HEeaECbYRnMkrCw">
      <sourceEnds xmi:type="reo:SourceEnd" xmi:id="_zHOFxx6HEeaECbYRnMkrCw"/>
      <sinkEnds xmi:type="reo:SinkEnd" xmi:id="_zHOFyB6HEeaECbYRnMkrCw"/>
    </primitives>
    <primitives xmi:type="channels:Sync" xmi:id="_zHOFyR6HEeaECbYRnMkrCw">
      <sourceEnds xmi:type="reo:SourceEnd" xmi:id="_zHOFyh6HEeaECbYRnMkrCw"/>
      <sinkEnds xmi:type="reo:SinkEnd" xmi:id="_zHOFyx6HEeaECbYRnMkrCw"/>
    </primitives>
    <primitives xmi:type="channels:Sync" xmi:id="_zHOFzB6HEeaECbYRnMkrCw">
      <sourceEnds xmi:type="reo:SourceEnd" xmi:id="_zHOFzR6HEeaECbYRnMkrCw"/>
      <sinkEnds xmi:type="reo:SinkEnd" xmi:id="_zHOFzh6HEeaECbYRnMkrCw"/>
    </primitives>
    <primitives xmi:type="channels:Sync" xmi:id="_zHOFzx6HEeaECbYRnMkrCw">
      <sourceEnds xmi:type="reo:SourceEnd" xmi:id="_zHOF0B6HEeaECbYRnMkrCw" node="_zHOFxB6HEeaECbYRnMkrCw"/>
      <sinkEnds xmi:type="reo:SinkEnd" xmi:id="_zHOF0R6HEeaECbYRnMkrCw" node="_zHOFwx6HEeaECbYRnMkrCw"/>
    </primitives>
    <primitives xmi:type="channels:Sync" xmi:id="_zHOF0h6HEeaECbYRnMkrCw">
      <sourceEnds xmi:type="reo:SourceEnd" xmi:id="_zHOF0x6HEeaECbYRnMkrCw" node="_zHOFwh6HEeaECbYRnMkrCw"/>
      <sinkEnds xmi:type="reo:SinkEnd" xmi:id="_zHOF1B6HEeaECbYRnMkrCw" node="_zHOFxR6HEeaECbYRnMkrCw"/>
    </primitives>
  </connectors>
  <components xmi:type="components:Reader" xmi:id="_zHOF1R6HEeaECbYRnMkrCw">
    <sourceEnds xmi:type="reo:SourceEnd" xmi:id="_zHOF1h6HEeaECbYRnMkrCw" node="_zHOFwx6HEeaECbYRnMkrCw"/>
  </components>
  <components xmi:type="components:Writer" xmi:id="_zHOF1x6HEeaECbYRnMkrCw">
    <sinkEnds xmi:type="reo:SinkEnd" xmi:id="_zHOF2B6HEeaECbYRnMkrCw" node="_zHOFwh6HEeaECbYRnMkrCw"/>
  </components>
</reo:Module>
1

1 Answers

0
votes

Something that works so far is to open the emf model in java code runtime and add the diagram programmatically as:

//module is my emf model generated by ATL
Diagram diagram = ViewService.createDiagram(module, ModuleEditPart.MODEL_ID,
    ReoDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
res.getContents().add(diagram);
res.getContents().add(diagram.getElement());
res.save(module, Collections.EMPTY_MAP);