csgoh / processpiper

An open source python library to generate business process diagram using code or plain text.
https://github.com/csgoh/processpiper
MIT License
148 stars 10 forks source link

[feat] Output in BPMN format #37

Closed r-erd closed 7 months ago

r-erd commented 8 months ago

Hi,

I was looking through the source code to figure out if it is possible to change the output from PNG to BPMN format. However, I did not spot the part where it is converted to the PNG. This would be very nice for keeping the diagram editable.

Is this already supported functionality, or easy to implement?

Thanks

csgoh commented 7 months ago

Hi,

PNG file is created when calling .save() method. When you say save to BPMN format, are you referring to BPEL? Currently there is no plan to save output as BPEL.

The diagram is generated by code, so it is editable 😄

CS

r-erd commented 7 months ago

Hi,

Thanks for getting back to me! I was referring to this specification as used by e.g. bpmn.io and I was assuming that somewhere in the code this format is used. But now its obvious why I did not find it - because you are directly creating the PNG without making use of the BPMN format, right?

(I am currently looking for a solution with which it is possible to create BPMN-files (diagrams in xml) with the help of a syntax like this project supports.)

csgoh commented 7 months ago

Hi, BPMN is just the specification. If you want something that is executable by a process engine, you are referring to Business Process Execution Language (BPEL) which is in XML format.

r-erd commented 7 months ago

I am not sure what you mean by "executable by a process engine". But yes, I am referring to a XML format. My problem is that I want to create such a XML from code (like the syntax used in this repo) without having to code the transformation myself.

So if BPEL is the format the the .bpmn files use, then this is what I was referring to. This is a very simple example:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_0obm7bs" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="15.1.3">
  <bpmn:process id="Process_0whtdb4" isExecutable="false">
    <bpmn:startEvent id="StartEvent_033fdj1" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0whtdb4">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_033fdj1">
        <dc:Bounds x="156" y="82" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

If, as you already suggested, this output format is not planned, feel free to close this issue.