0

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>
dwagelaar
  • 174
  • 1
  • 6
DrB
  • 264
  • 1
  • 3
  • 14

1 Answers1

1

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>
PogoMips
  • 156
  • 5
  • Thanks for your answer PogoMips. The approach you suggest work for the input file created the way you explained. But when I get any other BPMN2 model generated by different tools including the Eclipse BPMN editor and bpmn.io it won't be parsed by my ATL rule. – DrB May 14 '16 at 17:42
  • All I can see that BPMN editors generate models that does not conform to BPMN20.ecore meta model for example the output of bpmn.io is just correct according to BPMN20.ecore. It does not seem from their source code in github that they are having a model based approach. – DrB May 15 '16 at 22:29
  • 1
    Hi Behnaz, yes this might be true. Depending on where your ecore metamodel comes from (e.g. did you create it yourself, or was it provided by someone?) it might be different to the metamodel BPMN editors would use. As you said, it is unlikely that they use model-driven approaches. If you have a lot of existing models for which it's not feasible to remodel them manually, you could use xslt transformations to generate valid models. Example: -> – PogoMips May 17 '16 at 11:43
  • Thanks PogoMips for the reply. I am using the ecore model provided by https://www.eclipse.org/bpmn2-modeler/. I am also writing to bpmn.io to communicate this issue. – DrB May 17 '16 at 12:20
  • https://forum.bpmn.io/t/generated-bpmn-models-are-not-conforming-to-bpmn20-ecore/717 – DrB May 17 '16 at 13:46
  • 1
    Your original `.bpmn` file seems fine to me, it conforms to the BPMN format (which is not XMI). The issue could come from the fact that you are using the `XMIResource` in order to load your original bpmn file instead of the `Bpmn2Resource` resource. Do you have the BPMN2 plugin installed in your eclipse or not? (I suppose you don't as you have the `.ecore` metamodel in your github repository) – Vincent Aranega May 17 '16 at 13:53