I am currently working on a web application that shall be able to analyze BPMN models.
First, models should be uploaded to the web application. Then the web application should identify certain logical blocks in the model automatically. Those logical blocks could be OR-blocks or loops for example:
In order to identify these logical blocks in my code, I have to somehow access the general structure of the process model.
I can already upload BPMN models to my web application and visualize them using the “viewer” of bpmn-js. Now I need a variable where all the elements of the uploaded process are stored in a structured and easily accessible way.
Is there a way to access the structure of the model using bpmn-js? Is it already stored somewhere?
The Element Registry does indeed store all shapes and connections of the business process. However, as far as I can tell, the order of the elements is not stored in a structured way.
I am looking for a variable, where shapes are stored in a way that reflects the structure of the business process.
Like in the following business process:
Here it would make sense to store the elements in the following order:
StartEvent → SequenceFlow_1 → Task_1 → SequenceFlow_2 → Task_2 → SequenceFlow_3 → EndEvent
Of course, this becomes more complex when there are parallel structures within the business process as shown in the initial example.
I thought that there might be a variable that stores shapes in a “structured” way, that reflects the structure of the business process itself.
It is possible, that what I am asking for isn’t implemented in bpmn-js, since storing elements in a more structured way is not necessarily needed for modeling business processes.
I might have to develop a solution by myself, by using the “outgoing” and “incoming” parameters of each shape, to build a structure which allows me to analyze the business process in the code.
Anyways, thanks for your help, it is very much appreciated.