How to automatically generate the Petri net model using inductive miner?
I am using ProM 6.6 for my process analysis tasks (Petri net model and decision rules and trace variants generation). Now, I want to automate the generation of the Petri net model from the XES log using Java (the petri net model is generated using the inductive miner). So, using the rapidprom and the openXES jars, I wrote the code:
public class PetriNetGenerationAutomationClass {
//here, I want to load the default parameters ("variant=Inductive Miner (IM)" and "Event classifier=concept:name" as in proM 6.6)
//Export the petri net model in pnml format
\\To avoid the error "The method writeToFile(File, Petrinet, PetriNetFileFormat) is undefined for the type PetriNetGenerationAutomationClass" I copied and pasted the function in my code
The code above is generating a NullPointerException error, caused by the "writeToFile". Is there any other solutions allowing us to export the petri net model in pnml format? are the mining parameters specified correctly?
I appreciate your feedback,
Regards,
Widad
Widad Es-Soufi
PhD Student
“Decision-making support in the context of systems design and supervision”
Arts et Métiers ParisTech. France.
Comments
-
Dear Widad,Can you provide us with a stack trace showing the NullPointerException? That may give some clue to what went wrong.The problem may not be in the exporter.Kind regards,
Eric. -
Dear Eric,
Please find below the stack trace:java.lang.NullPointerExceptionat PetriNetGenerationAutomationClass.writeToFile(PetriNetGenerationAutomationClass.java:114)at PetriNetGenerationAutomationClass.main(PetriNetGenerationAutomationClass.java:92)
This error is on:
Line 92: writeToFile(outputPNMLFile, petriNetModel, format);
Line 114: exporterPNML.exportPetriNetToPNMLFile(RapidProMGlobalContext.instance().getPluginContext(), object, file);break;
Appreciate your feedback,
Best,
Widad
Widad Es-Soufi
PhD Student
“Decision-making support in the context of systems design and supervision”
Arts et Métiers ParisTech. France.
-
I think that the NullPointerException comes from the "RapidProMGlobalContext.instance().getPluginContext()" of the
exportPetriNetToPNMLOrEPNMLFile(RapidProMGlobalContext.instance().getPluginContext(), petriNetModel, outputPNMLFile, type);
Indeed, I tried to print the content of all the parameters, I successfully got the:
- node list of the generated petri net,
- path of the output pnml file (that I specified in top of the code)
- type name (pnml)
But when it comes to printing the "RapidProMGlobalContext.instance().getPluginContext().getLabel()", I get the java.lang.NullPointerException
This means that there is actually no plugin context.
Do you have any idea how to get the right context?
Thank you!
Best,
WidadWidad Es-Soufi
PhD Student
“Decision-making support in the context of systems design and supervision”
Arts et Métiers ParisTech. France.
-
Dear Widad,Perhaps you can use the solution as mentioned on http://www.win.tue.nl/promforum/discussion/comment/657/#Comment_657? There, the poster creates a CLIPluginContext using two lines of code, and uses that context.Kind regards,
Eric.
-
Dear Eric,
Thank you for the link. I pasted these two lines in my code:CLIContext context = new CLIContext();CLIPluginContext pluginContext = new CLIPluginContext(context, "test");
exporterPNML.exportPetriNetToPNMLFile(pluginContext, petriNetModel, outputPNMLFile);
Where "petriNetModel" is the petri net model and the "outputPNMLFile" is the output file, but I still get the same error.
Thank you,
Best,
Widad
Widad Es-Soufi
PhD Student
“Decision-making support in the context of systems design and supervision”
Arts et Métiers ParisTech. France.
-
Dear Widad,
This stack trace indicates that there is a problem with the exporter. What I do not understand is why the exporter throws a NPE at line 147 of PnmlInscription, as this line is inside of a try block that comes with a catch for any Exception. The NPE should have been caught and dealt with.Kind regards,
Eric. -
Is there another way to export the "Petrinet petriNetModel" ? or to transform it into a document so that I can export it using the PNML framework in eclipse?
Thank you,
Best regards,
WidadWidad Es-Soufi
PhD Student
“Decision-making support in the context of systems design and supervision”
Arts et Métiers ParisTech. France.
-
Dear Wadid,Perhaps better to try to use the ProM Nightly Build (see http://www.promtools.org/doku.php?id=nightly) instead of ProM 6.6. This way, the sources we're working on match the ones you are using, and we can fix them more easily. There's no use for us to try to fix an older release which uses older source files.There is no other export available that I know of that may result in a PNML file, except perhaps for the BPMN export. But then you would need to convert the Petir net into a BPMNmodel first, export that one, and then convert the BPMN file into a PNML file by some means.Kind regards,
Eric.
-
Dear Eric,
I think I found a solution to get the Petri net model from an XES log using the command line based on the solution proposed here. The problem now is that I want to change the mining parameters (org.processmining.plugins.InductiveMiner.mining.MiningParametersIMi parameters = new org.processmining.plugins.InductiveMiner.mining.MiningParametersIMi();) in particular, the Variant (change it from "Inductive Miner - infrequent (IMF)" (Figure 1) to "inductive Miner (IM)" (Figure 2)), is this possible?
Thanks,
Best,
Widad
Widad Es-Soufi
PhD Student
“Decision-making support in the context of systems design and supervision”
Arts et Métiers ParisTech. France.
-
Dear Wadid,Yes, that should be possible.Given that you want to call the "IM" variant, I would create the mining parameters differently:
org.processmining.plugins.InductiveMiner.mining.MiningParameters parameters = new org.processmining.plugins.InductiveMiner.mining.MiningParametersIM();
This creates the default parameters for the variant you want to use. You could then call:mine_petri_net_with_inductive_miner__with_parameters(log, parameters);
(I'm not too sure about the double underscores between "miner" and "with", perhaps there need to be only one, please check.)As before, the result will be an array containing the following objects (in the given order):- the Petri net discovered,
- the initial marking for this Petri net, and
- the final marking for this Petri net.
However, I'm not sure this will solve your problem. I still fail to understand why code that is in a proper try-catch block throws unhandled exceptions. But one never knows...Kind regards,
Eric.
Howdy, Stranger!
Categories
- 1.6K All Categories
- 45 Announcements / News
- 225 Process Mining
- 6 - BPI Challenge 2020
- 9 - BPI Challenge 2019
- 24 - BPI Challenge 2018
- 27 - BPI Challenge 2017
- 8 - BPI Challenge 2016
- 68 Research
- 1K ProM 6
- 393 - Usage
- 287 - Development
- 9 RapidProM
- 1 - Usage
- 7 - Development
- 54 ProM5
- 19 - Usage
- 187 Event Logs
- 32 - ProMimport
- 75 - XESame