query-dfe14d27e1aaaac4d5b24550a75fd5a2
or even
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?astronaut ?astronautLabel
WHERE
{
?astronaut wdt:P31 wd:Q5;
wdt:P106 wd:Q11631 filter exists
{
{
?astronaut wdt:P450/wdt:P31 wd:Q495307.
} union {
?astronaut wdt:P450 wd:Q182252.
}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?astronaut"):::projected
a1((" "))
c4(["wd:Q182252"]):::iri
c9(["bd:serviceParam"]):::iri
c11(["#91;AUTO_LANGUAGE#93;"]):::literal
c5(["wd:Q5"]):::iri
c3(["wd:Q495307"]):::iri
c7(["wd:Q11631"]):::iri
f0[[" "]]
subgraph f0e0["Exists Clause"]
subgraph unione00[" Union "]
subgraph unione00l[" "]
style unione00l fill:#abf,stroke-dasharray: 3 3;
e0v1 --"wdt:P450"--> e0c4
end
subgraph unione00r[" "]
style unione00r fill:#abf,stroke-dasharray: 3 3;
e0v1 --"wdt:P450"--> e0a1
e0a1 --"wdt:P31"--> e0c3
end
unione00r <== or ==> unione00l
end
e0v1("?astronaut"):::projected
e0a1((" ")):::projected
e0c4(["wd:Q182252"]):::iri
e0c3(["wd:Q495307"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
f0 --> c2
f0 --> c3
f0 --> c4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P450"--> c4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P450"--> a1
a1 --"wdt:P31"--> c3
end
union0r <== or ==> union0l
end
v1 --"wdt:P31"--> c5
v1 --"wdt:P106"--> c7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end