Skip to main content



      Home
Home » Modeling » EMF » How to avoid the output of an element path instead of its ID?
How to avoid the output of an element path instead of its ID? [message #1852029] Tue, 26 April 2022 07:25 Go to next message
Eclipse UserFriend
I have constructed a EMF model form the BPMN 2.0 specification. No I run into a strange behavior when construction a model programmatically.

My root element 'definitions' contains two childs (bpmndi:BPMNDiagram and bpmn2:process). The bpmndi:BPMNDiagram contains a bpmndi:BPMNPlane holding a reference to the bpmn2:process. Each element has a unique id.

        Definitions definitions = Bpmn2Factory.eINSTANCE.createDefinitions();

        definitions.setExporter("demo");
        definitions.setExpressionLanguage("java");

        org.openbpmn.bpmn2.Process process = Bpmn2Factory.eINSTANCE.createProcess();
        process.setId("P001");
        process.setIsClosed(true);
        
        BPMNDiagram bpmdiagram = BpmndiFactory.eINSTANCE.createBPMNDiagram();
        bpmdiagram.setId("D002");
        bpmdiagram.setName("my diagram");
        
        BPMNPlane bpmnplane = BpmndiFactory.eINSTANCE.createBPMNPlane();
        bpmnplane.setId("BPMNPlane_1");
        bpmnplane.setBpmnElement(process);
        bpmdiagram.setPlane(bpmnplane);
        
        definitions.getProcesses().add(process);
        definitions.getDiagrams().add(bpmdiagram);


The outcome of the XML file looks like this:


<?xml version="1.0" encoding="ASCII"?>
<bpmn2:Definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" expressionLanguage="java" exporter="demo">
  <bpmndi:BPMNDiagram id="D002" name="my diagram">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="bpmn2:Process src/test/resources/openbpmn-empty.bpmn#P001"/>
  </bpmndi:BPMNDiagram>
  <bpmn2:process id="P001" isClosed="true"/>
</bpmn2:Definitions>


Where the bpmnElement in the bpmndi:BPMNPlane refers to the full path. But I would expect only the ID (which is unique in the complete model)

<?xml version="1.0" encoding="ASCII"?>
<bpmn2:Definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" expressionLanguage="java" exporter="demo">
  <bpmndi:BPMNDiagram id="D002" name="my diagram">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="P001"/>
  </bpmndi:BPMNDiagram>
  <bpmn2:process id="P001" isClosed="true"/>
</bpmn2:Definitions>


Can someone help me how to resolve this issue?

Re: How to avoid the output of an element path instead of its ID? [message #1852036 is a reply to message #1852029] Tue, 26 April 2022 15:16 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Unfortunately you do not show the ResouceSet maintenance or the save so you hide the usual sources of trouble from us.

A common failure to save properly is due to failure to save from within a ResourceSet. Another possibility is that you have assigned an unwise Resource URI.

Regards

Ed Willink

[Updated on: Tue, 26 April 2022 15:17] by Moderator

Re: How to avoid the output of an element path instead of its ID? [message #1852060 is a reply to message #1852036] Thu, 28 April 2022 03:15 Go to previous message
Eclipse UserFriend
Ensure that you load/create every resource, especially the initial one, with an absolute URI. If it's a resource in the workspace, ensure you use URI.createPlatformResourceURI("/project/path-to-file") and if it's a resource in the file system ensure you use URI.createFileURI(new File("path").getAbsolutePath()). In this case, if you later want to load the resource at runtime, you would probably want to use java.lang.Class.getResource(String) to get the URL...
Previous Topic:how to load other project's ecore resource
Next Topic:[CDO] [ERROR] Buffer@6,443[RELEASED]
Goto Forum:
  


Current Time: Thu May 15 10:47:04 EDT 2025

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

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

Back to the top