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.

Number of repeats of a trace in a log

VladVlad Posts: 2
edited June 2012 in - Development
Hi all,

Can you please tell me if the ProM API provides some kind of functionality for find how many times a trace repeats in a log, and by these I am referring to the number of times a sequence of activities like (A,B,C,D) repeats.

Thank you for your answers/


  • jcbosejcbose Posts: 37

    You can have that functionality from the PatternAbstractions Package. Note that you need to checkout the latest version from the SVN for this.

    The required functionality is provided through the following steps and APIs:

    1. First create a set of event classes. Let us call this activitySet. The current implementation assumes that the classifier is Activity Name+"-"+Event Type, e.g., Register-start, Repair (Simple)-start etc.,

    2. Encode the set of activities generated in step 1 using the following API:
    EncodeActivitySet eas = new EncodeActivitySet(activitySet)

    this provides several methods, three of which would be required for you
    a. eas.getActivityCharMap() -> A hashmap containing the encoding of each activity into a char or a charstream
    b. eas.getCharActivityMap() -> A hashmap containing the char/charstream and its corresponding activity
    c. eas.getEncodingLength() -> the encoding length for each activity (if the number of distinct activities is beyond 65, then the encoding length would be 2, otherwise, it will be 1)

    3. Encode the traces in the log into charstreams using the class EncodeTraces

    EncodeTraces et = new EncodeTraces(eas.getActivityCharMapA(), log);

    4. You can get the count of how many times a trace repeats using the following API


    This will return a hashmap containing the charstream of a trace and its corresponding count. For e.g,,

    abcd, 4 or

    a0b0c0d0 4

    You can now parse the charStream keys from the map by using the encoding length if you want to get a sequence like you want

    For e.g., abcd => (a, b, c, d)  (encoding length=1)
    a0b0c0d0 => (a0, b0, c0, d0) (encoding length=2);

    Hope this helps.

  • VladVlad Posts: 2
    Thanks JC.

    It worked like you said.
Sign In or Register to comment.