+dplyr for querying databases, and act in the following way:
-collapse() converts the object to a query. This allows
-users to inspect their
-API calls before they are sent
+collapse() converts the object to a query.
+This allows users to inspect
+their API calls before they are sent. Depending on the request, this
+function may also call ‘supplementary’ APIs to collect required
+information, such as Taxon Concept Identifiers or field names.
-compute() sends queries to any required APIs. This
-includes sending a query for data, determining whether field names are
-valid, or finding how much data has been requested (which is necessary
-for pagination)
+compute() is intended to send the query in question to
+the requested API for processing. This is particularly important for
+occurrences, where it can be useful to submit a query and retrieve it at
+a later time. If the compute() stage is not required,
+however, compute() simply converts the query
+to a new class (computed_query).
collect() retrieves the requested data into your
-workspace
+workspace, returning a tibble.
We can use these in sequence, or just leap ahead to the stage we
want:
## Object of class query with type data/occurrences-count-groupby ## url: https://biocache-ws.ala.org.au/ws/occurrences/facets?fq=%28genus%3A%22... ## arrange: species (ascending)
## Object of class computed_query with type data/occurrences-count-groupby
+## url: https://biocache-ws.ala.org.au/ws/occurrences/facets?fq=%28genus%3A%22...
+## arrange: species (ascending)
The collapse() stage displays useful information about
-which APIs will be pinged by a query in galah when it is sent using
-compute().
+
## Object of class query with type data/occurrences
+## url: https://biocache-ws.ala.org.au/ws/occurrences/offline/download?fq=%28l...
+
The collapse() stage includes an additional argument
+(.expand) that, when set to TRUE, shows all
+the APIs called to construct the user-requested query. This is
+especially useful for debugging.
New object classes
@@ -310,11 +310,12 @@
New object classescollapse() returns class query_set, which
-is a list of one or more query objects
+collapse() returns class query, which is a
+list containing a type slot and one or more
+urls
compute() returns a single object of class
-query
+computed_query
collect() doesn’t add a new data class (returns class
@@ -326,7 +327,7 @@
Occurrence datesgalah_filter(), we can easily
identify how many records of the humpback whale (Megaptera
-novaeangliae) have occurred since the species was removed
-from the Australian threatened species list on 26/02/2022.
+novaeangliae) have occurred since the species was removed from the
+Australian threatened species list on 26/02/2022.
@Manual{,
title = {galah: Biodiversity Data from the GBIF Node Network},
author = {Martin Westgate and Matilda Stevenson and Dax Kellie and Peggy Newman},
- year = {2023},
- note = {R package version 2.0.0},
+ year = {2024},
+ note = {R package version 2.0.1},
url = {https://CRAN.R-project.org/package=galah},
}
collapse() now returns a query object, rather than a query_set, and gains a .expand argument to optionally append a query_set for debugging purposes (#217).
+
+
+
Bug fixes
+
Avoid triggering multiple errors when galah_identify() returns no matched taxa (#219)
+
Improve clarity of quick start guide vignette (#221)
+
show_values() no longer truncates rows to 30 (#222)
+
Column ID name returned by search_all(lists) now matches the correct field ID for galah_filter() (#225)
An object of class query_set, which is a list containing one or
-more objects of class query. This is valuable because it shows the set of
-queries required to correctly retrieve the requested data. Objects within a
-query_set are listed in the sequence in which they will be enacted.
+
An object of class query, which is a list-like object containing at
+least the slots type and url.
compute() is useful for several purposes. It's original
purpose is to send a request for data, which can then be processed by the
-server and retrieved at a later time (via collect()). However, because
-query-altering functions (such as filter() and select()) are evaluated
-lazily from galah version 2.0 onwards, compute() is also the function where
-all objects within the query_set are evaluated, and any checks run using
-that information. Therefore it is possible for invalid queries to be built
-using collapse(), but fail at compute().
+server and retrieved at a later time (via collect()).
An object of class data_request, metadata_request or
-files_request (i.e. constructed using a pipe) or query or query_set
+files_request (i.e. constructed using a pipe) or query
(i.e. constructed by collapse())
An object of class query containing a checked, valid query
-for the selected atlas. In the case of occurrence data, also contains
-information on the status of the request.
+
An object of class computed_query, which is identical to class
+query except for occurrence data, where it also contains information on the
+status of the request.