Skip to content

Conversation

@joewarner
Copy link

I have a requirement to produce some XES files for a project that I am working on and so found my way to this gem.

The first thing that struck me was that REXML produces XML that uses single-quotes for attributes whereas I think most of us would regard double-quotes as more common. Potentially this wouldn't have bothered me until I read about the fact that classifier keys can be grouped using single-quotes - which obviously won't work if the attributes are using single-quotes. I looked for ways to make REXML use double-quotes and although I had limited success I simply couldn't get it to work for the whole file.

So, I decided to switch out the XML implementation from REXML (which I haven't used) to Nokogiri (which I have) which uses double-quotes by default. I think Nokogiri is more common these days and it is certainly a lot faster. As it turned out, this was pretty straight forward in the end - the only significant wrinkle being that a Document is required to create a new Element requiring an additional parameter to most of the format methods - thankfully this wasn't required for the XES::Document format method so this is largely invisible to the user. The result is that there is only one change in the external interface to ruby-xes in the way that the resulting XML is written out to file (you can see this clearly in the example program).

Whilst doing this it seemed to make sense to upgrade everything to XES 2.0 at the same time. This required me to implement list and container attributes - which were really very straight forward in the end.

Doubtless my changes could perhaps have been written more elegantly but I have tried to stay true to the original design - and on the whole I think the result isn't bad. I did have to change some of the tests but thankfully there weren't too many. I also added some new tests for the new list and container attributes.

As a relative newcomer to Ruby I found the documentation too terse so I have added an example program that reads a CSV logfile and formats it as XES. This is quite possibly the weakest aspect of my contribution - not least because I suspect that there are many nuances of XES that I have yet to fully grasp. But hopefully it is a better starting point for newcomers.

Joe

@joewarner
Copy link
Author

I see that the Travis CI build of [presumably] my branch has failed.
Looking at the log I see that the command that has failed is "bundle exec rake" - presumably because rake hasn't been added to the execution environment. Since there were already a number of Rake tests in place then that seems to be a more structural issue with the original code (i.e. on that basis I suspect that the tip of the master branch wouldn't build either).
As I said I am a relative newcomer to Ruby so it is not altogether clear to me how to resolve this problem. Presumably it is necessary to add a dependency on Rake into the gemspec. I'll have a play with this but not altogether sure that I know what I am doing.

@joewarner
Copy link
Author

Build 3 - like build 1 - has also errored, but in a different way. Whereas previously rake didn't seem to be present that doesn't now seem to be the case. This time it says "Don't know how to build task 'default'". I guess that makes sense because I get the same here if I just run "rake". I was running "rake test" to run the test suite locally.
Added a default task to Rakefile and hoping that gets things moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant