To prevent spam users, you can only post on this forum after registration, which is by invitation. If you want to post on the forum, please send me a mail (h DOT m DOT w DOT verbeek AT tue DOT nl) and I'll send you an invitation in return for an account.

How to automatically generate the Petri net model using inductive miner?

Dear all,

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 {

public static void main(String[] args) throws FileNotFoundException, Exception {
//loading the xes file
String xesFilePath = "C:\\TraceVariantTest\\runningExample.xes";
File file = new File(xesFilePath);
String outputPNMLFilePath = "W:\\TraceVariantTest\\OutputPNML";
File outputPNMLFile = new File(xesFilePath);

XLog myXesLog = XUtils .loadLog(file);
System.out.println("myXESLog is succesfully read! \n");

//here, I want to load the default parameters ("variant=Inductive Miner (IM)" and "Event classifier=concept:name" as in proM 6.6)
XEventClassifier classifier = MiningParameters.getDefaultClassifier();
MiningParameters parameters = new org.processmining.plugins.InductiveMiner.mining.MiningParametersIMi();

Object[] object = IMPetriNet.minePetriNet(myXesLog, parameters); //I don't understand why am I having an object[] here, but I assume the petri net model is the first element
Petrinet petriNetModel = (Petrinet) object[0];
PetriNetFileFormat format = PetriNetFileFormat.PNML;

//Export the petri net model in pnml format
writeToFile(outputPNMLFile, petriNetModel, format); //of the ExportPetriNetOperator class
}

\\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

static void writeToFile(File file, Petrinet object, PetriNetFileFormat format) throws IOException {
switch (format) {
case EPNML:
PnmlExportNetToEPNML exporterEPNML = new PnmlExportNetToEPNML();
exporterEPNML.exportPetriNetToEPNMLFile(RapidProMGlobalContext.instance().getPluginContext(), object, file);
break;
case PNML:
default:
PnmlExportNetToPNML exporterPNML = new PnmlExportNetToPNML();
exporterPNML.exportPetriNetToPNMLFile(RapidProMGlobalContext.instance().getPluginContext(), object, file);
break;
}
}

}


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.






Sign In or Register to comment.