Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:25 Go to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 192
Registered: July 2009
Senior Member
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 19:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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 19:17]

Report message to a 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 07:15 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
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...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:how to load other project's ecore resource
Next Topic:[CDO] [ERROR] Buffer@6,443[RELEASED]
Goto Forum:
  


Current Time: Thu May 02 13:40:03 GMT 2024

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

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

Back to the top