Skip to content

Commit

Permalink
stared eubon methods, #466
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Nov 21, 2015
1 parent 22f01ec commit 6088274
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Description: Taxonomic information from around the web. This package
interacts with a suite of web 'APIs' for taxonomic tasks, such
as verifying species names, getting taxonomic hierarchies,
and verifying name spelling.
Version: 0.6.7.9950
Version: 0.6.7.9990
License: MIT + file LICENSE
URL: https://github.com/ropensci/taxize
BugReports: https://github.com/ropensci/taxize/issues
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export(eol_invasive)
export(eol_pages)
export(eol_ping)
export(eol_search)
export(eubon)
export(fg_all_updated_names)
export(fg_author_search)
export(fg_deprecated_names)
Expand Down
44 changes: 44 additions & 0 deletions R/eubon.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#' EU BON taxonomy
#'
#' @export
#' @param query (character) The scientific name to search for. For example: "Bellis perennis",
#' "Prionus" or "Bolinus brandaris". This is an exact search so wildcard characters
#' are not supported
#' @param providers (character) A list of provider id strings concatenated by comma characters.
#' The default : "pesi,bgbm-cdm-server[col]" will be used if this parameter is not
#' set. A list of all available provider ids can be obtained from the '/capabilities'
#' service end point. Providers can be nested, that is a parent provider can have sub
#' providers. If the id of the parent provider is supplied all subproviders will be
#' queried. The query can also be restriced to one or more subproviders by using the
#' following syntax: parent-id[sub-id-1,sub-id2,...]
#' @param searchMode (character) Specifies the searchMode. Possible search modes are:
#' scientificNameExact, scientificNameLike (begins with), vernacularNameExact, vernacularNameLike
#' (contains), findByIdentifier. If the a provider does not support the chosen searchMode it
#' will be skipped and the status message in the tnrClientStatus will be set to 'unsupported
#' search mode' in this case.
#' @param addSynonymy (logical) Indicates whether the synonymy of the accepted taxon should be
#' included into the response. Turning this option on may cause an increased response time.
#' @param timeout (numeric) The maximum of milliseconds to wait for responses from any of the
#' providers. If the timeout is exceeded the service will jut return the resonses that have
#' been received so far. The default timeout is 0 ms (wait for ever)
#' @param ... Curl options passed on to \code{\link[httr]{GET}}
#' @references \url{http://cybertaxonomy.eu/eubon-utis/doc.html}
#' @examples \dontrun{
#' eubon("Prionus")
#' eubon("Salmo", 'worms')
#' eubon("Salmo", c('pesi', 'worms'))
#' eubon("Salmo", 'worms', 'scientificNameLike')
#' }
eubon <- function(query, providers = 'pesi', searchMode = 'scientificNameExact',
addSynonymy = FALSE, timeout = 0, ...) {

args <- tc(list(query = query, providers = paste0(providers, collapse = ","),
searchMode = searchMode, addSynonymy = as_l(addSynonymy),
timeout = timeout))
res <- GET(eubon_base(), query = args, ...)
stop_for_status(res)
txt <- content(res, "text")
jsonlite::fromJSON(txt, FALSE)
}

eubon_base <- function() "http://cybertaxonomy.eu/eubon-utis/search"
52 changes: 52 additions & 0 deletions man/eubon.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6088274

Please sign in to comment.