Last modified: 2012-11-20 11:34:56 UTC
See the example page. Apparently this is well known bug, but I couldn't find it from this bugzilla. I was able to dig into the queries: Default sort: SELECT DISTINCT t3.smw_id AS id,t3.smw_title AS t,t3.smw_namespace AS ns,t3.smw_iw AS iw,t3.smw_subobject AS so,t3.smw_sortkey AS sortkey FROM `smw_ids` AS t3 INNER JOIN `smw_rels2` AS t0 ON t3.smw_id=t0.s_id WHERE (t0.p_id='821' AND t0.o_id='6343') ORDER BY t3.smw_sortkey ASC LIMIT 21; Other sort: SELECT DISTINCT t3.smw_id AS id,t3.smw_title AS t,t3.smw_namespace AS ns,t3.smw_iw AS iw,t3.smw_subobject AS so,t3.smw_sortkey AS sortkey FROM `smw_ids` AS t3 INNER JOIN `smw_rels2` AS t0 ON t3.smw_id=t0.s_id INNER JOIN `smw_atts2` AS t5 ON t3.smw_id=t5.s_id WHERE (t0.p_id='821' AND t0.o_id='6343') AND (t5.p_id='803') ORDER BY t5.value_xsd ASC LIMIT 21; By changing INNER JOIN to OUTER JOIN and removing the new AND condition I get some results, but my SQL skills are not enough to determine whether it would also return bogus results in some cases. And even if that was the correct query, I'm not able to change the SMW query generator to make such query.
Bug for Markus I guess :)
Actually, this is not a bug but the expected behaviour. SMW requires sort properties to be set. If anything else is documented in the manual, then this should be corrected. It might be possible to change the SQL and SPARQL generation procedures to do this differently, but I think there is a risk of this leading to problems with various database tools, even if it is allowed according to the respective standards. And it might have an impact on performance. I leave this open as a feature request in case somebody wants to take this challenge in the future.
The use case is very clear: you have items you want to show in some order, not all of them might have the sorting field set.