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 implement/reference/run an existing plugin as part of a new plugin?

Hello, I want to create a new plugin to perform some calculations on some log files, but as part of this new plugin, I would also like to implement/run other existing plugin(s) on my log file when I execute my plugin? 

For example, My new plugin is XYZ, then when I run my XYZ plugin, it should also run an existing plugin, let's say "Convert log to Directly follows graph" plugin as part of my new plugin XYZ along with my own new calculations.

What is the approach to extend such functionality? Or more specifically, for my input log file, how do I create a Directly Follows Graph (as output/visualization in the visualisation pane) as part of my new plugin?

PS: I am new to Java development, so please bear my naiveness.

Answers

  • Hi,

    This is not a naive question, as many wonder how to do this in the best possible way.

    The preferred way is to use the tryToFindOrConstructFirstNamedObject method from the plugin context that is passed as first argument to every plugin. This method takes the following parameters:
    1. Class<X> type: The class X of the desired result. In your example this should be the class of the Directly follows graph that you want. Like DirectlyFollowsGraph.class, or something like that.
    2. String name: The name of the plugin you want to use for getting the result. This is the name of the plugin as it is specified in the @plugin annotation.
    3. Class<Connection> connectionType: The type of the connection to use. Please set this to null if you do not want to use connections.
    4. String role: The role of the desired result in a connection. Please set this to null as well if you do not want to use conenctions.
    5. Object... inputs: The inputs to the plugin. In your example this should be the event log. 
    ProM will then look for the plugin with the given name (parameter 2), check whether it can return a result of the desired class (parameter 1) given the provided inputs (parameter 5). If it finds this plugin, it will run the plugin for you and return you the object of the desired class as a result. If you specified the connection type and role string, it will first check the connections whether the desired result is already available through some connection. If not, it will start the plugin as well etc.

    Kind regards,
    Eric.

  • Thank you so much for such quick reply and detailed answer. Can I find any such references in the existing plugins in any packages just an example? I am still trying to understand the framework so I am thinking it would be of great help to analyse any such examples in the existing packages.
  • Hi,

    In https://svn.win.tue.nl/trac/prom/browser/Packages/AcceptingPetriNetMiner/Trunk/src/org/processmining/acceptingpetrinetminer/miners/impl you will find some examples on how you can call certain miners. Some of them will use the way I described, others may use a different approach.

    Kind regards,
    Eric.

  • Thank you so much, it worked :) 
Sign In or Register to comment.