[API-users] How to query genus names with the GBIF API

Szlamka József szlajozs at gmail.com
Thu Sep 7 12:12:11 CEST 2017


Dear Markus,

My idea is that based on the validation services provided by GBIF to 
implement a search form with similar functionality (autocomplete, etc.) 
as the "Search for scientific names" form at Catalogue of life:
http://www.catalogueoflife.org/col/search/scientific

What is your opinion, is this way with the GBIF suggest api plus client 
side filtering a proper way? Considering the possible number of 
unnecessary result records (everything where kingdomKey<>6) and the 
number of unnecessary fields in each record (everything except the GENUS 
field), wouldn't that be an unacceptable overload at GBIF side and 
performance / bandwidth issues at the requestor webapp side?

Cheers:
József


2017-09-07 11:47 keltezéssel, Markus Döring írta:
> this is unfortunately not possible.
> You will have to filter them clientside checking for records with 
> kingdomKey=6 or kingdom="Plantae"
>
> Markus
>
>
>> On 7. Sep 2017, at 11:22, Szlamka József <szlajozs at gmail.com 
>> <mailto:szlajozs at gmail.com>> wrote:
>>
>>
>> Dear Markus,
>>
>> Thank you very much. Do you have any idea, using the "suggest" API 
>> would it be possible somehow to filter the results for the Plantae 
>> kingdom only?
>>
>> József
>>
>>
>> 2017-09-07 10:17 keltezéssel, Markus Döring írta:
>>> Hi József,
>>>
>>> the GBIF API hardly anywhere accepts wildcards. Apart from fuzzy 
>>> matching entire words the only place you can use is the suggest API 
>>> which should help you with your problem.
>>>
>>> It is a kind of autocomplete and you have to match the beginning of 
>>> a word. It wont match in the middle or end. It does match on all 
>>> words or tokens of a string, so for a species name it will match the 
>>> genus part, the epithet or even the authorship. Results are 
>>> prioritized with author based matches coming last and higher ranks 
>>> being more important.
>>>
>>> Here is an example:
>>> http://api.gbif.org/v1/species/suggest?datasetkey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c&rank=GENUS&q=Ado
>>>
>>> The suggest API only allows you to retrieve 100 records though, but 
>>> you can page through results up to 100.000 records max:
>>> http://api.gbif.org/v1/species/suggest?datasetkey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c&rank=GENUS&q=Ado&limit=100
>>> -> returns first 100 genera starting with Ado
>>>
>>> http://api.gbif.org/v1/species/suggest?datasetkey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c&rank=GENUS&q=Ado&limit=100&offset=100
>>> -> returns 49 more genera starting with Ado
>>>
>>> http://api.gbif.org/v1/species/suggest?datasetkey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c&rank=GENUS&q=Ado&limit=100&offset=200
>>> -> returns 0 genera as expected
>>>
>>>
>>> Cheers,
>>> Markus
>>>
>>>
>>>
>>>> On 7. Sep 2017, at 08:36, Szlamka József <szlajozs at gmail.com 
>>>> <mailto:szlajozs at gmail.com>> wrote:
>>>>
>>>> Dear Scott,
>>>>
>>>> Many thanks for your answer. I also added the "&highertaxonKey=6" 
>>>> param to narrow the results for plant genera only.
>>>>
>>>> To be more precise what I exactly wish to achieve is as follows:
>>>>
>>>> 1./
>>>> I only want to search within the "Plantae" kingdom.
>>>>
>>>> 2./
>>>> Say, I look for the GENUS name "Adonis" but I only remember that 
>>>> the name starts with "Ado".
>>>>
>>>> 3./
>>>> So my ideal API call would run a wildcard search within PLANT 
>>>> GENERA names for "Ado*" and would result in a list of ALL (without 
>>>> limit) plant genera names starting with "Ado*".
>>>>
>>>> I played with the "/species/match", "/species/search" and 
>>>> "/species/suggest" sub-apis and with the "q" and "name" params. 
>>>> They don't accept wildcards and don't give the expected results for 
>>>> name chunks without wildcards.
>>>>
>>>> Now my only hope is that I left out some constellations or misused 
>>>> something.
>>>>
>>>> József
>>>>
>>>>
>>>> 2017-09-06 23:21 keltezéssel, Scott Chamberlain írta:
>>>>> Have you tried something like
>>>>>
>>>>> http://api.gbif.org/v1/species/search?datasetkey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c&rank=GENUS
>>>>>
>>>>> where datasetkey=d7dddbf4-2cf0-4f39-9b2a-bb099caae36c is for the 
>>>>> GBIF backbone taxonomy
>>>>>
>>>>> Scott
>>>>>
>>>>> On Wed, Sep 6, 2017 at 2:10 PM Szlamka József <szlajozs at gmail.com 
>>>>> <mailto:szlajozs at gmail.com>> wrote:
>>>>>
>>>>>     Hello to all list members,
>>>>>
>>>>>     I'm new on this list and also new to the GBIF API. I'd like to
>>>>>     get a
>>>>>     list of all the genus names occuring in the GBIF database.
>>>>>     After several
>>>>>     hours of trying with the API, and no success, I found this
>>>>>     mailing list.
>>>>>     I hope that API guru members on the list can show me the right
>>>>>     way or
>>>>>     tell if this is not possible at all.
>>>>>
>>>>>     Thank you in advance.
>>>>>
>>>>>     _______________________________________________
>>>>>     API-users mailing list
>>>>>     API-users at lists.gbif.org <mailto:API-users at lists.gbif.org>
>>>>>     https://lists.gbif.org/mailman/listinfo/api-users
>>>>>
>>>>
>>>> _______________________________________________
>>>> API-users mailing list
>>>> API-users at lists.gbif.org <mailto:API-users at lists.gbif.org>
>>>> https://lists.gbif.org/mailman/listinfo/api-users
>>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gbif.org/pipermail/api-users/attachments/20170907/d8f094b9/attachment.html>


More information about the API-users mailing list