Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » [BPMN2] Using the BPMN2 editor XML as input for ATL
[BPMN2] Using the BPMN2 editor XML as input for ATL [message #549320] Mon, 26 July 2010 13:11 Go to next message
Pieter is currently offline PieterFriend
Messages: 7
Registered: July 2010
Junior Member
Hi all,

I'm defnining a transformation in ATL, which uses the BPMN2 metamodel as source.

I'd like to use the output XML from the BPMN2 editor as input for the ATL transformation. This does however not work. The output XML from the editor looks like this (conforming the BPMN2 xsd schema):

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" id="sid-Definitions">
  <bpmn2:process id="sid-Process">
    <bpmn2:startEvent id="sid-StartEvent">
      <bpmn2:outgoing>sid-SF1</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:task id="sid-Task">
      <bpmn2:incoming>sid-SF1</bpmn2:incoming>
      <bpmn2:outgoing>sid-SF2</bpmn2:outgoing>
    </bpmn2:task>
    <bpmn2:endEvent id="sid-EndEvent">
      <bpmn2:incoming>sid-SF2</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="sid-SF1" sourceRef="sid-StartEvent" targetRef="sid-Task"/>
    <bpmn2:sequenceFlow id="sid-SF2" sourceRef="sid-Task" targetRef="sid-EndEvent"/>
  </bpmn2:process>
</bpmn2:definitions>


This does conform to the BPMN metamodel, however, this is not excepted by ATL, because "definitions", "task", etc. ain't classes defined in the metamodel (rather they are attributes). A valid XML format accepted by ATL is the following:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" 
	xmlns:xmi="http://www.omg.org/XMI" 
	xmlns="platform:/resource/Cent2Decent/BPMN.ecore">
	
	<Definitions id="Process1" xmi:id="Process1">
		<rootElements xmi:type="Process" id="sid-Process" name="Process1" xmi:id="sid-Process">
			<flowElements xmi:type="Task" name="Task1" id="sid-Task1" xmi:id="sid-Task"/>
			<flowElements xmi:type="StartEvent" name="StartEvent" id="sid-StartEvent" xmi:id="sid-StartEvent"/>
			<flowElements xmi:type="EndEvent" name="EndEvent" id="sid-EndEvent" xmi:id="sid-EndEvent"/>
			<flowElements xmi:type="SequenceFlow" name="SF1" id="sid-SF1" sourceRef="sid-StartEvent" targetRef="sid-Task1" xmi:id="sid-SF1"/>
			<flowElements xmi:type="SequenceFlow" name="SF2" id="sid-SF2" sourceRef="sid-Task1" targetRef="sid-EndEvent" xmi:id="sid-SF2"/>					
		</rootElements>
	</TDefinitions>
	
</xmi:XMI>


Is there a way to switch between the two representations? Or is there a way to load the first XML file directly in ATL?

Re: [BPMN2] Using the BPMN2 editor XML as input for ATL [message #549342 is a reply to message #549320] Mon, 26 July 2010 13:43 Go to previous messageGo to next message
Henning Heitkoetter is currently offline Henning HeitkoetterFriend
Messages: 21
Registered: April 2010
Junior Member
Hi Pieter,
thanks for trying out the BPMN2 project.

What version of the BPMN2 editor are you using? Did you get it directly from our repository? If so, when?

Pieter wrote on Mon, 26 July 2010 09:11

<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" id="sid-Definitions">




I'm asking because the XML file is not 100% ok, the namespace for bpmn2 should be http://www.omg.org/spec/BPMN/20100524/MODEL (without the -XMI), and this should be the behaviour of our current version.

Could you change the namespace manually (remove "-XMI" from it) and retry the transformation?

Regards,
Henning
Re: [BPMN2] Using the BPMN2 editor XML as input for ATL [message #551942 is a reply to message #549320] Tue, 10 August 2010 09:05 Go to previous message
Reiner Hille is currently offline Reiner HilleFriend
Messages: 18
Registered: July 2009
Junior Member
Hi Peter,
the MDT BPMN2 project supports both official file formats: XML (accrording to the OMG schema) and XMI (according to CMOF Metamodel).
The editor by default saves in XML format, as we consider it to be used more frequently. However, the editor has a "Save as" functionality. "Use File->Save as" and enter a file name with ".xmi" extension - then the file will appear in XMI format.
The code that does the conversion is rather simple - quoting now from BPMNEditor.java:

protected void doSaveAs(URI uri, IEditorInput editorInput) {
if (uri.toString().endsWith("xmi")) {
Resource oldResource = editingDomain.getResourceSet().getResources().get(0);
XMIResource newResource = new XMIResourceImpl();
editingDomain.getResourceSet().getResources().add(newResourc e);
newResource.setURI(uri);
List<EObject> content = new ArrayList<EObject>(oldResource.getContents());
for (EObject eObject : content) {
if (eObject.eClass().getName().equals("DocumentRoot")) {
newResource.getContents().addAll(eObject.eContents());
} else {
newResource.getContents().add(eObject);
}
}
oldResource.unload();
editingDomain.getResourceSet().getResources().remove(oldReso urce);

} else {
(editingDomain.getResourceSet().getResources().get(0)).setUR I(uri);
}
setInputWithNotify(editorInput);
setPartName(editorInput.getName());
IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
.getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
doSave(progressMonitor);
}
Previous Topic:[BPMN2] Missing namespace export for XSD-based serialization
Next Topic:[TCS] To invoke Inject from Java
Goto Forum:
  


Current Time: Thu Apr 25 01:59:18 GMT 2024

Powered by FUDForum. Page generated in 0.03073 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top