Open juba opened 1 month ago
Query template for querying taxid + sciname. Problem: it can yield wrong results if duplicated scinames.
SELECT DISTINCT * WHERE {
{SELECT ?gbifID ?otolID ?wormsID WHERE {
?species wdt:P685 "40".
OPTIONAL { ?species wdt:P846 ?gbifID. }
OPTIONAL { ?species wdt:P9157 ?otolID. }
OPTIONAL { ?species wdt:P850 ?wormsID. }
}}
UNION {
SELECT DISTINCT ?gbifID ?otolID ?wormsID WHERE {
?species ?label "Stigmatella"@en.
OPTIONAL { ?species wdt:P846 ?gbifID. }
OPTIONAL { ?species wdt:P9157 ?otolID. }
OPTIONAL { ?species wdt:P850 ?wormsID. }
}}}
Simpler template only querying taxid:
SELECT ?gbifID ?otolID ?wormsID WHERE {
?species wdt:P685 "40".
OPTIONAL { ?species wdt:P846 ?gbifID. }
OPTIONAL { ?species wdt:P9157 ?otolID. }
OPTIONAL { ?species wdt:P850 ?wormsID. }
}
It seems better not to query on sciname to avoid wrong results.
More complete query (here for 9615, canis lupus familiaris):
SELECT ?item ?ncbi ?gbifID ?opentolID ?wormsID ?inaturalistID ?catalogueOfLifeID ?iucn ?iucnStatus WHERE {
?item wdt:P685 "9615".
OPTIONAL { ?item wdt:P685 ?ncbi. }
OPTIONAL { ?item wdt:P846 ?gbifID. }
OPTIONAL { ?item wdt:P9157 ?opentolID. }
OPTIONAL { ?item wdt:P850 ?wormsID. }
OPTIONAL { ?item wdt:P3151 ?inaturalistID. }
OPTIONAL { ?item wdt:P10585 ?catalogueOfLifeID. }
OPTIONAL { ?item wdt:P627 ?iucn. }
OPTIONAL { ?item wdt:P141 ?iucnStatus. }
}
Note: this query can return several rows, as this example illustrates. There are two wikidata entries associated to taxid 9609: Canis familiaris and Canis lupus familiaris.
Should be a double query:
See what identifiers to get back.
See also #6