Add a sort by lifetime support
We should add a new table "lifetime" that maps open events to close events
This will allow us to sort stuff by "how long was rhythmbox open" and "how long was document X" opened
Instead of the user having to query all events and map them manually on the client side we can do that much quicker by introducing the lifetime table.
The structure of the table will look the following
| access_timestamp | access_event_id | leave_timestamp | leave_event_id |
What we will do
1) For each ACCESS event a new entry in the table is inserted with access_timestamp = event.timestamp and access_event_id = event.id as well as leave_timestamp = event.timestamp and leave_event_id = event.id
2) For each MODIFY event we overwrite leave_timestamp =event.timestamp and leave_event_id = event.id for the matching | access_timestamp | access_event_id |. We then add a new entry in the table with the rules of 1)
--> Modfiy events act as a leave for currently accessed files as well as act as a new access
3) Upon a leave event we just overwrite the last leave event.
This approach is inspired by the Nepomuk guys http://
Another approach would be adding a new property to event: MATCHING_SUCCESSOR this will be handled the same way as stated above. Using matching successor we can calculate duration (lifetime) of a subject of an actor on the engine side.
I however prefer the first solution.
What do you think?