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.

Add new classifier

Hi everyone,

I'm developing my plugin and it I need some help at this stage. 
I would like to ask for the source code of the add "XEventClassifier" based on events log attributes.
So, any one can help me with that?

Kind Regards
Henda
Tagged:

Comments

  • hverbeekhverbeek Posts: 456
    Hi Henda,

    Assume that variable log holds the log (XLog) to which you want to add the new classifier, that variable name holds the name (String) for the new classifier, and that variable keys holds the array of attribute keys (String[]) to be used for the new classifier:

    log.getClassifiers().add(new XEventAttributeClassifier(name, keys));

    Kind regards,

    Eric.




  • HendouchHendouch Posts: 7
    Thank you very much Eric.
    Kind regards
    Henda
  • HendouchHendouch Posts: 7
    Hi everyone,
    Could someone help me please to use "
    getDefiningAttributeKeys()" to have an array of attribute keys (String[]).
  • hverbeekhverbeek Posts: 456
    Hi Henda,

    Assume classifier is an event classifier (XEventClassifier), then the following line returns the array of keys:
    classifier.getDefiningAttributeKeys()
    Assume that the classifier is the same as added to the log as mentioned in my previous post, then this would return keys.

    Kind regards,
    Eric.
  • HendouchHendouch Posts: 7
    Hi hverbeek
    I have a result an array with attributes keys of classifiers, but a want to have attributes keys of the log.
  • hverbeekhverbeek Posts: 456
    Hi Henda,

    A log (XLog) is an element with attributes (extends XEleemnt, which extends XAttributable), hence it has a getAttributes() method which provides you with the attribute map (XAttributeMap). This map extends Map<String,XAttribute>, so it has a keyset() method. So, assuming log is an XLog, the following provides you with a collection of all attribute keys:
    log.getAttributes().keyset();
    If you really need a String[] instead of a Collection<String>, then convert the resulting collection to such an array.

    Also see https://svn.win.tue.nl/trac/prom/browser/OpenXES/trunk/src/org/deckfour/xes/model for the sources of the classes you're using.

    Kind regards,
    Eric.
Sign In or Register to comment.