Serializing & Parsing Logs

The SEWOL framework already comes with functionalities to read logs from other frame- works or serialize and use them with other tools.

Serializing Logs

The serialization classes for logs are located in the package writer. The class LogWriter takes a path to the output file and a subclass of AbstractLogFormat to define the target file format as parameters. Currently SEWOL supports the export of logs in the MXML and plain (whitespace-separated lists of activities) file formats.

The following code serializes the formerly defined traces in the MXML file format and writes them to the file traces.mxml under the path /path/:

LogWriter w = new LogWriter(LogFormatFactory.MXML(), "/path/traces");
w.writeTrace(traceA);
w.writeTrace(traceB);
w.writeTrace(traceC);
w.closeFile();

Parsing Logs

Logs can also be imported using SEWOL’s built-in parser. It currently supports the XES, Petrify, and plain file formats. Since some file formats allow multiple logs in a single file, the parser returns a list of lists of log traces. All parser classes can be found in the package parser. The class LogParser “guesses” the file format by the file extension.

The following code parses the file logs.xes under the path /path/:

List<List<LogTrace<LogEntry>>> logs = LogParser.parse("/path/logs.xes");