Tracking Events Using a Semi-Structured Repository : Page 4

Tracking the activities of a system and its users is too often not considered until the application is already deployed. Learn how to demonstrate an (almost) no hassle persistent bean pool that you can use to track the activities of an already developed system for later review.

by James Leigh

Apr 24, 2008

Page 4 of 4

Tracking Events
Multi-user applications often do not properly track system events. This is sometimes caused by the complexity involved in persisting them. In any system there are many types of events (sometimes hundreds of types). When using a database to persist events, the overhead for maintaining a database schema with so many event types, and new event types being created with every new feature, is high. However, by using a semi-structured repository, the overhead for persisting events is greatly reduced.

To persist events in OpenRDF Elmo you need to create an interface for the event objects. You can use the same
technique for persisting events as used previously for persisting exceptions. Create an event type interface as shown
in Listing 4.

You can also create an event implementation class for this interface and merge it into the manager as shown
previously, or use the delegate manager's designate method, shown here:

The user and modified targets will also need to have interfaces, with annotations, listed in the
elmo.roles file for them to be persisted. Objects that are referenced by multiple objects or
events, such as user and modified targets, should have a getQName method. This method must return a qualified name that will be used to uniquely identify it in the repository.

With events now stored in the repository, you can use the repository to provide a history of the system.
For example, to find out how an object was modified, you can query the repository.

Tracking creation events is a similar by creating an interface and persisting it like in Listing 5.
This event has an extra property reason that stores the user's inputted goal at the time of creation. This gives the user a chance to provide the reason why they are making a chance. This information can then be later retrieved using a query and provides necessary information to assess the correctness of the operation.

Conclusion
Semi-structured repositories can provide more flexibility and less maintenance than traditional persistence layers.
This type of repository is ideal for structures that are continually changing, have diverse properties, or are
managed by independent teams. You can use the OpenRDF Elmo library to persist a wide variety of objects without necessarily modifying the original source. Without a lot of setup, you have seen how to create a repository, use it in your own software, and access it through a convenient search and browser interface.

James Leigh is an independent software consultant based in Toronto, has experience modeling business problems and concepts in software, and specializes in performance and technology integration. James has a background in semantic web technologies and decentralized networks. He is an active member in the OpenRDF community, and he's a developer of Sesame and Elmo.