Non-chordata Occurrence Download Request

I really hope I’m not overlooking something simple, but I’m facing an issue trying to get non-chordate records using the occurrence download request API.

My real request is more complex, but I’ve narrowed my issue down to my “not” predicate. When I use this request, I am returned 0 results:

  {
    "type": "and",
    "predicates": [
      {
        "type": "not",
        "predicate": {
          "type": "equals",
          "key": "TAXON_KEY",
          "value": "44",
          "matchCase": false
        }
      },
      {
        "type": "equals",
        "key": "TAXON_KEY",
        "value": "1",
        "matchCase": false
      }
    ]
  }

The GUI on my download page shows two branches:

It seems that the API is understanding the request well enough–occurrence records within Animalia, but excluding Chordata.

Can anyone shed some light on why I’d be returned zero records?

Thank you in advance!

Ah, I’ve found my own mistake. It has to do with my usage of TAXON_KEY, which I was using in place of CLASS_KEY and KINGDOM_KEY. Is it that each occurrence only has one TAXON_KEY, but has individual keys for each level of their taxonomic tree?

In any case, using PHYLUM_KEY and KINGDOM_KEY instead of TAXON_KEY works well. Here’s the updated (and functional) query:

{
  "type": "and",
  "predicates": [
    {
      "type": "not",
      "predicate": {
        "type": "equals",
        "key": "PHYLUM_KEY",
        "value": "44",
        "matchCase": false
      }
    },
    {
      "type": "equals",
      "key": "KINGDOM_KEY",
      "value": "1",
      "matchCase": false
    },

My full query now includes CLASS_KEYs as well, which are working as intended.

Thank you to anyone who considered my question! I’m still curious to know more about the TAXON_KEY field if anyone can offer some insight.

1 Like

Hi @mihtmo this is actually a bug. It should be fixed soon. In the meantime, using the kingdom and phylum keys is a good idea.

2 Likes