query-f5efa47af18bed5240802b76c1214739

rq turtle/ttl

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

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)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?intentional_redirects"):::projected v2("?intentional_sitelink") v6("?other_redirects"):::projected v4("?other_sitelink") v7("?pct_intentional"):::projected v8("?pct_other"):::projected v3("?project"):::projected v7("?total_redirects"):::projected c3(["wd:Q70894304"]):::iri c4(["wd:Q70893996"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"schema:isPartOf"--> v3 v4 --"wikibase:badge"--> c4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"schema:isPartOf"--> v3 v2 --"wikibase:badge"--> c3 end union0r <== or ==> union0l end bind2[/"count(?intentional_sitelink)"/] v2 --o bind2 bind2 --as--o v5 bind3[/"count(?other_sitelink)"/] v4 --o bind3 bind3 --as--o v6 bind4[/"?intentional_redirects + ?other_redirects"/] v5 --o bind4 v6 --o bind4 bind4 --as--o v7 bind5[/"numeric-round('1000.0^^xsd:decimal' * ?intentional_redirects / ?total_redirects) / '10.0^^xsd:decimal'"/] v5 --o bind5 v7 --o bind5 bind5 --as--o v7 bind6[/"numeric-round('1000.0^^xsd:decimal' * ?other_redirects / ?total_redirects) / '10.0^^xsd:decimal'"/] v6 --o bind6 v7 --o bind6 bind6 --as--o v8