From beb871132af3b8eec08a163bb9e4e54095353d0b Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:06:24 -0500 Subject: [PATCH 01/11] redocument with new roxygen2 --- DESCRIPTION | 2 +- R/WikidataR.R | 3 +-- man/WikidataR.Rd | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d85a330..789f30e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,7 +42,7 @@ Suggests: knitr, pageviews, spelling -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Encoding: UTF-8 Depends: R (>= 3.5.0) Language: en-US diff --git a/R/WikidataR.R b/R/WikidataR.R index aa8390d..8495a8b 100644 --- a/R/WikidataR.R +++ b/R/WikidataR.R @@ -25,5 +25,4 @@ #' @importFrom WikipediR page_content random_page query #' @importFrom httr user_agent #' @importFrom jsonlite fromJSON -#' @aliases WikidataR WikidataR-package -NULL \ No newline at end of file +"_PACKAGE" diff --git a/man/WikidataR.Rd b/man/WikidataR.Rd index 1b4b1d7..fc097c7 100644 --- a/man/WikidataR.Rd +++ b/man/WikidataR.Rd @@ -2,8 +2,8 @@ % Please edit documentation in R/WikidataR.R \docType{package} \name{WikidataR} -\alias{WikidataR} \alias{WikidataR-package} +\alias{WikidataR} \title{API client library for Wikidata} \description{ This package serves as an API client for reading and writing @@ -17,3 +17,20 @@ as well as for reading from \href{https://www.wikipedia.org}{Wikipedia}. for using search functionality to pull out item or property IDs where the descriptions or aliases match a particular search term. } +\author{ +\strong{Maintainer}: Thomas Shafee \email{T.Shafee@latrobe.edu.au} (\href{https://orcid.org/0000-0002-2298-7593}{ORCID}) + +Authors: +\itemize{ + \item Os Keyes (\href{https://orcid.org/0000-0001-5196-609X}{ORCID}) + \item Serena Signorelli +} + +Other contributors: +\itemize{ + \item Alex Lum (\href{https://orcid.org/0000-0002-9295-9053}{ORCID}) [contributor] + \item Christian Graul [contributor] + \item Mikhail Popov (\href{https://orcid.org/0000-0003-0145-8948}{ORCID}) [contributor] +} + +} From a5eec02c1e846246f519f763cc43967fd0f1ca23 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:10:24 -0500 Subject: [PATCH 02/11] Use 3rd edition of testthat (remove deprecated features --- DESCRIPTION | 3 ++- tests/testthat.R | 8 ++++++++ tests/testthat/test_geo.R | 2 +- tests/testthat/test_gets.R | 2 +- tests/testthat/test_search.R | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 789f30e..a3a7795 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,7 +37,7 @@ Imports: utils Suggests: markdown, - testthat, + testthat (>= 3.0.0), tidyverse, knitr, pageviews, @@ -46,3 +46,4 @@ RoxygenNote: 7.3.2 Encoding: UTF-8 Depends: R (>= 3.5.0) Language: en-US +Config/testthat/edition: 3 diff --git a/tests/testthat.R b/tests/testthat.R index 34fbd73..485b927 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,3 +1,11 @@ +# This file is part of the standard setup for testthat. +# It is recommended that you do not modify it. +# +# Where should you do additional test configuration? +# Learn more about the roles of various files in: +# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview +# * https://testthat.r-lib.org/articles/special-files.html + library(testthat) library(WikidataR) diff --git a/tests/testthat/test_geo.R b/tests/testthat/test_geo.R index b1a75de..3a09b5a 100644 --- a/tests/testthat/test_geo.R +++ b/tests/testthat/test_geo.R @@ -1,4 +1,4 @@ -testthat::context("Geographic queries") +# Geographic queries ----- # Have had to comment out tests. Wikidata query service having timeout issues that cause tests to fail diff --git a/tests/testthat/test_gets.R b/tests/testthat/test_gets.R index 2164d4b..e318c67 100644 --- a/tests/testthat/test_gets.R +++ b/tests/testthat/test_gets.R @@ -1,4 +1,4 @@ -context("Direct Wikidata get functions") +# Direct Wikidata get functions ---- test_that("A specific item can be retrieved with an entire item code", { expect_true({get_item("Q100");TRUE}) diff --git a/tests/testthat/test_search.R b/tests/testthat/test_search.R index 8d8798f..e8f0737 100644 --- a/tests/testthat/test_search.R +++ b/tests/testthat/test_search.R @@ -1,4 +1,4 @@ -context("Search functions") +# test search functions test_that("English-language search works",{ expect_true({find_item("Wonder Girls", "en");TRUE}) From 0cb9009bfea299367e142abe2ae155edcfa223f4 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:14:37 -0500 Subject: [PATCH 03/11] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20use=20`expect=5Fno?= =?UTF-8?q?=5Ferror()`=20to=20improve=20test=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DESCRIPTION | 2 +- tests/testthat/test_gets.R | 10 +++++----- tests/testthat/test_search.R | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a3a7795..8dfdc01 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -37,7 +37,7 @@ Imports: utils Suggests: markdown, - testthat (>= 3.0.0), + testthat (>= 3.2.0), tidyverse, knitr, pageviews, diff --git a/tests/testthat/test_gets.R b/tests/testthat/test_gets.R index e318c67..5f32521 100644 --- a/tests/testthat/test_gets.R +++ b/tests/testthat/test_gets.R @@ -1,19 +1,19 @@ # Direct Wikidata get functions ---- test_that("A specific item can be retrieved with an entire item code", { - expect_true({get_item("Q100");TRUE}) + expect_no_error(get_item("Q100")) }) test_that("A specific item can be retrieved with a partial entire item code", { - expect_true({get_item("100");TRUE}) + expect_no_error(get_item("100")) }) test_that("A specific property can be retrieved with an entire prop code + namespace", { - expect_true({get_property("Property:P10");TRUE}) + expect_no_error(get_property("Property:P10")) }) test_that("A specific property can be retrieved with an entire prop code + namespace", { - expect_true({get_property("P10");TRUE}) + expect_no_error(get_property("P10")) }) @@ -27,4 +27,4 @@ test_that("A randomly-selected item can be retrieved",{ test_that("A randomly-selected property can be retriveed",{ expect_true({get_random_property();TRUE}) -}) \ No newline at end of file +}) diff --git a/tests/testthat/test_search.R b/tests/testthat/test_search.R index e8f0737..0b95bcc 100644 --- a/tests/testthat/test_search.R +++ b/tests/testthat/test_search.R @@ -1,13 +1,13 @@ # test search functions test_that("English-language search works",{ - expect_true({find_item("Wonder Girls", "en");TRUE}) + expect_no_error(find_item("Wonder Girls", "en")) }) test_that("Non-English-language search works",{ - expect_true({find_item("Wonder Girls", "es");TRUE}) + expect_no_error(find_item("Wonder Girls", "es")) }) test_that("Property search works",{ - expect_true({find_property("Music", "en");TRUE}) -}) \ No newline at end of file + expect_no_error(find_property("Music", "en")) +}) From f0ce21270233214e746572811d5b398976b4cce6 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:15:29 -0500 Subject: [PATCH 04/11] Ensure all lines ends with new line --- WikidataR.Rproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WikidataR.Rproj b/WikidataR.Rproj index 168aa81..3cca442 100644 --- a/WikidataR.Rproj +++ b/WikidataR.Rproj @@ -12,6 +12,8 @@ Encoding: UTF-8 RnwWeave: Sweave LaTeX: XeLaTeX +AutoAppendNewline: Yes + BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source --resave-data=best From 79cbbb1b8e524b7ff420c2eb178d836822313b8d Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:17:17 -0500 Subject: [PATCH 05/11] Uncomment tests but skip them on CRAN and CI --- tests/testthat/test_geo.R | 86 ++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/tests/testthat/test_geo.R b/tests/testthat/test_geo.R index 3a09b5a..f90394f 100644 --- a/tests/testthat/test_geo.R +++ b/tests/testthat/test_geo.R @@ -1,50 +1,52 @@ # Geographic queries ----- -# Have had to comment out tests. Wikidata query service having timeout issues that cause tests to fail +# Skipping tests on CI and on CRAN to ensure no API rate limit +skip_on_ci() +skip_on_cran() -# testthat::test_that("Simple entity-based geo lookups work", { -# field_names <- c("item", "name", "latitutde", "longitude", "entity") -# sf_locations <- get_geo_entity("Q62") -# testthat::expect_true(is.data.frame(sf_locations)) -# testthat::expect_true(all(field_names == names(sf_locations))) -# testthat::expect_true(unique(sf_locations$entity) == "Q62") -# }) +testthat::test_that("Simple entity-based geo lookups work", { + field_names <- c("item", "name", "latitutde", "longitude", "entity") + sf_locations <- get_geo_entity("Q62") + testthat::expect_true(is.data.frame(sf_locations)) + testthat::expect_true(all(field_names == names(sf_locations))) + testthat::expect_true(unique(sf_locations$entity) == "Q62") +}) -# testthat::test_that("Language-variant entity-based geo lookups work", { -# field_names <- c("item", "name", "latitutde", "longitude", "entity") -# sf_locations <- get_geo_entity("Q62", language = "fr") -# testthat::expect_true(is.data.frame(sf_locations)) -# testthat::expect_true(all(field_names == names(sf_locations))) -# testthat::expect_true(unique(sf_locations$entity) == "Q62") -# }) +testthat::test_that("Language-variant entity-based geo lookups work", { + field_names <- c("item", "name", "latitutde", "longitude", "entity") + sf_locations <- get_geo_entity("Q62", language = "fr") + testthat::expect_true(is.data.frame(sf_locations)) + testthat::expect_true(all(field_names == names(sf_locations))) + testthat::expect_true(unique(sf_locations$entity) == "Q62") +}) -# testthat::test_that("Radius restricted entity-based geo lookups work", { -# field_names <- c("item", "name", "latitutde", "longitude", "entity") -# sf_locations <- get_geo_entity("Q62", radius = 1) -# testthat::expect_true(is.data.frame(sf_locations)) -# testthat::expect_true(all(field_names == names(sf_locations))) -# testthat::expect_true(unique(sf_locations$entity) == "Q62") -# }) +testthat::test_that("Radius restricted entity-based geo lookups work", { + field_names <- c("item", "name", "latitutde", "longitude", "entity") + sf_locations <- get_geo_entity("Q62", radius = 1) + testthat::expect_true(is.data.frame(sf_locations)) + testthat::expect_true(all(field_names == names(sf_locations))) + testthat::expect_true(unique(sf_locations$entity) == "Q62") +}) -# testthat::test_that("multi-entity geo lookups work", { -# field_names <- c("item", "name", "latitutde", "longitude", "entity") -# sf_locations <- get_geo_entity(c("Q62", "Q64"), radius = 1) -# testthat::expect_true(is.data.frame(sf_locations)) -# testthat::expect_true(all(field_names == names(sf_locations))) -# testthat::expect_equal(length(unique(sf_locations$entity)), 2) -# }) +testthat::test_that("multi-entity geo lookups work", { + field_names <- c("item", "name", "latitutde", "longitude", "entity") + sf_locations <- get_geo_entity(c("Q62", "Q64"), radius = 1) + testthat::expect_true(is.data.frame(sf_locations)) + testthat::expect_true(all(field_names == names(sf_locations))) + testthat::expect_equal(length(unique(sf_locations$entity)), 2) +}) -# testthat::test_that("Simple bounding lookups work", { -# field_names <- c("item", "name", "latitutde", "longitude") -# bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest") -# testthat::expect_true(is.data.frame(bruges_box)) -# testthat::expect_true(all(field_names == names(bruges_box))) -# }) +testthat::test_that("Simple bounding lookups work", { + field_names <- c("item", "name", "latitutde", "longitude") + bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest") + testthat::expect_true(is.data.frame(bruges_box)) + testthat::expect_true(all(field_names == names(bruges_box))) +}) -# testthat::test_that("Language-variant bounding lookups work", { -# field_names <- c("item", "name", "latitutde", "longitude") -# bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest", -# language = "fr") -# testthat::expect_true(is.data.frame(bruges_box)) -# testthat::expect_true(all(field_names == names(bruges_box))) -# }) \ No newline at end of file +testthat::test_that("Language-variant bounding lookups work", { + field_names <- c("item", "name", "latitutde", "longitude") + bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest", + language = "fr") + testthat::expect_true(is.data.frame(bruges_box)) + testthat::expect_true(all(field_names == names(bruges_box))) +}) From 6df018f3e4092c311d2c198b1f3d3dc1eba6ecbe Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:27:28 -0500 Subject: [PATCH 06/11] remove unused suggests --- DESCRIPTION | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8dfdc01..29e731a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,12 +36,7 @@ Imports: crayon, utils Suggests: - markdown, - testthat (>= 3.2.0), - tidyverse, - knitr, - pageviews, - spelling + testthat (>= 3.2.0) RoxygenNote: 7.3.2 Encoding: UTF-8 Depends: R (>= 3.5.0) From 62d112a917d7e0b60a9fea75d9a289ffa1633be3 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:32:21 -0500 Subject: [PATCH 07/11] Drop dplyr dep and use vctrs instead. --- NAMESPACE | 4 ++-- R/WikidataR.R | 3 +-- R/utils.R | 14 +++++++------- R/writes.R | 2 +- R/writes_wikibase.R | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index c8f0685..bff1fa7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -42,7 +42,6 @@ export(write_wikibase) export(write_wikidata) import(WikidataQueryServiceR) import(crayon) -import(dplyr) import(pbapply) import(progress) import(stringr) @@ -51,10 +50,11 @@ import(utils) importFrom(WikipediR,page_content) importFrom(WikipediR,query) importFrom(WikipediR,random_page) -importFrom(dplyr,bind_cols) importFrom(httr,user_agent) importFrom(jsonlite,fromJSON) importFrom(readr,format_delim) importFrom(readr,format_tsv) importFrom(stats,cor) importFrom(stats,var) +importFrom(vctrs,vec_cbind) +importFrom(vctrs,vec_rbind) diff --git a/R/WikidataR.R b/R/WikidataR.R index 8495a8b..ec93862 100644 --- a/R/WikidataR.R +++ b/R/WikidataR.R @@ -11,7 +11,6 @@ #' or aliases match a particular search term. #' @import WikidataQueryServiceR #' @import tibble -#' @import dplyr #' @import stringr #' @import pbapply #' @import progress @@ -19,7 +18,7 @@ #' @import utils #' @importFrom readr format_tsv #' @importFrom readr format_delim -#' @importFrom dplyr bind_cols +#' @importFrom vctrs vec_cbind vec_rbind #' @importFrom stats var #' @importFrom stats cor #' @importFrom WikipediR page_content random_page query diff --git a/R/utils.R b/R/utils.R index 06e3f65..7606cfa 100644 --- a/R/utils.R +++ b/R/utils.R @@ -116,7 +116,7 @@ as_qid <- function(x){ out <- unlist(lapply(x,as_qid_nest2)) out } - output <- bind_cols(lapply(tibble(x),as_qid_nest1)) + output <- vec_cbind(lapply(tibble(x),as_qid_nest1)) return(output) } @@ -158,7 +158,7 @@ as_pid <- function(x){ out <- unlist(lapply(x,as_pid_nest2)) out } - output <- bind_cols(lapply(tibble(x),as_pid_nest1)) + output <- vec_cbind(lapply(tibble(x),as_pid_nest1)) return(output) } @@ -193,7 +193,7 @@ as_sid <- function(x){ out <- unlist(lapply(x,as_sid_nest2)) out } - output <- bind_cols(lapply(tibble(x),as_sid_nest1)) + output <- vec_cbind(lapply(tibble(x),as_sid_nest1)) return(output) } @@ -228,7 +228,7 @@ as_quot <- function(x,format="tibble"){ out <- unlist(lapply(x,as_quot_nest2)) out } - output <- bind_cols(lapply(tibble(x),as_quot_nest1)) + output <- vec_cbind(lapply(tibble(x),as_quot_nest1)) return(output) } @@ -390,7 +390,7 @@ filter_qids <- function (ids, }else{ desc <- "no description" } - out <- bind_rows(out,tibble(qid=qid,label=label,desc=desc)) + out <- vec_rbind(out,tibble(qid=qid,label=label,desc=desc)) } }else{ for (i in 1:length(ids)){ @@ -419,7 +419,7 @@ filter_qids <- function (ids, }else{ label <- "no label" } - out <- bind_rows(out,tibble(qid=qid,label=label,desc=desc)) + out <- vec_rbind(out,tibble(qid=qid,label=label,desc=desc)) } } } @@ -528,7 +528,7 @@ createrows <- function(items,vector){ vector <- tibble(vector) newQID <- which(items=="CREATE") - val <- bind_rows(vector,tibble(data.frame(array("",dim=c(length(newQID),ncol(vector)),dimnames = list(NULL,colnames(vector)))))) + val <- vec_rbind(vector,tibble(data.frame(array("",dim=c(length(newQID),ncol(vector)),dimnames = list(NULL,colnames(vector)))))) id <- c(1:nrow(vector), newQID-seq_along(newQID)+0.5) out <- tibble(val[order(id),]) return(out) diff --git a/R/writes.R b/R/writes.R index 87097ad..cd494b4 100644 --- a/R/writes.R +++ b/R/writes.R @@ -162,7 +162,7 @@ write_wikidata <- function(items, colnames(QS$properties) <- "Prop" colnames(QS$values) <- "Value" - QS.tib <- bind_cols(QS$items, + QS.tib <- vec_cbind(QS$items, QS$properties, QS$values) diff --git a/R/writes_wikibase.R b/R/writes_wikibase.R index f3bdb46..f849b7c 100644 --- a/R/writes_wikibase.R +++ b/R/writes_wikibase.R @@ -163,7 +163,7 @@ write_wikibase <- function(items, colnames(QS$properties) <- "Prop" colnames(QS$values) <- "Value" - QS.tib <- bind_cols( + QS.tib <- vec_cbind( QS$items, QS$properties, QS$values From 006a94c597e90805d8831a77216c8dc8bb748b38 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:42:13 -0500 Subject: [PATCH 08/11] Remove Hmisc dependency --- DESCRIPTION | 3 +-- NAMESPACE | 1 - R/WikidataR.R | 7 +------ R/utils.R | 17 ++++++++++++++++- man/{WikidataR.Rd => WikidataR-package.Rd} | 6 +++--- 5 files changed, 21 insertions(+), 13 deletions(-) rename man/{WikidataR.Rd => WikidataR-package.Rd} (93%) diff --git a/DESCRIPTION b/DESCRIPTION index 29e731a..f6a77f4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,11 +26,10 @@ Imports: WikipediR, WikidataQueryServiceR, tibble, - dplyr, stringr, - Hmisc, progress, pbapply, + vctrs, stats, readr, crayon, diff --git a/NAMESPACE b/NAMESPACE index bff1fa7..a2e05de 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -54,7 +54,6 @@ importFrom(httr,user_agent) importFrom(jsonlite,fromJSON) importFrom(readr,format_delim) importFrom(readr,format_tsv) -importFrom(stats,cor) importFrom(stats,var) importFrom(vctrs,vec_cbind) importFrom(vctrs,vec_rbind) diff --git a/R/WikidataR.R b/R/WikidataR.R index ec93862..ef0534b 100644 --- a/R/WikidataR.R +++ b/R/WikidataR.R @@ -1,10 +1,7 @@ -#' @title API client library for Wikidata #' @description This package serves as an API client for reading and writing #' to and from \href{https://www.wikidata.org/wiki/Wikidata:Main_Page}{Wikidata}, (including #' via the \href{https://quickstatements.toolforge.org/}{QuickStatements} format), #' as well as for reading from \href{https://www.wikipedia.org}{Wikipedia}. -#' @name WikidataR -#' @docType package #' @seealso \code{\link{get_random}} for selecting a random item or property, #' \code{\link{get_item}} for a /specific/ item or property, or \code{\link{find_item}} #' for using search functionality to pull out item or property IDs where the descriptions @@ -16,11 +13,9 @@ #' @import progress #' @import crayon #' @import utils -#' @importFrom readr format_tsv -#' @importFrom readr format_delim +#' @importFrom readr format_tsv format_delim #' @importFrom vctrs vec_cbind vec_rbind #' @importFrom stats var -#' @importFrom stats cor #' @importFrom WikipediR page_content random_page query #' @importFrom httr user_agent #' @importFrom jsonlite fromJSON diff --git a/R/utils.R b/R/utils.R index 7606cfa..a77afd3 100644 --- a/R/utils.R +++ b/R/utils.R @@ -458,7 +458,7 @@ unspecial <- function(x){ out <- x for(i in 1:ncol(x)){ out[[i]] <- iconv(x[[i]],to = 'ASCII//TRANSLIT') - if(Hmisc::all.is.numeric(x[[i]])){ + if(all_numeric(x[[i]])){ out[[i]] <- as.numeric(out[[i]]) }else{ out[[i]] <- as.factor(out[[i]]) @@ -560,3 +560,18 @@ createrows.tidy <- function(QS.tib){ out[apply(is.empty(out),all,MARGIN=1),1] <- "CREATE" return(out) } + + +all_numeric <- function(x) { + x <- sub("[[:space:]]+$", "", x) + x <- sub("^[[:space:]]+", "", x) + # remove empty + xs <- x[nzchar(x)] + + if (length(xs) == 0 || all(is.na(x))) { + return(FALSE) + } + + isnon <- suppressWarnings(!is.na(xs) & is.na(as.numeric(xs))) + !any(isnon) +} diff --git a/man/WikidataR.Rd b/man/WikidataR-package.Rd similarity index 93% rename from man/WikidataR.Rd rename to man/WikidataR-package.Rd index fc097c7..23a0f49 100644 --- a/man/WikidataR.Rd +++ b/man/WikidataR-package.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/WikidataR.R \docType{package} -\name{WikidataR} -\alias{WikidataR-package} +\name{WikidataR-package} \alias{WikidataR} -\title{API client library for Wikidata} +\alias{WikidataR-package} +\title{WikidataR: Read-Write API Client Library for Wikidata} \description{ This package serves as an API client for reading and writing to and from \href{https://www.wikidata.org/wiki/Wikidata:Main_Page}{Wikidata}, (including From 36c829f5f383e39900ac7e8a7064a7f6ff3a383f Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:54:45 -0500 Subject: [PATCH 09/11] Fix man issues --- R/geo.R | 29 ++++++++++++++++------------- R/gets.R | 8 ++++---- R/queries.R | 8 ++++---- R/utils.R | 2 +- man/as_qid.Rd | 2 +- man/find_item.Rd | 2 +- man/get_geo_box.Rd | 15 ++++++++------- man/get_geo_entity.Rd | 14 ++++++++------ man/get_item.Rd | 2 +- man/get_random.Rd | 2 +- man/query_wikidata.Rd | 2 +- man/searcher.Rd | 2 +- man/sparql_query.Rd | 2 +- man/wd_query.Rd | 2 +- man/wd_rand_query.Rd | 2 +- 15 files changed, 50 insertions(+), 44 deletions(-) diff --git a/R/geo.R b/R/geo.R index 1e6077b..da0c0f9 100644 --- a/R/geo.R +++ b/R/geo.R @@ -16,10 +16,10 @@ #' #'@param limit the maximum number of results to return. #' -#'@param \\dots further arguments to pass to de{httr:ink[httr::GET]{GET}}. +#'@param ... further arguments to pass to \link[httr:GET]{GET}. #' #'@return a data.frame of 5 columns: -#'\itemize{ +#'\describe{ #' \item{item}{ the Wikidata identifier of each object associated with #' \code{entity}.} #' \item{name}{ the name of the item, if available, in the requested language. If it @@ -32,16 +32,18 @@ #' #'@examples #'# All entities -#'\donttest{sf_locations <- get_geo_entity("Q62")} +#'\donttest{ +#'sf_locations <- get_geo_entity("Q62") #' #'# Entities with French, rather than English, names -#'\donttest{sf_locations <- get_geo_entity("Q62", language = "fr")} +#'sf_locations <- get_geo_entity("Q62", language = "fr") #' #'# Entities within 1km -#'\donttest{sf_close_locations <- get_geo_entity("Q62", radius = 1)} +#'sf_close_locations <- get_geo_entity("Q62", radius = 1) #' #'# Multiple entities -#'\donttest{multi_entity <- get_geo_entity(entity = c("Q62", "Q64"))} +#'multi_entity <- get_geo_entity(entity = c("Q62", "Q64")) +#'} #' #'@seealso \code{\link{get_geo_box}} for using a bounding box #'rather than an unrestricted search or simple radius. @@ -112,12 +114,11 @@ get_geo_entity <- function(entity, language = "en", radius = NULL, limit=100, .. #'@param language the two-letter language code to use for the name #'of the item. "en" by default. #' -#'@param \\dots further arguments to pass to de{httr:ink[httr::GET]{GET}}. +#'@param ... further arguments to pass to \link[httr:GET]{GET}. #' #'@return a data.frame of 5 columns: -#'\itemize{ -#' \item{item}{ the Wikidata identifier of each object associated with -#' \code{entity}.} +#'\describe{ +#' \item{item}{ the Wikidata identifier of each object associated with \code{entity}.} #' \item{name}{ the name of the item, if available, in the requested language. If it #' is not available, \code{NA} will be returned instead.} #' \item{latitude}{ the latitude of \code{item}} @@ -128,11 +129,13 @@ get_geo_entity <- function(entity, language = "en", radius = NULL, limit=100, .. #' #'@examples #'# Simple bounding box -#'\donttest{bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest")} +#'\donttest{ +#'bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest") #' #'# Custom language -#'\donttest{bruges_box_fr <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest", -#' language = "fr")} +#'bruges_box_fr <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest", +#' language = "fr") +#'} #' #'@seealso \code{\link{get_geo_entity}} for using an unrestricted search or simple radius, #'rather than a bounding box. diff --git a/R/gets.R b/R/gets.R index 4e848e6..59e840d 100644 --- a/R/gets.R +++ b/R/gets.R @@ -12,7 +12,7 @@ #'it appropriately. This function is vectorized and will happily accept #'multiple IDs. #' -#'@param \\dots further arguments to pass to de{httr:ink[httr::GET]{GET}}. +#'@param ... further arguments to pass to \link[httr:GET]{GET}. #' #'@seealso \code{\link{get_random}} for selecting a random item or property, #'or \code{\link{find_item}} for using search functionality to pull out @@ -57,7 +57,7 @@ get_property <- function(id, ...){ #' #'@param limit how many random items to return. 1 by default, but can be higher. #' -#'@param \\dots arguments to pass to de{httr:ink[httr::GET]{GET}}. +#'@param ... arguments to pass to \link[httr:GET]{GET}. #' #'@seealso \code{\link{get_item}} for selecting a specific item or property, #'or \code{\link{find_item}} for using search functionality to pull out @@ -140,7 +140,7 @@ get_example <- function(example_name){ #' #'@param limit The number of results to return; set to \code{10} by default. #' -#'@param \\dots further arguments to pass to de{httr:ink[httr::GET]{GET}}. +#'@param ... further arguments to pass to \link[httr:GET]{GET}. #' #'@seealso \code{\link{get_random}} for selecting a random item or property, #'or \code{\link{get_item}} for selecting a specific item or property. @@ -188,7 +188,7 @@ find_property <- function(search_term, #'consist of an ISO language code. Set to "en" by default. #'@param limit the number of results to return; set to 10 by default. #'@param type type of wikidata object to return (default = "item") -#'@param \\dots Additional parameters to supply to [httr::POST] +#'@param ... Additional parameters to supply to [httr::POST()] #'@return If the inputted string matches an item label, return its QID. #'If the inputted string matches multiple labels of multiple items, return the QID of the first hit. #'If the inputted string is already a QID, return the string. diff --git a/R/queries.R b/R/queries.R index 9568a16..e13bcb2 100644 --- a/R/queries.R +++ b/R/queries.R @@ -3,7 +3,7 @@ #'@description Utility wrapper for Wikidata API to download item. #'Used by \code{get_item} and \code{get_property}. #'@param title The Wikidata item or property as a string. -#'@param \\dots Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}. +#'@param ... Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}. #'@return A downloaded full wikidata object (item or property) formatted as a #'nested json list. #'@export @@ -24,7 +24,7 @@ wd_query <- function(title, ...){ #'@param ns string indicating namespace, most commonly "Main" for QID items, "Property" #'for PID properties. #'@param limit How many random object to return. -#'@param \\dots Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}. +#'@param ... Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}. #'@return Downloaded full wikidata objects (items or properties) formatted #'as nested json lists. #'@export @@ -44,7 +44,7 @@ wd_rand_query <- function(ns, limit, ...){ #'@description Utility wrapper for wikidata spargl endpoint to download items. #'Used by \code{get_geo_entity} and \code{get_geo_box}. #'@param query The SPARQL query as a string -#'@param \\dots Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}. +#'@param ... Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}. #'@return a download of the full wikidata objects formatted as a nested json list #'@export sparql_query <- function(query, ...){ @@ -65,7 +65,7 @@ sparql_query <- function(query, ...){ #' `simple` returns a pure character vector, while #' `smart` fetches JSON-formatted data and returns a tibble with datetime #' columns converted to `POSIXct`. -#' @param \\dots Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}. +#' @param ... Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}. #' @return A `tibble` or `vector`. Note: QID values will be returned as QIDs, rather than URLs. #' @section Query limits: #' There is a hard query deadline configured which is set to 60 seconds. There diff --git a/R/utils.R b/R/utils.R index a77afd3..61db471 100644 --- a/R/utils.R +++ b/R/utils.R @@ -66,7 +66,7 @@ check_input <- function(input, substitution){ # -------- Format converters -------- # Simple functions to convert plain text descriptions into their most likely QID/PIDs -#'@title Convert an input to a item QID. +#'@title Convert an input to a item QID #'@description Convert an input string to the most likely item #'\href{https://www.wikidata.org/wiki/Q43649390}{QID}. #'@param x a vector, data frame, or tibble of strings representing wikidata items diff --git a/man/as_qid.Rd b/man/as_qid.Rd index 750ea51..99149d8 100644 --- a/man/as_qid.Rd +++ b/man/as_qid.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/utils.R \name{as_qid} \alias{as_qid} -\title{Convert an input to a item QID.} +\title{Convert an input to a item QID} \usage{ as_qid(x) } diff --git a/man/find_item.Rd b/man/find_item.Rd index b7dfdb2..dcc8cef 100644 --- a/man/find_item.Rd +++ b/man/find_item.Rd @@ -28,7 +28,7 @@ consist of an ISO language code. Defaults to \code{"en"}.} \item{limit}{The number of results to return; set to \code{10} by default.} -\item{\\dots}{further arguments to pass to de{httr:ink[httr::GET]{GET}}.} +\item{...}{further arguments to pass to \link[httr:GET]{GET}.} } \value{ A list containing the result of the query. diff --git a/man/get_geo_box.Rd b/man/get_geo_box.Rd index 51c85dd..80f9063 100644 --- a/man/get_geo_box.Rd +++ b/man/get_geo_box.Rd @@ -29,13 +29,12 @@ to \code{city} (eg "NorthWest", "SouthEast").} \item{language}{the two-letter language code to use for the name of the item. "en" by default.} -\item{\\dots}{further arguments to pass to de{httr:ink[httr::GET]{GET}}.} +\item{...}{further arguments to pass to \link[httr:GET]{GET}.} } \value{ a data.frame of 5 columns: -\itemize{ - \item{item}{ the Wikidata identifier of each object associated with - \code{entity}.} +\describe{ + \item{item}{ the Wikidata identifier of each object associated with \code{entity}.} \item{name}{ the name of the item, if available, in the requested language. If it is not available, \code{NA} will be returned instead.} \item{latitude}{ the latitude of \code{item}} @@ -51,11 +50,13 @@ with geographic attributes (usually cities). } \examples{ # Simple bounding box -\donttest{bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest")} +\donttest{ +bruges_box <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest") # Custom language -\donttest{bruges_box_fr <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest", - language = "fr")} +bruges_box_fr <- get_geo_box("Q12988", "NorthEast", "Q184287", "SouthWest", + language = "fr") +} } \seealso{ diff --git a/man/get_geo_entity.Rd b/man/get_geo_entity.Rd index fb93ef8..38a3794 100644 --- a/man/get_geo_entity.Rd +++ b/man/get_geo_entity.Rd @@ -19,11 +19,11 @@ to restrict the search to.} \item{limit}{the maximum number of results to return.} -\item{\\dots}{further arguments to pass to de{httr:ink[httr::GET]{GET}}.} +\item{...}{further arguments to pass to \link[httr:GET]{GET}.} } \value{ a data.frame of 5 columns: -\itemize{ +\describe{ \item{item}{ the Wikidata identifier of each object associated with \code{entity}.} \item{name}{ the name of the item, if available, in the requested language. If it @@ -42,16 +42,18 @@ a city). } \examples{ # All entities -\donttest{sf_locations <- get_geo_entity("Q62")} +\donttest{ +sf_locations <- get_geo_entity("Q62") # Entities with French, rather than English, names -\donttest{sf_locations <- get_geo_entity("Q62", language = "fr")} +sf_locations <- get_geo_entity("Q62", language = "fr") # Entities within 1km -\donttest{sf_close_locations <- get_geo_entity("Q62", radius = 1)} +sf_close_locations <- get_geo_entity("Q62", radius = 1) # Multiple entities -\donttest{multi_entity <- get_geo_entity(entity = c("Q62", "Q64"))} +multi_entity <- get_geo_entity(entity = c("Q62", "Q64")) +} } \seealso{ diff --git a/man/get_item.Rd b/man/get_item.Rd index ec66a33..7c368af 100644 --- a/man/get_item.Rd +++ b/man/get_item.Rd @@ -16,7 +16,7 @@ even with an included namespace ("Property:P10") - the function will format it appropriately. This function is vectorized and will happily accept multiple IDs.} -\item{\\dots}{further arguments to pass to de{httr:ink[httr::GET]{GET}}.} +\item{...}{further arguments to pass to \link[httr:GET]{GET}.} } \description{ \code{get_item} and \code{get_property} allow you to retrieve the data associated diff --git a/man/get_random.Rd b/man/get_random.Rd index b85e65d..103eb52 100644 --- a/man/get_random.Rd +++ b/man/get_random.Rd @@ -13,7 +13,7 @@ get_random_property(limit = 1, ...) \arguments{ \item{limit}{how many random items to return. 1 by default, but can be higher.} -\item{\\dots}{arguments to pass to de{httr:ink[httr::GET]{GET}}.} +\item{...}{arguments to pass to \link[httr:GET]{GET}.} } \description{ \code{get_random_item} and \code{get_random_property} allow you to retrieve the data diff --git a/man/query_wikidata.Rd b/man/query_wikidata.Rd index 7174440..6260a8b 100644 --- a/man/query_wikidata.Rd +++ b/man/query_wikidata.Rd @@ -14,7 +14,7 @@ query_wikidata(sparql_query, format = "tibble", ...) `smart` fetches JSON-formatted data and returns a tibble with datetime columns converted to `POSIXct`.} -\item{\\dots}{Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}.} +\item{...}{Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}.} } \value{ A `tibble` or `vector`. Note: QID values will be returned as QIDs, rather than URLs. diff --git a/man/searcher.Rd b/man/searcher.Rd index 93a15b3..c93c3d7 100644 --- a/man/searcher.Rd +++ b/man/searcher.Rd @@ -19,7 +19,7 @@ consist of an ISO language code. Set to "en" by default.} \item{type}{type of wikidata object to return (default = "item")} -\item{\\dots}{Additional parameters to supply to [httr::POST]} +\item{...}{Additional parameters to supply to [httr::POST()]} } \value{ If the inputted string matches an item label, return its QID. diff --git a/man/sparql_query.Rd b/man/sparql_query.Rd index 712698f..13a5587 100644 --- a/man/sparql_query.Rd +++ b/man/sparql_query.Rd @@ -9,7 +9,7 @@ sparql_query(query, ...) \arguments{ \item{query}{The SPARQL query as a string} -\item{\\dots}{Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}.} +\item{...}{Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}.} } \value{ a download of the full wikidata objects formatted as a nested json list diff --git a/man/wd_query.Rd b/man/wd_query.Rd index 5804b98..c72c2c5 100644 --- a/man/wd_query.Rd +++ b/man/wd_query.Rd @@ -9,7 +9,7 @@ wd_query(title, ...) \arguments{ \item{title}{The Wikidata item or property as a string.} -\item{\\dots}{Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}.} +\item{...}{Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}.} } \value{ A downloaded full wikidata object (item or property) formatted as a diff --git a/man/wd_rand_query.Rd b/man/wd_rand_query.Rd index e063f7d..4f0395f 100644 --- a/man/wd_rand_query.Rd +++ b/man/wd_rand_query.Rd @@ -12,7 +12,7 @@ for PID properties.} \item{limit}{How many random object to return.} -\item{\\dots}{Additional parameters to supply to \code{httr:\link[httr::POST]{POST}}.} +\item{...}{Additional parameters to supply to \code{httr:\link[httr:POST]{POST}}.} } \value{ Downloaded full wikidata objects (items or properties) formatted From 75f987e924012923444f46058c8b38d31d016f41 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 17:58:16 -0500 Subject: [PATCH 10/11] use NEWS.md and fix last doc issues --- DESCRIPTION | 2 ++ NAMESPACE | 5 ++++ NEWS | 61 ------------------------------------------------ NEWS.md | 48 +++++++++++++++++++++++++++++++++++++ R/WikidataR.R | 4 +++- R/gets.R | 4 +--- man/find_item.Rd | 7 ++++-- 7 files changed, 64 insertions(+), 67 deletions(-) delete mode 100644 NEWS create mode 100644 NEWS.md diff --git a/DESCRIPTION b/DESCRIPTION index f6a77f4..f88cd07 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,6 +30,8 @@ Imports: progress, pbapply, vctrs, + dplyr, + tidyr, stats, readr, crayon, diff --git a/NAMESPACE b/NAMESPACE index a2e05de..d73d36c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -50,10 +50,15 @@ import(utils) importFrom(WikipediR,page_content) importFrom(WikipediR,query) importFrom(WikipediR,random_page) +importFrom(dplyr,first) +importFrom(dplyr,n) +importFrom(dplyr,slice) +importFrom(httr,POST) importFrom(httr,user_agent) importFrom(jsonlite,fromJSON) importFrom(readr,format_delim) importFrom(readr,format_tsv) importFrom(stats,var) +importFrom(tidyr,replace_na) importFrom(vctrs,vec_cbind) importFrom(vctrs,vec_rbind) diff --git a/NEWS b/NEWS deleted file mode 100644 index b001a20..0000000 --- a/NEWS +++ /dev/null @@ -1,61 +0,0 @@ -2.3.0 -================================================= -* New disambiguate_QIDs() function for manual item-by-item disambiguation - -2.2.1 -================================================= -* Outputs as tibbles by default with vector options where relevant - -2.2.0 -================================================= -* Additional 'website' output format option for write_wikidata() to submit to Quickstatements website -* Patches to make writing wikidata statements with dates more reliable - -2.1.5 -================================================= -* Updated release on CRAN -* Expected property values and constraints from 2.1.0 now just stored as a data file, since onAttach function caused issues - -2.1.0 -================================================= -* Upon loading the package, it will check whether property values are expected to be strings, numbers, dates or QIDs - -2.0.0 -=================================================w -* Write_wikidata() allows you to write to wikidata via the 'quickstatements' format -* Outputs as tibbles where relevant -* Switch maintatiner to Thomas Shafee - -1.4.0 -================================================= -* First release on CRAN! -* Extract_claims() allows you to, well, extract claims. -* SPARQL syntax bug with some geo queries now fixed (thanks to Mikhail Popov) - -1.3.0 -================================================= -* Vectorisation of get_*() functions - -1.2.0 -================================================= -* Geographic data for entities that exist relative to other Wikidata items can now be retrieved - with get_geo_entity and get_geo_box, courtesy of excellent Serena Signorelli's excellent - QueryWikidataR package. -* A bug in printing returned objects is now fixed. - -1.1.0 -================================================= -* You can now retrieve multiple random properties or items with get_random_item and get_random_property - -1.0.1 -================================================= -* Various documentation and metadata improvements. - -1.0.0 -================================================= -* Fix a bug in get_* functions due to a parameter name mismatch -* Print methods added by Christian Graul - -0.5.0 -================================================= -* This is the initial release! See the explanatory vignettes. diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..77ad212 --- /dev/null +++ b/NEWS.md @@ -0,0 +1,48 @@ +# WikidataR 2.3.0 +* New `disambiguate_QIDs()` function for manual item-by-item disambiguation + +# WikidataR 2.2.1 +* Outputs as tibbles by default with vector options where relevant + +# WikidataR 2.2.0 +* Additional 'website' output format option for `write_wikidata()` to submit to Quickstatements website +* Patches to make writing wikidata statements with dates more reliable + +# WikidataR 2.1.5 +* Updated release on CRAN +* Expected property values and constraints from 2.1.0 now just stored as a data file, since onAttach function caused issues + +# WikidataR 2.1.0 +* Upon loading the package, it will check whether property values are expected to be strings, numbers, dates or QIDs + +# WikidataR 2.0.0 +* `write_wikidata()` allows you to write to wikidata via the 'quickstatements' format +* Outputs as tibbles where relevant +* Switch maintatiner to Thomas Shafee + +# WikidataR 1.4.0 +* First release on CRAN! +* `extract_claims()` allows you to, well, extract claims. +* SPARQL syntax bug with some geo queries now fixed (thanks to Mikhail Popov) + +# WikidataR 1.3.0 +* Vectorisation of `get_*()` functions + +# WikidataR 1.2.0 +* Geographic data for entities that exist relative to other Wikidata items can now be retrieved + with get_geo_entity and get_geo_box, courtesy of excellent Serena Signorelli's excellent + QueryWikidataR package. +* A bug in printing returned objects is now fixed. + +# WikidataR 1.1.0 +* You can now retrieve multiple random properties or items with get_random_item and get_random_property + +# WikidataR 1.0.1 +* Various documentation and metadata improvements. + +# WikidataR 1.0.0 +* Fix a bug in `get_*()` functions due to a parameter name mismatch +* Print methods added by Christian Graul + +# WikidataR 0.5.0 +* This is the initial release! See the explanatory vignettes. diff --git a/R/WikidataR.R b/R/WikidataR.R index ef0534b..a89b682 100644 --- a/R/WikidataR.R +++ b/R/WikidataR.R @@ -17,6 +17,8 @@ #' @importFrom vctrs vec_cbind vec_rbind #' @importFrom stats var #' @importFrom WikipediR page_content random_page query -#' @importFrom httr user_agent +#' @importFrom httr user_agent POST +#' @importFrom dplyr slice n first +#' @importFrom tidyr replace_na #' @importFrom jsonlite fromJSON "_PACKAGE" diff --git a/R/gets.R b/R/gets.R index 59e840d..f30e396 100644 --- a/R/gets.R +++ b/R/gets.R @@ -135,9 +135,7 @@ get_example <- function(example_name){ #' #'@param search_term A term to search for. #' -#'@param language The language to return the labels and descriptions in; this should -#'consist of an ISO language code. Defaults to \code{"en"}. -#' +#'@inheritParams searcher #'@param limit The number of results to return; set to \code{10} by default. #' #'@param ... further arguments to pass to \link[httr:GET]{GET}. diff --git a/man/find_item.Rd b/man/find_item.Rd index dcc8cef..6005bd3 100644 --- a/man/find_item.Rd +++ b/man/find_item.Rd @@ -23,11 +23,14 @@ find_property( \arguments{ \item{search_term}{A term to search for.} -\item{language}{The language to return the labels and descriptions in; this should -consist of an ISO language code. Defaults to \code{"en"}.} +\item{language}{the language to conduct the search in; this should +consist of an ISO language code. Set to "en" by default.} \item{limit}{The number of results to return; set to \code{10} by default.} +\item{response_language}{the language to return the labels and descriptions in; this should +consist of an ISO language code. Set to "en" by default.} + \item{...}{further arguments to pass to \link[httr:GET]{GET}.} } \value{ From d48cc3d77378562cbaad25ce7e42a1be03eda3e7 Mon Sep 17 00:00:00 2001 From: olivroy Date: Thu, 27 Feb 2025 18:30:58 -0500 Subject: [PATCH 11/11] Use license as required by CRAN (currently, this yields a NOTE) --- .Rbuildignore | 1 + LICENSE | 11 ++--------- LICENSE.md | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 LICENSE.md diff --git a/.Rbuildignore b/.Rbuildignore index 064ba44..442c2e2 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,3 +6,4 @@ ^CRAN-RELEASE$ ^cran-comments\.md$ ^\.httr-oauth$ +^LICENSE\.md$ diff --git a/LICENSE b/LICENSE index 4ba24c1..4953c18 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,2 @@ -MIT License (https://opensource.org/license/MIT) - -Copyright 2014, Oliver Keyes - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +YEAR: 2025 +COPYRIGHT HOLDER: WikidataR authors diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a761067 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2025 WikidataR authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.