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.

Extract Log Name

keith_low
edited November 2011 in - Development
Hi all,

How can I extract the name of the log as defined in the event log? For example, I wanted to extract the name "repairExample.xes" (or better, "repairExample", without the .xes extension) from the line <string key="concept:name" value="repairExample.xes"/> inside the log.

I've tried

String strLogName = xceConceptExt.extractName(log);

but it returns me "repairExample_Filtered.xes" (the name of the file I named on my computer), instead of "repairExample.xes". Is there any other way to extract the value of the key "concept:name" in the event log?

Thanks in advance.

Comments

  • I think what you need is:

    String strLogName = log.getGlobalTraceAttributes().get(0).getAttributes().get("concept:name").toString()

    Hope this works,
    Andrzej
  • Hmm it doesn't really work, where the code you provided grabs nothing. I tried

    log.getGlobalTraceAttributes().get(0).getAttributes().values()

    and it returns an empty array. Below is an example of my log. I am still trying to figure out a way to extract that part. Anyway thanks a lot too!

    <log .....>
    ....
    <global scope="trace">
    <string key="concept:name" value="__INVALID__"/>
    </global>
    <global scope="event">
    <string key="concept:name" value="__INVALID__"/>
    <string key="lifecycle:transition" value="complete"/>
    </global>
    <classifier name="MXML Legacy Classifier" keys="concept:name lifecycle:transition"/>
    <classifier name="Event Name" keys="concept:name"/>
    <classifier name="Resource" keys="org:resource"/>
    <string key="source" value="CPN Tools simulation"/>
    <string key="concept:name" value="repairExample.xes"/>
    <string key="lifecycle:model" value="standard"/>
    <string key="description" value="Simulated process"/>
    <trace>
    .....
    </trace>
    </log>
  • Hi Keith and Andrzej,

    Extracting a name from any event log element can be done using the following code:

    private XConceptExtension conceptExtension = XConceptExtension.instance();
    String objectName = conceptExtension.extractName(object);

    Where 'object' is your event log, trace or event instance.
    The idea is that you ask an instance of the conceptExention to extract the name from the object.
    It is generally a good idea to make the conceptExtension instance available in your whole class (hence the private, it is declared as a Java class variable).
    Joos Buijs

    Senior Data Scientist and process mining expert at APG (Dutch pension fund executor).
    Previously Assistant Professor in Process Mining at Eindhoven University of Technology
Sign In or Register to comment.