query-6d91bab80580786f905b9449384bd125
A property's qualifier property counts, includes a SPARQL query of instances. (P1630)formatter URL Property
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?qual ?qualLabel ?count (IRI(CONCAT("https://query.wikidata.org/#%23%20qualifier%20-%20", ?qualLabel, "%0ASELECT%20%3Fitem%20%3FitemLabel%20%3FqualLabel%0AWHERE%0A{%0A%09%3Fitem%20p%3AP1630%20%3Fstatement%20.%0A%20%20%20%20%3Fstatement%20pq%3A", SUBSTR(STR(?qual),32), "%20%3Fqual%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20%20}%20%20%20%20%0A}%0AORDER BY %3FitemLabel")) as ?instances)
WHERE {
{
SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) WHERE {
?item p:P1630 ?statement .
?statement ?pq_qual ?pq_obj .
?qual wikibase:qualifier ?pq_qual .
} GROUP BY ?qual
} .
OPTIONAL {
?qual rdfs:label ?qualLabel filter (lang(?qualLabel) = "en") .
}
}
ORDER BY DESC(?count) ASC(?qualLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?count"):::projected
v8("?instances")
v3("?item")
v6("?pq_obj")
v5("?pq_qual")
v7("?qual"):::projected
v2("?qualLabel"):::projected
v4("?statement")
v3 --"p:P1630"--> v4
v4 -->v5--> v6
v7 --"wikibase:qualifier"--> v5
bind1[/"count(?item)"/]
v3 --o bind1
bind1 --as--o v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."rdfs:label".-> v2
end
bind2[/"concat('https://query.wikidata.org/#%23%20qualifier%20-%20',?qualLabel,'%0ASELECT%20%3Fitem%20%3FitemLabel%20%3FqualLabel%0AWHERE%0A{%0A%09%3Fitem%20p%3AP1630%20%3Fstatement%20.%0A%20%20%20%20%3Fstatement%20pq%3A',substring(str(?qual),'32^^xsd:integer'),'%20%3Fqual%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20%20}%20%20%20%20%0A}%0AORDER BY %3FitemLabel')"/]
v2 --o bind2
v7 --o bind2
bind2 --as--o v8