Hi Steven,
Finally a quick response.
In a nutshell: “You are right” ;) I think you already summarized the status quo pretty well: Timestamps are only available for the whole database, and for binary files (for which simply the OS timestamp will be returned).
In our applications, we mostly use RESTXQ to organize additional meta data properties for documents. They will usually be stored in an additional meta data database. I agree this won’t be helpful if you use WebDAV and other low-level APIs. Apart from the discussed trigger feature, there is another issue that is somewhat related with your feature request for organizing document metadata [1]: Various default properties could be defined that will always be refreshed automatically if a document is created or updated. For now, due to lack of time and resources, I’m sorry to say that both issues are still on hold.
Best, Christian
[1] https://github.com/BaseXdb/basex/issues/988
On Wed, Aug 14, 2019 at 5:12 AM Majewski, Steven Dennis (sdm7g) sdm7g@virginia.edu wrote:
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