query-7f9143137d370e5eb1145d61e368fb9b

rq turtle/ttl

– anything where some sort of “fallback” makes sense. (P1843)taxon common name , and (P1786)posthumous name , (P1449)nickname Other properties that may be used in this way include clause for “member of some moon mission” and another one for “member of Apollo 13”. But we only want to select those results where at least one of those conditions is true. OPTIONAL (close enough, right?). That restriction can’t be expressed as a single property path, so we need one (Q182252)Apollo 13 blocks has been fulfilled. For example, let’s get all astronauts that went to the moon, as well as the members of OPTIONAL to ensure that at least one of several FILTER with BOUNDYou can also combine

Use at

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
{
  ?astronauta wdt:P31 wd:Q5;
             wdt:P106 wd:Q11631.
  OPTIONAL {
    ?astronauta wdt:P450 ?misja.
    ?misja wdt:P31 wd:Q495307.
  }
  OPTIONAL {
    ?astronauta wdt:P450 wd:Q182252.
    BIND(wd:Q182252 AS ?misja).
  }
  FILTER(BOUND(?misja)).
  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; v2("?astronauta") v3("?misja") c7(["wd:Q182252"]):::iri c9(["bd:serviceParam"]):::iri c11(["#91;AUTO_LANGUAGE#93;"]):::literal c2(["wd:Q5"]):::iri c4(["wd:Q11631"]):::iri c6(["wd:Q495307"]):::iri f0[["bound(?misja)"]] f0 --> v3 v2 --"wdt:P31"--> c2 v2 --"wdt:P106"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P450".-> v3 v3 --"wdt:P31"--> c6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P450".-> c7 bind1[/"'wd:Q182252'"/] bind1 --as--o v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end