Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any BPMN 2.0 Parser for .NET?

Tags:

.net

parsing

bpmn

In general, I am searching for a way to Model business processes. I found UML and BPMN quite often as an answer to this. Now I want to check this models with a Program. There is only an UML specification HOW this elements should look like, not how this different models should be saved. Thats why I looked closer at BPMN. There is a BPMN 2.0 specification be the Object Management Group.

I downloaded a BPMN editor and start to play with this notation. Now I want to start to write a program that checks this BPMN 2.0 files (more precisely they are xml files). Is there any .NET Framework and/or Implementation that work with this BPMN ? I just don't want to write my own extended XML Parser for this.

If not: What other Models can be used to do a programmatic check on this kind of models ?

About the checks: I want to search if different kind of information can be found in the models and throw warnings if this information can not be found.

like image 413
user2757652 Avatar asked Sep 07 '13 19:09

user2757652


People also ask

Is BPMN IO free?

With bpmn.io we build a toolkit that aims accomplish nothing more than this. Because we believe free and easily accessible tools can make the difference, bpmn.io will be open source and free to use for everyone.

Can Visio open BPMN files?

Enterprise Studio supports importing BPMN model data in the following file formats: BPMN, Visio, and Lean.

What is BPMN XML?

BPMN 2.0 defines standardized formats for creating XML files which contain both aspects. This allows exchanging BPMN processes between tools of different vendors. Mirroring the two aspects of BPMN processes, these XML BPMN files comprise two parts: • One or more process models contain the semantics.


2 Answers

It seems that there is corently no BPMN 2.0 Parser for .NET, but with the xsd.exe, that is Part of the Microsoft SDK, it is possible to create one by your own, not only for BPMN. How to do it:

  • Download the 5 xsd Files from the omg: http://www.omg.org/spec/BPMN/2.0/ and place them in the same folder.
  • run the xsd.exe with four parameters: xsd.exe DC.xsd DI.xsd BPMNDI.xsd BPMN20.xsd /classes

The fifth file will be added by the Application. Be sure to have the correct order of the xsd. Otherwise it won't work.

On my Maschine the Call looks like this:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\xsd.exe" "C:\Users\me\DC.xsd" "C:\Users\me\DI.xsd" "C:\Users\me\BPMNDI.xsd" "C:\Users\me\BPMN20.xsd" /classes

As a result you will receive a BPMN20.cs with all classes in there. You can even change the output language (default is C#). Just run xsd.exe without a parameter to see all options.

To use it in .Net, be sure to add System.Xml as a Assembly, then you can get the Object like this:

var serialzer = new XmlSerializer(typeof(tDefinitions));
var XmlStream = new StreamReader("bpmn.xml");
var document= (tDefinitions) serialzer.Deserialize(XmlStream);
like image 97
user2757652 Avatar answered Oct 30 '22 07:10

user2757652


A workaround with the problem of the answer of @user2757652 is to modify BPMN20.xsd and Semantic.xsd downloaded from http://www.omg.org/spec/BPMN/2.0/. other files can be used unchanged.

I replaced flowElement ref with its ancestors (in Semantics.xsd) and rootElement ref (in BPMN20.xsd) with process and collaboration. you might relplace all ancestors of rootElement. altough the resulting xsd is not standard and could validate some invalid BPMN XMLs, it fulfilled my needs

you can download the modified version from Github Gist

like image 23
mjalil Avatar answered Oct 30 '22 09:10

mjalil