@@ -0,0 +1,964 @@
+%0Aimport traildb.*;%0A%0Aimport java.io.FileNotFoundException;%0A%0Apublic class Wikipedia %7B%0A%09public static long SESSION_LIMIT = 3600;%0A%09public static void sessions(TrailDB tdb) %7B%0A%09%09TrailDBCursor cursor = tdb.cursorNew();%0A%09%09long n = tdb.numTrails();%0A%09%09long totalSessions = 0;%0A%09%09long totalEvents = 0;%0A%0A%09%09for (long i = 0; i %3C n; i++) %7B%0A%09%09%09TrailDBEvent event;%0A%09%09%09cursor.getTrail(i);%0A%09%09%09event = cursor.next();%0A%09%09%09long prevTime = event.timestamp;%0A%09%09%09long numSessions = 1;%0A%09%09%09long numEvents = 1;%0A%09%09%09while ((event = cursor.next()) != null) %7B%0A%09%09%09%09if (event.timestamp - prevTime %3E SESSION_LIMIT)%0A%09%09%09%09%09numSessions++;%0A%09%09%09%09prevTime = event.timestamp;%0A%09%09%09%09numEvents++;%0A%09%09%09%7D%0A%09%09%09totalSessions += numSessions;%0A%09%09%09totalEvents += numEvents;%0A%09%09%7D%0A%09%09System.out.println(%22Trails: %22 + n + %22Sessions: %22 + totalSessions + %22 Events: %22 + totalEvents);%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) throws FileNotFoundException %7B%0A%09%09TrailDB tdb = new TrailDB(%22wikipedia-history.tdb%22);%0A%09%09sessions(tdb);%0A%09%7D%0A%7D

Add Wikipedia example