I thought I could use db:list-details($db)/@modified-date to select the resources that have most recently been updated ( to generate an OAI or RSS feed ) however, on doing a db:replace of one of the resources, I’m either not seeing the date change at all, or I’m seeing the modified-date of all of the resources update together.
I find an explanation in the archives: https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg09668.htm...
Exactly: Nothing will be replaced in BaseX if your source and target XML node is identical (this holds true for both documents as well as any other node in a document).
Please note that XML documents have no individual timestamps in BaseX. Instead the timestamp of the database will be changed if nodes are changed.
Do I parse that correctly in saying that when I try to replace a document with an identical document, it doesn’t register as an update, but when I do change and update the document, it changes the timestamp for the whole database, and there is no timestamp for individual resources ?
So I assume that if I want to track updated resources, I would have to either add timestamps to the documents themselves, or else track this info somewhere else, maybe in SQL and use sql: functions from within BaseX.
Maybe best method is to add timestamp as a processing instruction or comment to avoid any changes to the body of the document: insert node processing-instruction modifiedDateTime { current-dateTime()} as first into $D
That would work if doing the updates from an XQuery script and calling db:replace and then adding the timestamp, However, not very reliable if the resource can be updated by another method ( WEBDAV for example ) unless there is a way to trigger xquery function on update. I find from searching the mailing list archives a link to an issue discussing adding database triggers, but it appears to be on hold:
https://github.com/BaseXdb/basex/issues/1082
Any news on this or suggestions of alternatives ?
— Steve Majewski