Datetime values with timezone offsets sort before/after all values without an offset.
The query below has been adapted from one meant to show a list of photos sorted to show the most recent first. With a mix of photos from different sources some new ones appeared to be missing, but were ultimately discovered to just be sorted at the end of the list. Looking at the values of the contentCreated field, it could be seen that there was a group of all datetimes with timezone offsets sorted correctly within the group, followed by a group of all datetimes without timezone offsets.
SELECT ?p5 ?p6 WHERE { GRAPH tracker:Pictures { SELECT nie:title(?x) as ?p5 nie:contentCreated(?x) as ?p6 WHERE {?x a nmm:Photo . ?x nie:isStoredAs ?file GRAPH tracker:FileSystem { ?file nie:dataSource ?dataSource . ?dataSource tracker:available true . } FILTER((!fn:starts-with(nie:isStoredAs(?x),'file:///home/user/Music')&&!fn:starts-with(nie:isStoredAs(?x),'file:///home/user/Pictures/Screenshots/')&&!fn:starts-with(nie:isStoredAs(?x),'file:///home/user/android_storage/')))} GROUP BY ?x ORDER BY DESC(nie:contentCreated(?x))}}