Revision history date sorting on query

The [examples on how to query the revision history] ( sort the results by date (ORDER BY DESC(?date)).

However, is it not possible that 2+ transactions are commited in the same millisecond and thus the resulting order of the commits might result in a non-chronological sort of the commits.

For instance, if three commits (commited in order A, B, C) occured during the same smallest time unit supported by xsd:date (millisecs, if I’m not mistaken), the SPARQL engine would not find any difference for the 3 commits, and so any sort on those 3 elements would be “correct” (according to SPARQL semantics).

Does Stardog somehow ensure that ORDER BY DESC(?date) ends up with the correct chronological order even if dates are repeated?

Thanks in advance!

If you look at the revision history metadata you’ll see that the order of commits is actually tracked by following prov:wasRevisionOf so the information is there to reconstruct the exact order but I suspect that date is being used as a proxy because of the difficulty in constructing these types of queries that Evren wrote about in a recent post.

I would think that the result order from the sparql query could not be used for an absolute ordering in the case of identical commit times and you would have to follow the wasRevisionOf links to get that.

Ok, thanks for the information! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.