query-8627080d108276136395396572125369
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (COUNT(?up) AS ?up_only)
WHERE
{
values ?item {wd:Q384250} .
optional {?item p:P1029 ?tom.
optional {?tom pq:P518 ?applies. } }
BIND(IF(?applies=wd:Q854248,1,1/0) AS ?up)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?applies")
v1("?item"):::projected
v2("?tom")
v4("?up"):::projected
v5("?up_only")
c4(["bd:serviceParam"]):::iri
c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?item/]
bind0-->v1
bind00(["wd:Q384250"])
bind00 --> bind0
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P1029".-> v2
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:qualifier/P518".-> v3
end
end
bind1[/"if(?applies = 'wd:Q854248','1^^xsd:integer','1^^xsd:integer' / '0^^xsd:integer')"/]
v3 --o bind1
bind1 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end
bind3[/"count(?up)"/]
v4 --o bind3
bind3 --as--o v5