query-04588b73f7b5a1a77b59776410deed08

rq turtle/ttl

All instances of spacecraft or it's subclasses ... Query to find all instances of spacecraft (Q40218) or it's sub-classesI tried this

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 DISTINCT ?item ?itemLabel {
  ?item wdt:P31* wd:Q40218
  OPTIONAL { ?item wdt:P31 ?linkTo }
  SERVICE wikibase:label {bd:serviceParam wikibase:language "en" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?linkTo") c2(["wd:Q40218"]):::iri c4(["bd:serviceParam"]):::iri c6(["en"]):::literal v1 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end