query-d29f8e28991f343d03a2afd7c25503d4

rq turtle/ttl

Count qualifiers of a property

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?qual ?qualLabel (COUNT(DISTINCT ?item) AS ?count) WHERE {


     ?item p:P214 ?statement .     # for example, VIAF ID
     ?statement ?pq_qual ?pq_obj . # a triple involving the qualified statement ...     
     ?qual wikibase:qualifier ?pq_qual . # ... with a predicate ?pq_pred that is a qualifier

     SERVICE wikibase:label {
         bd:serviceParam wikibase:language "en" .
     }

}  GROUP BY ?qual ?qualLabel
ORDER BY DESC (?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?count") v2("?item"):::projected v5("?pq_obj") v4("?pq_qual") v6("?qual"):::projected v3("?statement") c4(["bd:serviceParam"]):::iri c6(["en"]):::literal v2 --"p:P214"--> v3 v3 -->v4--> v5 v6 --"wikibase:qualifier"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end bind1[/"count(?item)"/] v2 --o bind1 bind1 --as--o v7