Last modified: 2012-11-20 11:34:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T35705, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33705 - Request: sort by property values without restricting query results to require this property value
Request: sort by property values without restricting query results to require...
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
http://tieteentermipankki.fi/wiki/Tes...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-13 14:20 UTC by Niklas Laxström
Modified: 2012-11-20 11:34 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Niklas Laxström 2012-01-13 14:20:54 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.
Comment 1 Jeroen De Dauw 2012-01-13 14:22:44 UTC
Bug for Markus I guess :)
Comment 2 Markus Krötzsch 2012-02-11 17:06:51 UTC
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.
Comment 3 Niklas Laxström 2012-02-11 17:44:06 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links