-
Notifications
You must be signed in to change notification settings - Fork 5
Explore wildcard, nullability and negation checks in occurrence search #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So far gbif-web project has been using
But a more explicit syntax might be preferable and more flexible. When negations are present I would interpret those as
|
@timrobertson100 is there a list of which fields support those searches as of today? in https://www.gbif.org/developer/occurrence I can see this example of logical negation, but nothing else is said: {
"creator":"userName",
"notificationAddresses": ["userName@example.org"],
"predicate":
{
"type":"not",
"predicate":
{
"type":"equals",
"key":"DATASET_KEY",
"value":"4fa7b334-ce0d-4e88-aaae-2e0c138d049e"
}
}
} Thanks |
@MortenHofft - can you answer that please so I don't give incorrect info? |
BTW regarding wildcards I guess you mean the
|
hi @abubelinha Predicates {
"creator":"userName",
"notificationAddresses": ["userName@example.org"],
"predicate":
{
"type":"not",
"predicate":
{
"type":"or",
"predicates": [
{
"type":"equals",
"key":"TAXON_KEY",
"value": 5
},
{
"type":"like",
"key":"CATALOG_NUMBER",
"value":"PAPS5-560*"
}
]
}
}
} Search using predicates Since then that has been extended to the standard API albeit not yet documented. |
And yes with wildcard it is the predicate of type |
The fields that one can use for search is these: https://www.gbif.org/developer/occurrence#parameters I do not believe we have any documentation about which fields that allow e.g. |
Example usage in case someone arrives at this issue: const url = 'https://api.gbif.org/v1/occurrence/search/predicate';
const data = {
limit: 2,
offset: 1,
predicate: {
type: "and",
predicates: [
{
type: "equals",
key: "TAXON_KEY",
value: 212
},
{
type: "equals",
key: "COUNTRY",
value: "DK"
},
{
type: "equals",
key: "YEAR",
value: "1980"
},
]
}
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
console.log(result);
})
.catch(error => {
console.error('Error:', error);
}); |
Example v1 API /occurrence/predicate syntax snippet for GEOMETRY: {
"type": "within",
"geometry": "POLYGON((-77.07713 38.9127,-77.07686 38.88456,-77.03829 38.88386,-77.03736 38.91195,-77.07713 38.9127))"
} |
The GraphQL API powering the hosted portals is able to support null, negation, and wildcard searches for occurrence search (currently enabled for a few fields only, but more will follow).
It would be a good addition to the REST API to support these allowing for URL hacking and URL consistency with the future of GBIF.org (see gbif/hosted-portals#209).
While the motivation applies to occurrence search, it may be of interest to other content types surfaced in REST APIs. These could be added progressively (e.g. returning some
4**
code if detected and not supported in the meantime).The text was updated successfully, but these errors were encountered: