query-ac527754222df66395be255b56cd764e
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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 ?launch (count(?tom) as ?crew) (sum(if(!bound(?applies),1,0)) as ?both_ways) (sum(?up) as ?up_only) (sum(?down) as ?down_only)
WHERE
{
?item wdt:P31 wd:Q752783.
?item wdt:P361 wd:Q1775296.
optional {?item p:P1029 ?tom.
optional {?tom pq:P518 ?applies. } }
bind(if(?applies=wd:Q854248,1,0) as ?up)
bind(if(?applies=wd:Q844947,1,0) as ?down)
optional {?item wdt:P619 ?launch.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?item ?itemLabel ?launch order by ?launch
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?applies"):::projected
v8("?both_ways")
v7("?crew")
v6("?down"):::projected
v10("?down_only")
v2("?item"):::projected
v1("?launch"):::projected
v3("?tom"):::projected
v5("?up"):::projected
v9("?up_only")
c4(["wd:Q1775296"]):::iri
c2(["wd:Q752783"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"p:direct/P31"--> c2
v2 --"p:direct/P361"--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:P1029".-> v3
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:qualifier/P518".-> v4
end
end
bind0[/"if(?applies = 'wd:Q854248','1^^xsd:integer','0^^xsd:integer')"/]
v4 --o bind0
bind0 --as--o v5
bind1[/"if(?applies = 'wd:Q844947','1^^xsd:integer','0^^xsd:integer')"/]
v4 --o bind1
bind1 --as--o v6
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P619".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end
bind6[/"count(?tom)"/]
v3 --o bind6
bind6 --as--o v7
bind7[/"sum(if(not bound(?applies),'1^^xsd:integer','0^^xsd:integer'))"/]
v4 --o bind7
bind7 --as--o v8
bind8[/"sum(?up)"/]
v5 --o bind8
bind8 --as--o v9
bind9[/"sum(?down)"/]
v6 --o bind9
bind9 --as--o v10