eclipse-emf-ecoreecorebpmn.ioeclipse-atl

ATL transformation rules not matching nested BPMN2 elements


I am writing an ATL translation from BPMN2 to another model. The problem is that the code does not detect any nested element.

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

You can see from the output that the only executed rule is def2mod which has created a Reo module element in the output.

If I remove the first level element in the input bpmn file then the rule mapProcess is kicked in.

Also in the logs the command BPMN20!Process.allInstances() which should give a list of all the Processes only works in the mapProcess rule.

I think there is some issue with parsing my bpmn model. Help much appreciated!

=== ATL CODE ====

-- @path BPMN20=/atttl/BPMN2/BPMN20.ecore
create OUT: reo from IN: BPMN20;

rule def2mod {
    from
        b: BPMN20!Definitions
    to
        m: reo!Module
    do {
        b.debug('definition to module > ' + BPMN20!Process.allInstances()); 
    }
}

rule mapProcess {
    from
        proc: BPMN20!Process
    to
        conn: reo!Connector
    do {
        proc.debug('process to connector ' + proc.name + proc.flowElements); 
        proc.debug( BPMN20!Process.allInstances());
    }
}

=== BPMN input ===

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:Definitions xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI">
  <bpmn2:Process id="bpmnid-80c796ae-c11d-42d8-92ae-1d88bab84536" name="Process" isClosed="false" processType="None" xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI">
    <bpmn2:serviceTask id="bpmnid-11047880-09d8-4147-8382-523145eeb8b6" name="Task 1"/>
    <bpmn2:serviceTask id="bpmnid-2f925dd9-4ec8-45b7-936c-0c14597319a9" name="Task 2"/>
    <bpmn2:serviceTask id="bpmnid-21a0fc44-3c02-4a00-9b6e-aa6c058992d3" name="Task 3"/>
    <bpmn2:startEvent id="bpmnid-196c656e-baa2-4306-809b-56ba006057b9" name="Start Event"/>
    <bpmn2:endEvent id="bpmnid-5cfcf354-ba3f-4b13-a5bf-bdf27ca70acc" name="End Event"/>
    <bpmn2:sequenceFlow id="bpmnid-be0a37d4-8054-4367-82ae-b43430d5fc6f" name="Sequence Flow0" sourceRef="bpmnid-11047880-09d8-4147-8382-523145eeb8b6" targetRef="bpmnid-2f925dd9-4ec8-45b7-936c-0c14597319a9"/>
    <bpmn2:sequenceFlow id="bpmnid-01d687a3-66ee-40d7-9e17-97aa5724eef7" name="Sequence Flow" sourceRef="bpmnid-196c656e-baa2-4306-809b-56ba006057b9" targetRef="bpmnid-11047880-09d8-4147-8382-523145eeb8b6"/>
    <bpmn2:sequenceFlow id="bpmnid-b687d3ec-b6d7-480a-a1e1-57fbe220e579" name="Sequence Flow2" sourceRef="bpmnid-21a0fc44-3c02-4a00-9b6e-aa6c058992d3" targetRef="bpmnid-5cfcf354-ba3f-4b13-a5bf-bdf27ca70acc"/>
    <bpmn2:sequenceFlow id="bpmnid-4596a8fb-f1dc-46b3-bc28-9a2e11c26f96" name="Sequence Flow1" sourceRef="bpmnid-2f925dd9-4ec8-45b7-936c-0c14597319a9" targetRef="bpmnid-21a0fc44-3c02-4a00-9b6e-aa6c058992d3"/>
  </bpmn2:Process>
</bpmn2:Definitions>

Solution

  • The problem seems not to lie with the ATL transformation but with the input model. It seems like it's not conform to your metamodel.

    E.g. Definitions has a relation "rootElements" to Process. This should in the XMI model look like this:

    <bpmn2:Definitions 
        xmi:version="2.0" 
        xmlns:xmi="http://www.omg.org/XMI" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI">
        <rootElements xsi:type="bpmn2:Process" id="bpmnid-80c796ae-c11d-42d8-92ae-1d88bab84536" />
    </bpmn2:Definitions>
    

    To quickly get a conform model you can right-click the Definitions element in your ecore metamodel and choose "Create Dynamic Instance". You can then model a quick sample and run your transformation again. I quickly tried it and got following output

    <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:reo="http://www.cwi.nl/reo">
      <reo:Module/>
      <reo:Connector/>
    </xmi:XMI>