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.
Passing a array of XLogs as parameter
Hey all!
I had a quick question. I have a plugin that uses a parameter XLog[], an array of XLogs. I have another plugin that (succesfully) returns an XLog[] object. The problem is that ProM does not recognize the input as XLog[], instead it asks for a normal XLog.
Does anyone know a solution to this problem?
Thanks in advance,
Bram
Code:
public static String helloWorld(PluginContext context, XLog original_log, XLog[] sublogs)
ProM:
I had a quick question. I have a plugin that uses a parameter XLog[], an array of XLogs. I have another plugin that (succesfully) returns an XLog[] object. The problem is that ProM does not recognize the input as XLog[], instead it asks for a normal XLog.
Does anyone know a solution to this problem?
Thanks in advance,
Bram
Code:
public static String helloWorld(PluginContext context, XLog original_log, XLog[] sublogs)
ProM:
Answers
-
Hi Bram,The difference between both will become evident when you assign logs to both slots:This image is from a different plug-in, but shows what I mean: The first log is the first parameter, a single log. The second log is the first of an array, which is indicated by the additional symbol. Selecting that symbol adds a slot for another element to that array. The third log is the second element of in the array.Cheers,Eric.
-
Hi Eric,
First of all thanks for the quick and good answer! I tested it and it works as you explained.
I have one more question though :-) I have one plugin that returns a XLog[] array that I want to use in a second plugin. Is there a way to directly do so? I tried an ArrayList but ProM refuses them as parameters.
I could, of course, run the first plugin several times, each time creating a log I then put into the array of the second. This is quite a task however, so I was wondering if there is a automatic way.
Thanks again,
Bram -
Hi Bram,You cannot use generics in parameters of plug-ins, because the information is not available at run-time. For example, if you use ArrayList<XLog> as the type of a parameter, then at run-time Java will only know the ArrayList<?> part, the information that the array contained logs is lost. This is a Java thing.A work-around is to create a class that extends ArrayList<XLog>, and to use that new class instead for the parameter.You could also use the existing EventLogArray class from the Log package.Cheers,
Eric. -
Hey Eric,
The use of an EventLogArray worked out! Thanks a lot!
Cheers,
Bram
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