query-5e16b2f65d783bc89719c04ed1c52051

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?property ?propertyLabel ?count     # group this subquery to get a count
WHERE
{
   {
  SELECT ?property (COUNT(?ppp) AS ?count)  # use a named subquery first to do the count
  WHERE 
  {
     {
  SELECT ?item WHERE
    {
      ?item wdt:P39 [] .
      } LIMIT 100000 }    ?item p:P39 [?ppp [] ].               # P580 statement with a qualifier or reference
    ?property wikibase:qualifier ?ppp.     # it's a qualifier & we get the property name
    }  GROUP BY ?property }                            # get the label for the property here once we have a list of properties and counts
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es,en". }
} ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?count"):::projected v2("?item") v3("?ppp") v4("?property"):::projected a1((" ")) a3((" ")) a2((" ")) c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,es,en"]):::literal v2 --"p:direct/P39"--> a1 a2 -->v3--> a3 v2 --"p:P39"--> a2 v4 --"wikibase:qualifier"--> v3 bind1[/"count(?ppp)"/] v3 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end