query-5018418bdf19c21c2925714946622db1
How to get all the items in the results of this query to be sorted by the amount of interwiki links (sitelinks)Does anyone know why this query does not sort the results by the amount of interwiki links each article has? (the top item on this list says that the CNT=585 while in reality it is 38)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?movie ?movieLabel (COUNT(?sitelink) AS ?cnt)
WHERE {
?movie wdt:P31 wd:Q11424. # item is a film
?movie wdt:P577 ?release_date. # item has a publication date (release date)
FILTER (?release_date >= "1980-01-01T00:00:00Z"^^xsd:dateTime && ?release_date < "1990-01-01T00:00:00Z"^^xsd:dateTime) # filter by date range
?sitelink schema:about ?movie.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
MINUS {
_:article schema:about ?movie; schema:isPartOf <https://he.wikipedia.org/>. # exclude items with an article on hewiki
}
}
GROUP BY ?movie ?movieLabel
ORDER BY DESC(?cnt) # order by the count of sitelinks in descending order
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?cnt")
v3("?movie"):::projected
v2("?release_date")
v4("?sitelink"):::projected
a1((" "))
c8(["bd:serviceParam"]):::iri
c12([https://he.wikipedia.org/]):::iri
c10(["en"]):::literal
c4(["wd:Q11424"]):::iri
f0[["?release_date >= '1980-01-01T00:00:00Z^^xsd:dateTime'?release_date < '1990-01-01T00:00:00Z^^xsd:dateTime'"]]
f0 --> v2
v3 --"wdt:P31"--> c4
v3 --"wdt:P577"--> v2
v4 --"schema:about"--> v3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
a1 --"schema:about"--> v3
a1 --"schema:isPartOf"--> c12
end
bind3[/"count(?sitelink)"/]
v4 --o bind3
bind3 --as--o v5