query-6471e5ff98b99c5e7b1f462954733c5e
Sorting in histogram 18:40, 25 November 2016 (UTC)) talk (Infovarius, change P577->P571 and Q11424 to Q2088357 and ... sorting breaks. Now X-axis (years) is sorted by Y-values (number of groups). Why? --Wikidata:Request a query/Archive/2016/10#HistogramI take query from To be more specific, compare:
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#defaultView:BarChart
SELECT ?year (count(?item) as ?cnt) WHERE{
?item wdt:P31/wdt:P279* wd:Q11424 .
?item wdt:P577 ?publicationdate .
BIND(str(year(?publicationdate)) as ?year)
FILTER(bound(?year))
} GROUP BY ?year ORDER BY ?year
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?cnt")
v2("?item"):::projected
v3("?publicationdate")
v4("?year"):::projected
a1((" "))
c3(["wd:Q11424"]):::iri
f0[["bound(?year)"]]
f0 --> v4
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v2 --"wdt:P577"--> v3
bind1[/"str(year-from-dateTime(?publicationdate))"/]
v3 --o bind1
bind1 --as--o v4
bind3[/"count(?item)"/]
v2 --o bind3
bind3 --as--o v4