query-10e1155f1cdc4d49bf8023190cacbb1d

rq turtle/ttl

All fish tetrapods. (P1011)excluding . OK, so I added a qualifier to say to (Q160830)Sarcopterygii and tetrapods are (Q19159)Tetrapoda , so I first thought there's an error, but it happens that lions are (Q140)lion , but it happened to also return me (Q55983715)organisms known by a particular common name (P31)instance of (Q152)fish I tried to get all species of fish by going through the qualifiers of So far so good. What's a query that returns me all species of fish now, given this new addition? I thought

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
select ?taxon {
  wd:Q152 p:P31 ?s .
  ?s ps:P31 wd:Q55983715 .
  ?s pq:P642 ?o .
  ?taxon wdt:P171* ?o .
  minus {
    ?s pq:P1011 ?x .
    ?taxon wdt:P171* ?x .
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?o") v1("?s") v3("?taxon"):::projected v4("?x") c4(["wd:Q55983715"]):::iri c1(["wd:Q152"]):::iri c1 --"p:P31"--> v1 v1 --"p:statement/P31"--> c4 v1 --"p:qualifier/P642"--> v2 v3 --"p:direct/P171"--> v2 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"p:qualifier/P1011"--> v4 v3 --"p:direct/P171"--> v4 end