I am doing a project on Petri nets.
I have generated an activity diagram (in the .xmi format) using the UML tool Umbrello. I need to convert it to a Petri net and then synthesize it using the tool Petrify. But in order to convert it to the Petri net, the activity diagram has to be converted into the XML format.
In order to synthesize using petrify, the Petri net has to be converted into .g format, and only afterwards to the .xml format. In short I need to integrate the tools Umbrello, UML2owfn, Petrify and PIPE. How could I integrate these tools using Python?
Conveniently activity diagrams more or less have the semantics of Petri Nets anyway. Here's the deal: you will need to read and parse the activity digram XML first. There are several good options for this in Python; unless your activity diagrams are just massive, you should probably choose one that keeps the whole XML element tree in memory.
Then convert the activity diagram into a bipartite graph. Since an activity diagram can have adjacent activity nodes (bubbles) without transitions (lines), collapse all the adjacent activity nodes into one place in the petri net.
There are several graph libraries in Python as well, but this is fairly simple and it may be easier to just represent the graph as lists of places and transitions, and a list of pairs for the edges.
Once you've got the patri net graph, just walk it to generate the Petrify input and you should be set. If yu really need those intermediate representations, it should be a SMOP to generate them as well.