Search code examples
algorithmxml-parsingjbpmbpmn

Visual BPMN 2.0 diff tool for JBPM


I would like to know what would be in your opinion the easiest/more efficient way to create a visual tool to compare BPMN 2.0 processes using JBPM web designer?


Solution

  • ...way to create a visual tool to compare BPMN 2.0 processes using JBPM web designer?

    I don't know how I'd implement it, neither what can JBPM designer do neither if it's already solved in an existing tool so I can't pick some easiest or efficient solution.

    But based on the fact that BPMN models are actually XML files and XML files are actually text files, I would try to reduce the problem to the text diff visualization.

    From the 2 XMLs (old, new) create new "diff" XML using some existing text-oriented diff algorithm where the "added" things would be marked as green "removed" marked as red and "modified" marked as blue. If the resulting "diff" XML would be properly formatted BPMN file then just showing it in a BPMN viewer would show the differences visually.

    I don't keep track of the text diff or binary diff problem for quite long time, but besides consulting Wikipedia: DIFF topic, some proven sources I'm aware of are:

    1. WinMerge is very mature and useful text-diff tool and it's source code repository contains some text-diff algorithms implemented in C++ and C - sourceforge.net/p/winmerge/code/HEAD/tree/trunk/Src/diffutils/src
    2. Angus Johnson created awesome freeware with source code TextDiff tool implemented in Delphi. The application is build around TDiff component which is (according to the readme) based on papers "An O(ND) Difference Algorithm and its Variations" by E Myers - Algorithmica Vol. 1 No. 2, 1986, pp. 251-266 and "An O(NP) Sequence Comparison Algorithm" by Sun Wu, Udi Manber & Gene Myers. Both papers in PDF and their source code incarnation are included in the downloadable zip
    3. As side product of computing Levenshtein distance between two strings can be set of "add", "copy", "delete" operations needed to transform the old string to the new one. If you assign colors to the operations you can get the colored visualization of the difference

    All of the above contains some "Computer Science" stuff, which was for me difficult to comprehend, but the corresponding code simply does work. For instance while studying the Angus Johnson's tool (I was adding support for comparing complete folders not only files) there were some notes in the comments and readmes claiming that

    → comparing text files is special case of comparing vectors of strings which is special case of comparing vectors of numbers (string hashes) which is some straighforward(?) N-dimensional math problem(!?)

    I'm selling what I've bought few years ago, understanding it and using it is up to you, but I believe it might be useful ;)