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 mine BPMN using HeuristicMiner CLI

Hello,

I'm currently trying to mine a BPMN with the HeuristicsMiner algorithm using CLI.
I found this tutorial https://dirksmetric.wordpress.com/2015/03/11/tutorial-automating-process-mining-with-proms-command-line-interface/,
After browsing source codes for the plugins, I was able to put together this (previous code is identical to the tutorial):

18 System.out.println("TranslatingN");
19 pn_and_marking = convert_heuristics_net_into_petri_net(net);
20 org.processmining.plugins.converters PetriNetToBPMNConverter conv = new  org.processmining.plugins.converters.PetriNetToBPMNConverter(pn_and_marking[0]);
21 bpmn=conv.convert();
22 System.out.println("Saving");
23 org.processmining.plugins.bpmn.plugins BpmnExportPlugin.export(bpmn);
24 System.out.println("done");

but I was not able to mine a BPMN model sucessfully.

I get the following (line numbers are the ones listed above):

Error while executing '[-f, script_alpha_miner.txt]'
org.processmining.contexts.scripting.ScriptExecutor$ScriptExecutionException: Parse error at line 20, column 62.  Encountered: conv
Exception in thread "main" org.processmining.contexts.scripting.ScriptExecutor$ScriptExecutionException: Parse error at line 20, column 62.  Encountered: conv

Can someone help to try to mine a BPMN using CLI?
Thanks in advance!



Comments

  • Hello,

    I guess the problem is that on line 20 there is a space (no dot) between org.processmining.plugins.converters and PetriNetToBPMNConverter. As a result it takes the latter as a variable, and then does not know what to do with the following conv.

    Kind regards,

    Eric.

  • NiceNick
    edited May 2018
    Hello hverbeek,

    Now I get the following:
    org.processmining.contexts.scripting.ScriptExecutor$ScriptExecutionException: Sourced file: inline evaluation of: ``System.out.println("Loading"); log = open_xes_log_file("myFile.xes");  System.ou . . . '' : Typed variable declaration : Constructor error: Can't find constructor: org.processmining.plugins.converters.PetriNetToBPMNConverter( org.processmining.models.graphbased.directed.petrinet.impl.PetrinetImpl ) in class: org.processmining.plugins.converters.PetriNetToBPMNConverter : at Line: 20 : in file: inline evaluation of: ``System.out.println("Loading"); log = open_xes_log_file("myFile.xes");  System.ou . . . '' : new org .processmining .plugins .converters .PetriNetToBPMNConverter ( pn_and_marking [ 0 ] )

    After looking at the source code I found this constructor:
    public PetriNetToBPMNConverter(PetrinetGraph petriNet, Place initialPlace, Marking finalMarking)


    How do I define the initialPlace and the final marking? Is there a simpler way to achieve this?

    Best Regards.

  • Hello,

    It might be better to call the conversion plug-in itself instead of a method used by the plug-in. Something like follows:

    20+21 bpmn = convert_petri_net_to_bpmn_diagram(pn_and_marking[0]);

    The idea is that you can use the name of a plug-in (in this case "Convert Petri net to BPMN diagram") as a method name in the script. Like you did for "open_xes_log_file".

    Kind regards,

    Eric.

  • Hello hverbeek,

    Thanks for the tip, I had no idea that the plug-in annotation could serve as a method to be called in the script (previous code was grabbed from the tutorial).
    Will try to develop the script.

    Best regards and thanks for your help.
  • Hello hverbeek,

    I got the script to start the plugin like you mentioned, but now I get this:

    Start plug-in Convert Petri net to BPMN diagram
    Exception in thread "main" java.lang.NullPointerException
        at java.util.TreeMap.getEntry(TreeMap.java:347)
        at java.util.TreeMap.containsKey(TreeMap.java:232)
        at org.processmining.framework.util.collection.AbstractMultiSet.add(AbstractMultiSet.java:115)
        at org.processmining.framework.util.collection.AbstractMultiSet.add(AbstractMultiSet.java:60)
        at org.processmining.plugins.converters.PetriNetToBPMNConverterPlugin.retrieveInitialMarking(PetriNetToBPMNConverterPlugin.java:268)
        at org.processmining.plugins.converters.PetriNetToBPMNConverterPlugin.convert(PetriNetToBPMNConverterPlugin.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.processmining.framework.plugin.impl.PluginDescriptorImpl.execute(PluginDescriptorImpl.java:251)
        at org.processmining.framework.plugin.impl.AbstractPluginDescriptor$1.doInBackground(AbstractPluginDescriptor.java:151)
        at org.processmining.framework.plugin.ProMFuture$1.doInBackground(ProMFuture.java:56)
        at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at javax.swing.SwingWorker.run(SwingWorker.java:334)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    -------- The following exception was logged by the framework:
             The exception was probalby handled properly.
    java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at javax.swing.SwingWorker.get(SwingWorker.java:602)
        at org.processmining.framework.plugin.ProMFuture.get(ProMFuture.java:119)
        at org.processmining.framework.plugin.impl.AbstractPluginDescriptor$1.done(AbstractPluginDescriptor.java:189)
        at org.processmining.framework.plugin.ProMFuture$1.done(ProMFuture.java:66)
        at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
        at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
        at javax.swing.Timer.fireActionPerformed(Timer.java:313)
        at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    Caused by: java.lang.NullPointerException
        at java.util.TreeMap.getEntry(TreeMap.java:347)
        at java.util.TreeMap.containsKey(TreeMap.java:232)
        at org.processmining.framework.util.collection.AbstractMultiSet.add(AbstractMultiSet.java:115)
        at org.processmining.framework.util.collection.AbstractMultiSet.add(AbstractMultiSet.java:60)
        at org.processmining.plugins.converters.PetriNetToBPMNConverterPlugin.retrieveInitialMarking(PetriNetToBPMNConverterPlugin.java:268)
        at org.processmining.plugins.converters.PetriNetToBPMNConverterPlugin.convert(PetriNetToBPMNConverterPlugin.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.processmining.framework.plugin.impl.PluginDescriptorImpl.execute(PluginDescriptorImpl.java:251)
        at org.processmining.framework.plugin.impl.AbstractPluginDescriptor$1.doInBackground(AbstractPluginDescriptor.java:151)
        at org.processmining.framework.plugin.ProMFuture$1.doInBackground(ProMFuture.java:56)
        at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at javax.swing.SwingWorker.run(SwingWorker.java:334)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

    Source code:

    System.out.println("TranslatingN");

    pn_and_marking = convert_heuristics_net_into_petri_net(net);

    petri = pn_and_marking[0];

    bpmn=convert_petri_net_to_bpmn_diagram(petri);
    Any idea how to solve this?

    Best regards.

  • Hi,

    The problem seems to be that the Petri net (petri) you feed into the converter does not have a source place,that is, a place without incoming edges. The converter handles that badly, but really needs the source place as the start condition for the BPMN diagram.

    Kind regards,

    Eric.
  • Hello hverbeek,

    Thanks for your continuous assistance.
    The petri-net plugin only takes petri-nets, so I can't feed the markings (obtained by the convert_heuristics_net_into_petri_net) as input. How can I provide the source place? I am using the repairExample.xes that is available on the ProM website, if that helps.
  • Hi,

    You cannot provide the source place other than by providing a Petri net that contains such a place. As far as I can tell, the result from the heuristics miner (after conversion) is a Petri net in which every place has input arcs.

    Kind regards,

    Eric.
  • Hello hverbeek,

    With the GUI I am able to use these plugins to obtain a BPMN but I'm not able to do so with the CLI. Is there a way to do what I intend? I'm a bit confused on this subject.

    Best regards.
  • Hi,

    Yes there is. You need to change your script a bit. Please replace the following lines:
    System.out.println("Getting log info");
    org.deckfour.xes.info.XLogInfo logInfo = org.deckfour.xes.info.XLogInfoFactory.createLogInfo(log);

    System.out.println("Setting classifier");
    org.deckfour.xes.classification.XEventClassifier classifier = logInfo.getEventClassifiers().iterator().next();
    by:
    System.out.println("Setting classifier");
    org.deckfour.xes.classification.XEventClassifier classifier = new org.deckfour.xes.classification.XEventNameClassifier();
    Much simpler, and this does what you want to do.

    The problem was caused by the fact that the script just retrieved a classifier from the log. As a result, you got the "Resource" classifier where you wanted (I assume) the "Event name" classifier. The Heuristics Miner was then told to use the "Resource" classifier, which resulted in a hand-over-of-work network, which was cyclic. As a result, the Petri net was cyclic, and the converter to BPMN crashed as it could not locate a source place.

    By using the change mentioned above, the script will use the "Event name" classiifer, and the result is the same as using the GUI.

    BTW, in the mean time the BPMN converter has also been fixed. It will not crash  anymore if there is no source place.

    Kind regards,

    Eric.

  • Hello hverbeek,

    I was not aware that I was throwing the resource classifier instead of the "Event Name" classifier, which was indeed what I wanted!
    Thank you for your support! Works like a charm now!

    Best regards.
  • Hi,
    I tried the same for ProM 6.4. I am able to get bpmn using GUI but in commandline, it given an error - command not found:convert_petri_net_to_bpmn_diagram for line bpmn=convert_petri_net_to_bpmn_diagram(pn_and_marking[0]). 
    Please suggest how can I fix it.
    Thanks

  • Hey,

    If you use the command -l (I think) instead of calling the script, you will get a printed list of all packages that you have installed. If convert_petri_net_to_bpmn_diagram doesn't show try install the package "BPMNConversions" using the package manager. This package contains the plug-in that you require. https://svn.win.tue.nl/repos/prom/Packages/BPMNConversions/Trunk/src/org/processmining/plugins/converters/


    Best Regards. 
  • Hi Nick, I am wondering that I see convert perti net to bpmn in the GUI.. doesn't it mean that it is installed? Also when I open package manager, the package manager shows BPMNConverisons in the 'Up to Date' list. 
  • Monika
    edited July 2018
    Hi @NiceNick and @hverbeek, I am using the following code:
    System.out.println("Loading");

    log = open_xes_log_file("input-file-path");

    System.out.println("Gettinginfo");

    org.deckfour.xes.info.XLogInfo logInfo = org.deckfour.xes.info.XLogInfoFactory.createLogInfo(log);

    System.out.println("Settingsifier");

    org.deckfour.xes.classification.XEventClassifier classifier = logInfo.getEventClassifiers().iterator().next();

    System.out.println("Creatingistics miner settings");

    org.processmining.plugins.heuristicsnet.miner.heuristics.miner.settings.HeuristicsMinerSettings hms = new org.processmining.plugins.heuristicsnet.miner.heuristics.miner.settings.HeuristicsMinerSettings();

    hms.setClassifier(classifier);

    System.out.println("Callingr");

    net = mine_for_a_heuristics_net_using_heuristics_miner(log, hms);

    System.out.println("TranslatingN");

    pn_and_marking = convert_heuristics_net_into_petri_net(net);

    System.out.println("Setting classifier");

    org.deckfour.xes.classification.XEventClassifier classifier = new org.deckfour.xes.classification.XEventNameClassifier(); 

    bpmn=convert_petri_net_to_bpmn_diagram(pn_and_marking[0]);

    System.out.println("done")

    and it gives error as:
    Command not found: convert_petri_net_to_bpmn_diagram( org.processmining.models.graphbased.directed.petrinet.impl.PetrinetImpl )

    How can I fix this? I am confused as the BPMN Conversions package is installed still I get this error. Any help much appreciated. 

    Thanks
  • Hey,

    hverbeek's comment on 31 May (in this post) didn't help you?
    I was having issues with the plugin and that solved the issue.
  • Hi Monika,

    Are you using the same PROM_USER_FOLDER for both the GUI-based ProM and the script-based ProM? This field is defined in the ProM.ini file, and determines the folder where ProM will be looking for packages.

    If you run both the GUI-based ProM and the script-based ProM from the same directory, they should use the same ProM.ini file and the same folder, but it not, then chances are that the script-based ProM is using a different folder than the GUI-based ProM.

    Why are you first setting the classifier to the first classifier as found in the log, then mine for the heuristics net, and then later on change the classifier to the XEventNameClassifier? The classifier is only used when mining the net, changing it afterwards has no effect.

    Kind regards,

    Eric.

Sign In or Register to comment.