query-baca4810f2f4c0c15a6476cc4addda46
title:Qualifiers for P1114 SELECT DISTINCT ?qual ?qualLabel ?count ?sample ?isAllowed ?isRequired { { SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) (SAMPLE(?statement) AS ?sample) { hint:Query hint:optimizer "None" . ?item p:P1114 ?statement . ?statement ?pq_qual ?pq_obj . ?qual wikibase:qualifier ?pq_qual . } GROUP BY ?qual } . OPTIONAL { wd:P1114 p:P2302 [ pq:P2306 ?qual ; ps:P2302 wd:Q21510851 ] . BIND("y" as ?isAllowed) } OPTIONAL { wd:P1114 p:P2302 [ pq:P2306 ?qual ; ps:P2302 wd:Q21510856 ] . BIND("y" as ?isRequired ) } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY DESC(?count) ASC(?qualLabel)
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Qualifiers for P1114
SELECT DISTINCT ?qual ?qualLabel ?count ?sample ?isAllowed ?isRequired {
{
SELECT ?qual (COUNT(DISTINCT ?item) AS ?count) (SAMPLE(?statement) AS ?sample) {
?item p:P1114 ?statement .
?statement ?pq_qual ?pq_obj .
?qual wikibase:qualifier ?pq_qual .
} GROUP BY ?qual
} .
OPTIONAL { wd:P1114 p:P2302 [ pq:P2306 ?qual ; ps:P2302 wd:Q21510851 ] . BIND("y" as ?isAllowed) }
OPTIONAL { wd:P1114 p:P2302 [ pq:P2306 ?qual ; ps:P2302 wd:Q21510856 ] . BIND("y" as ?isRequired ) }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],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
v9("?isAllowed"):::projected
v10("?isRequired"):::projected
v3("?item")
v6("?pq_obj")
v5("?pq_qual")
v7("?qual"):::projected
v2("?qualLabel"):::projected
v8("?sample"):::projected
v4("?statement")
a1((" "))
a2((" "))
c10(["bd:serviceParam"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c8(["wd:Q21510856"]):::iri
c5(["wd:Q21510851"]):::iri
c6(["wd:P1114"]):::iri
v3 --"p:P1114"--> v4
v4 -->v5--> v6
v7 --"wikibase:qualifier"--> v5
bind2[/"count(?item)"/]
v3 --o bind2
bind2 --as--o v8
bind3[/"sample(?statement)"/]
v4 --o bind3
bind3 --as--o v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a1 -."p:qualifier/P2306".-> v7
a1 --"p:statement/P2302"--> c5
c6 --"p:P2302"--> a1
bind4[/"'y'"/]
bind4 --as--o v9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:qualifier/P2306".-> v7
a2 --"p:statement/P2302"--> c8
c6 --"p:P2302"--> a2
bind5[/"'y'"/]
bind5 --as--o v10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end