User:Bluerasberry/sandbox

From Wikidata
Jump to navigation Jump to search
count of properties for all instances of an item
SELECT DISTINCT ?property ?propertyLabel ?count
WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P31*/wdt:P279* wd:Q20820271 .
  }
  LIMIT 200000
  } AS %items 
WITH {
  SELECT DISTINCT ?property (COUNT(*) AS ?count) WHERE {
  INCLUDE %items.
    ?item ?p [ ] .
    ?property a wikibase:Property;
                wikibase:claim ?p.
  }
  GROUP BY ?property 
  LIMIT 100
  } AS %results 
WHERE {
  INCLUDE %results.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?count)
LIMIT 100
Try it!