roger-castaldo / BPMNEngine

A BPMN Engine written in .net
GNU General Public License v3.0
121 stars 48 forks source link

BPMN 2.0 XML compliance problem #9

Closed stoneyowl closed 5 years ago

stoneyowl commented 5 years ago

I just found your bpmn engine, and it looks exactly like what I need -but..... I have been running the reference xml files from the OMG.org site and am getting several errors regarding needing a Start Event/End Event in sub-processes. Is this a BPMN 2.0 requirement? I cannot find, going through the documentation, where these are actually required. Can you tell me where in the parser code the list of required attributes for each element is defined?

roger-castaldo commented 5 years ago

Hi, sorry for the delayed response. A sub-process requires either a standard start and end event or an intermediate start and end event. This is because by definition a Sub-Process is just that a Sub-Process, it is another process. The allowance for intermediate events allows a Sub-Process to be and error catching process.

The requirements are not within the parser code, however, each element in the Elements namespace has a function called IsValid. Here some additional validations occur. Beyond that there is also class attributes called RequiredAttribute, these ensure that certain required attributes for the xml element of that element exist.

stoneyowl commented 5 years ago

Okay, thanks. I guess I never really got into subprocesses because the company I an contracting to do not use them. I found the Validations and required attributes after I sent the message, so that is good. All I really need now is a good example of using the engine for some sort of simulation of a model. I can almost see it, but some concrete example(s) would help a lot.

roger-castaldo commented 5 years ago

Sorry for the delayed response. I will try to build a more concrete example to simulate how to use it, but it will take me a few days.

stoneyowl commented 5 years ago

Not a problem, take your time. Ran into another problem, however. I am using Signavio exported bpmn files and keep getting an error about missing 'bpmn:definition' tags. I am looking at either manually inserting the tags, or changing your code to ignore that error. I don't really want to do either, since it is a change to either the input data or the processing of that data. Is there anyway to ignore the error? (I am using the omg.net reference files from Signavio)

roger-castaldo commented 5 years ago

can you send me a sample file exported from Signavio so I can examine it.

stoneyowl commented 5 years ago

Here is the simplest one.....change extension to .xml or .bpmn

A.3.0-export.txt

roger-castaldo commented 5 years ago

I have opened up the validation components a bit to allow for loading when the xml file doesn't use prefixes for the tag. There is still a problem with the process you supplied in that there is missing elements inside the sub process. Attached is a sample/test application that loads a VacationRequest process and prompts for some answers as well as generates some outputs. This should give you a basic idea of how the system operates and the difference between events and delegated steps to be handled inside a process. Also includes some extension elements to give an idea of how to handle them. TestApplication.zip

stoneyowl commented 5 years ago

Thanks, I will try it out on some my other files. I know they do not meet bpmn definitions, not sure why the omg group allowed them into the reference file list :( And the actual tool exports the same non-standard proprietary structures. But ...., it is what I have to work with.

stoneyowl commented 5 years ago

Well, things are progressing - I can read all Signavio files now with no errors. My next step is to animate t he map. I can see you use 'snapshots' to create an animated gif file, is there any way to access the model elements so I can draw and animate the process myself? I can see the _Elements internal list, but would there be a problem exposing it as a public list?

roger-castaldo commented 5 years ago

The idea behind this library is to be able to interpret and run the BPMN document without understanding the document, just interfacing with event and action functionality. That is also the idea behind the animation is to simply play out for someone how the process executed and what steps were taken (which is why it requires a process state). The idea behind not exposing the _Elements object is based purely on those concepts, that those items do not need to be exposed as someone utilizing this library does not need to interpret or understand them.

stoneyowl commented 5 years ago

Understand. My client wants to add breakpoints at arbitrary places in the graphics of the simulation, and dynamic views of the data as it is transformed. If this can be done using the event structure, that will work. I am going to examine the events available to see what can be done. Thanks for all your time on this, I know you have not worked on it for a while.

roger-castaldo commented 5 years ago

Adding in extension elements to tag when to take a snapshot of the current process would assist in handling that through either the event or step delegates. This would also allow you to snapshot the process variables at that particular point in time as well. I believe in the sample code I provided earlier you should be able to gleam what I am referring to about custom extension elements.

On a side note I have not really added to this library in a while as I found it to be stable and capable of doing what I set out to do.