query-b645f9406eff3d14421ba55d6fe0d397

rq turtle/ttl

Show all taxa that are also instances of (as opposed to subclasses of) some kind of organism SELECT ?item ?itemLabel WITH { SELECT DISTINCT ?item WHERE {
?item wdt:P31/wdt:P279 wd:Q16521 . hint:Prior hint:gearing "forward". ?item wdt:P31/wdt:P279 wd:Q7239 . hint:Prior hint:gearing "forward". } LIMIT 100 } as %i WHERE { INCLUDE %i OPTIONAL {?item wdt:P39 ?P39.} # ?item rdfs:label ?itemLabel . filter(lang(?itemLabel)="en") # SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Show all taxa that are also instances of (as opposed to subclasses of) some kind of organism
SELECT ?item ?itemLabel WHERE
{
   {
    SELECT DISTINCT ?item WHERE {   
      ?item wdt:P31/wdt:P279* wd:Q16521 .

      ?item wdt:P31/wdt:P279* wd:Q7239 .

    } LIMIT 100 }   OPTIONAL {?item wdt:P39 ?P39.}
 #  ?item rdfs:label ?itemLabel . filter(lang(?itemLabel)="en")
 # SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?P39") v1("?item"):::projected a1((" ")) a2((" ")) c3(["wd:Q16521"]):::iri c4(["wd:Q7239"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P39".-> v2 end