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.

no read XEvent

benfy85benfy85 Posts: 12
edited March 2012 in - Development
Hi all,
I have a new problem.. 
I used this code to find the name of the event XEvent, I just do not return the name of the event, I do not return anything.
What is wrong?
Thank you!


for(XEvent event:trace2) {
try {
XExtendedEvent extendedEvent2 = XExtendedEvent.wrap(event); 
String eventName2 = extendedEvent2.getName();
Date timestamp2 = extendedEvent2.getTimestamp();
     }catch (Exception e) { 
System.out.printf("Error into trace 2");
      }
}

Answers

  • aadriansaadrians Posts: 20
    Hi Benfy85,

    I wonder what sort of "name" that you'd like to extract from an XEvent object. If you'd like to extract an event class/timestamp of an XEvent object from a log, what I typically do is write the following code:

    XLog log; // this is given
    XTrace trace; // this is also given

    XTimeExtension extractor = XTimeExtension.instance(); // utility object to extract timestamp

    XLogInfoImpl logInfo = XLogInfoFactory.createLogInfo(log);
    XEventClasses eventClasses = logInfo.getEventClasses();
    for (XEvent event : trace){
      // extracting the name of the event class of the event
      eventClasses.getClassOf(event).toString();

      // extracting its timestamp
      Date timestamp = extractor.extractTimestamp(event);
    }

    I hope it helps,

    Regards,
    Arya
  • benfy85benfy85 Posts: 12
    Thank you,  I have been very helpful for your help.

    The eventName that I mean into "file.MXML" corrisponds to
    <WorkflowModelElement>eventName</WorkflowModelElement> 

    and in this code return return the string "eventName+record".
    that corrisponds to 

    <WorkflowModelElement>eventName</WorkflowModelElement>
    <EventType unknowntype="record">unknown</EventType>

    How can I get only the eventName?

    Thank you :)


    Erika
  • benfy85benfy85 Posts: 12
    I found how to solve the problem, I used this code:

    int q=0;
    for(XEvent event:trace2) {
    eventName1 = XConceptExtension.instance().extractName(trace2.get(q));
    q++;
    }
    You have unlocked me.
    Thank you, :)

    Erika
  • JBuijsJBuijs Posts: 914
    Hi Erika,

    Why don't you do it like this?

    for(XEvent event:trace2) {
    String eventName1 = XConceptExtension.instance().extractName(event);
    }

    I do not see the need/use for the q index since in the for loop you already extract the events from the trace.
    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
  • benfy85benfy85 Posts: 12
    You are right! 
    I have not thought, because I used this code to get the track by:
    XConceptExtension.instance () extractName (log.get(t)).
    But  you have solved  another problem that came out during the execution.
    Thank you,  :)

    Erika

Sign In or Register to comment.