query-0b363a15a4b3b4209ebd5e5b3c9b5f9c
Get all parent taxonsI am trying to extract all the parent taxon (P171) definitions in wikidata. So the output I want is a long list of pairs of taxon (P225) and parent taxon IDs. The problem I'm having is that I don't get all the parent taxons, but just one (except for some cases!). In my output I only get Tetrapod (Q19159) as parent taxon for Mammal (Q7377) but there are 4 items in the database. The query I am using is:
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?item ?parenttaxon WHERE {
?item wdt:P171 ?parenttaxon.
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?parenttaxon"):::projected
v1 --"wdt:P171"--> v2