query-2bd704b6bf0ac6cd0f35ec45e3f8a84a

rq turtle/ttl

QueriesHi, I am looking for the code allowing to extract instances of a class X including instances of subclasses of class X. Ex.: I1 is instance of X1 I2 is instance of X2 X2 is subclass of X1 I want both I1 and I2. So how can I modify the following code:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT * WHERE {
  ?compound wdt:P31/wdt:P279* wd:QX
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?compound"):::projected a1((" ")) c3(["wd:QX"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3