query-9f7daf7cedce9ef11b78df0b27886385
13:39, 16 August 2021 (UTC)) talk (Tagishsimon --:Is this what you're afterTagishsimon@
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?number (MAX(?count) AS ?maxcount) WHERE { # right now, get labels and an aggregation which does nothing
{ SELECT ?item ?number ?property (COUNT(?predicate) as ?count) WHERE { # get & count claims for the items
{ SELECT ?item ?number WHERE { # get items having that many statements
INCLUDE %i
BIND(xsd:integer(?number) as ?b)
?item wikibase:statements ?b.
FILTER NOT EXISTS {?item wdt:P31 wd:Q13442814 .}
} } ?item ?predicate [].
?property wikibase:claim ?predicate .
} GROUP BY ?item ?number ?property ORDER BY DESC(?count) } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?item ?itemLabel ?number order by desc(?number)