[API-users] Download API: support many predicates?

Scott Chamberlain myrmecocystus at gmail.com
Fri Jan 13 21:35:26 CET 2017


Hi!

A rgbif user is asking me about a particular download query, see
https://github.com/ropensci/rgbif/issues/245

TLDR: AFAICT this can't work as the API is set up right now. Or am I wrong?


That is, he wants to get data for records that match

- 10 taxa with their taxonKey value
- 3 different basisofrecord values
- country = US
- hasCoordinate = TRUE
- hasGeospatialIssue = FALSE
- year range between 1949 and 2011
- month range between 3 and 8

For the taxonKey values, I think he needs to combine those with *OR*
operator:

"predicate": {
        "type": "or",
        "predicates": [
            {
                "type": "equals",
                "key": "TAXON_KEY",
                "value": "2475470"
            },
            {
                "type": "equals",
                "key": "TAXON_KEY",
                "value": "2475470"
            }
        ]
    }

However, he should combine the other parameters (basisofrecord,
hasCoordinate, year, month, etc) using *AND* AFAICT.

*BUT*, AFAICT the API only allows one *predicate* key so you can't do what
I think is needed here. That is, to say (taxonkey = 1 OR 2 OR 3) + (country
= US AND hasCoordinate = true, etc.)

I tried sending two *predicate* keys in the API and only the second goes
through.

Any guidance much appreciated :)

The best solution I can think of is to do the query he's doing, but do one
for each taxon. Seem like a good solution?

Best, Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gbif.org/pipermail/api-users/attachments/20170113/f455fac7/attachment.html>


More information about the API-users mailing list