XQuery/Timelines of Resource

Motivation
You want to create a timeline using the creation and modification dates of a collection.

Method
Many file systems and XML databases such as the eXist database automatically keep two dates associated with each resource. One is the creation date and the other is the date the resource was last modified. These dates are required for many systems that perform incremental backups of resources.

We can use these dates to automatically create a timeline report of one or more collections. These reports can server as audit trails and can help you find out who changed what and when.

Here are two of the functions that we will use in these examples: xmldb:last-modified($collection as item, $resource as xs:string) xs:dateTime? xmldb:created($collection as xs:string, $resource as xs:string) xs:dateTime

Note that you can also use the created function with a single parameter to see when a collection was created.

Our query will take a single parameter, the database path expression to the collection we wish to create a timeline for. Our timeline will then display the creation and modification dates for this collection.

Here is a sample query fragment that lists all child of the resources in a collection and formats the data according to the timeline event XML structure.

This will return a file of in the following format: