Skip to content

Commit

Permalink
arg chunksize in dbpedia_get_wikidata_uris() to avoid confusion with …
Browse files Browse the repository at this point in the history
…arg limit #29
  • Loading branch information
Andreas Blätte authored and Andreas Blätte committed Feb 26, 2024
1 parent f622e0c commit 5ec17a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Expand Up @@ -2,6 +2,7 @@
* `get_dbpedia_uris()` has new argument `types`
* `dbpedia_spotlight_status()` without warnings if docker not available / not running #32.
* `get_dbpedia_uris()` has new argument `support` #30.
* The confusingly mixed usage of argument 'limit' in `dbpedia_get_wikidata_uris()` is resolved by adding a new argument 'chunksize' #29.

## dbpedia v0.1.1.9011
* `xml_enrich()` now adds new attributes to pre-annotated features
Expand Down
11 changes: 7 additions & 4 deletions R/wikidata.R
Expand Up @@ -5,8 +5,10 @@
#' @param optional Optional information to retrieve (passed as length-one
#' character vector, e.g. 'municipalityCode').
#' @param endpoint Endpoint to query (a `character` vector).
#' @param limit Single numeric value with maximum size of chunks to process at
#' @param chunksize Single numeric value with maximum size of chunks to process at
#' a time.
#' @param limit Single numeric value, the maximum number of results to retrieve
#' from Wikidata.
#' @param wait A numeric value passed into `Sys.sleep()` to slow down sequence
#' of requests (and avoid denial of service). Defaults to 100.
#' @param progress Whether to show progress bar (`logical` value).
Expand All @@ -24,14 +26,15 @@
#' optional = "municipalityCode",
#' endpoint = "http://de.dbpedia.org/sparql",
#' wait = 0,
#' limit = 2,
#' chunksize = 2,
#' progress = TRUE
#' )
#' @importFrom cli cli_progress_bar cli_progress_done cli_progress_update
dbpedia_get_wikidata_uris <- function(x, optional, endpoint, limit = 100, wait = 1, verbose = TRUE, progress = FALSE){
dbpedia_get_wikidata_uris <- function(x, optional, endpoint, chunksize = 100, limit = 2, wait = 1, verbose = TRUE, progress = FALSE){

stopifnot(
is.character(x),
is.numeric(chunksize), length(chunksize) == 1L,
is.numeric(limit), length(limit) == 1L,
is.logical(progress), length(progress) == 1L,
is.numeric(wait), length(wait) == 1L, wait >= 0
Expand All @@ -58,7 +61,7 @@ dbpedia_get_wikidata_uris <- function(x, optional, endpoint, limit = 100, wait =
LIMIT %d'


chunks <- as_chunks(x = x, size = limit)
chunks <- as_chunks(x = x, size = chunksize)
retval_li <- list()

if (progress){
Expand Down
10 changes: 7 additions & 3 deletions man/wikidata_uris.Rd

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

0 comments on commit 5ec17a9

Please sign in to comment.