query-f5efa47af18bed5240802b76c1214739
Order-by oddness (seems to have memory?)Task T327029PhabricatorTracked in Has anybody else been seeing any oddness with ORDER BY recently? E.g.: Here's a query to list the numbers of sitelinks to redirects, and their types, by wiki The first time I run it, enwiki comes to the top, as having the largest total number of redirects by some margin. If I now re-sort the table by intentional redirects dewiki comes to the top. So far so normal. But if I now run the query again in a new window, I find dewiki now at the top of the re-run query. Is anybody else getting this? Is it just a typo I've missed somewhere in my query? Or is this a genuine thing? If this kind of 'memory' is going on then, as well as making queries harder to debug, I can imagine there might be certain queries where it's quite hard to get back to the original ordering after it's been sorted differently, so where it might be quite important to be able to just hit the re-run button to do this. (Could also be some kind of browser caching issue, specific to a particular browser). So I'm quite curious: is anyone else seeing this?
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
SELECT ?project ?total_redirects ?intentional_redirects ?pct_intentional ?other_redirects ?pct_other
WHERE {
{
SELECT ?project (COUNT(DISTINCT ?intentional_sitelink) AS ?intentional_redirects) (COUNT(DISTINCT ?other_sitelink) AS ?other_redirects) WHERE {
{
?intentional_sitelink schema:isPartOf ?project; wikibase:badge wd:Q70894304 .
} UNION {
?other_sitelink schema:isPartOf ?project; wikibase:badge wd:Q70893996 .
}
} GROUP BY ?project
}
BIND (?intentional_redirects + ?other_redirects AS ?total_redirects) .
BIND ((ROUND(1000.0 * ?intentional_redirects / ?total_redirects) / 10.0) AS ?pct_intentional) .
BIND ((ROUND(1000.0 * ?other_redirects / ?total_redirects) / 10.0) AS ?pct_other) .
} ORDER BY DESC (?total_redirects)