ropensci / citecorp

Client for the Open Citations Corpus
https://docs.ropensci.org/citecorp
Other
11 stars 4 forks source link

Package not working anymore? #10

Closed rkrug closed 1 year ago

rkrug commented 1 year ago

It seems that citecorp is not working anymore?

See transcript below.

Rainer

> library("citecorp")
> oc_doi2ids("10.1097/igc.0000000000000609")
data frame with 0 columns and 0 rows
> devtools::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.1 (2023-06-16)
 os       macOS Ventura 13.4.1
 system   aarch64, darwin20
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Zurich
 date     2023-06-26
 pandoc   3.1.3 @ /opt/homebrew/bin/pandoc

─ Packages ──────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cachem        1.0.7   2023-02-24 [1] CRAN (R 4.3.0)
 callr         3.7.3   2022-11-02 [1] CRAN (R 4.3.0)
 citecorp    * 0.3.0   2020-04-16 [1] CRAN (R 4.3.0)
 cli           3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 crayon        1.5.2   2022-09-29 [1] CRAN (R 4.3.0)
 crul          1.4.0   2023-05-17 [1] CRAN (R 4.3.0)
 curl          5.0.1   2023-06-07 [1] CRAN (R 4.3.0)
 data.table    1.14.8  2023-02-17 [1] CRAN (R 4.3.0)
 devtools      2.4.5   2022-10-11 [1] CRAN (R 4.3.0)
 digest        0.6.31  2022-12-11 [1] CRAN (R 4.3.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.3.0)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 fauxpas       0.5.2   2023-05-03 [1] CRAN (R 4.3.0)
 fs            1.6.1   2023-02-06 [1] CRAN (R 4.3.0)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.3.0)
 htmltools     0.5.5   2023-03-23 [1] CRAN (R 4.3.0)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.3.0)
 httpcode      0.3.0   2020-04-10 [1] CRAN (R 4.3.0)
 httpuv        1.6.9   2023-02-14 [1] CRAN (R 4.3.0)
 jsonlite      1.8.5   2023-06-05 [1] CRAN (R 4.3.0)
 later         1.3.0   2021-08-18 [1] CRAN (R 4.3.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.3.0)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.3.0)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
 pkgbuild      1.4.0   2022-11-27 [1] CRAN (R 4.3.0)
 pkgload       1.3.2   2022-11-16 [1] CRAN (R 4.3.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.3.0)
 processx      3.8.1   2023-04-18 [1] CRAN (R 4.3.0)
 profvis       0.3.7   2020-11-02 [1] CRAN (R 4.3.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0)
 ps            1.7.5   2023-04-18 [1] CRAN (R 4.3.0)
 purrr         1.0.1   2023-01-10 [1] CRAN (R 4.3.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.3.0)
 Rcpp          1.0.10  2023-01-22 [1] CRAN (R 4.3.0)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.3.0)
 rlang         1.1.0   2023-03-14 [1] CRAN (R 4.3.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 shiny         1.7.4   2022-12-15 [1] CRAN (R 4.3.0)
 stringi       1.7.12  2023-01-11 [1] CRAN (R 4.3.0)
 stringr       1.5.0   2022-12-02 [1] CRAN (R 4.3.0)
 triebeard     0.4.1   2023-03-04 [1] CRAN (R 4.3.0)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.3.0)
 urltools      1.7.3   2019-04-14 [1] CRAN (R 4.3.0)
 usethis       2.1.6   2022-05-25 [1] CRAN (R 4.3.0)
 vctrs         0.6.2   2023-04-19 [1] CRAN (R 4.3.0)
 whisker       0.4.1   2022-12-05 [1] CRAN (R 4.3.0)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.3.0)

 [1] /Users/rainerkrug/R/library/aarch64-apple-darwin20/4.3
 [2] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library

─────────────────────────────────────────────────────────────────────────────────────────
>

Selbosh commented 1 year ago

Looks like some functions work, but not others.

library(citecorp)
doi1 <- "10.1108/jd-12-2013-0166"

oc_coci_cites(doi1) # works
oc_coci_refs(doi1)  # works
oc_coci_meta(doi1)  # works

These use the REST endpoint.

But these rely on SPARQL:

oc_doi2ids(doi1)  # 0 columns, 0 rows

The same type of query pasted onto the https://opencitations.net/meta/sparql sandbox seems to work:

PREFIX datacite: <http://purl.org/spar/datacite/>
  PREFIX literal: <http://www.essepuntato.it/2010/06/literalreification/>
  SELECT ?paper ?pmid ?pmcid ?value
  WHERE {
    {
      ?paper datacite:hasIdentifier [
          datacite:usesIdentifierScheme datacite:doi ;
          literal:hasLiteralValue ?value
      ] .
      OPTIONAL {
        ?paper datacite:hasIdentifier [
          datacite:usesIdentifierScheme datacite:pmid ;
          literal:hasLiteralValue ?pmid
        ] .
      }
      OPTIONAL {
        ?paper datacite:hasIdentifier [
          datacite:usesIdentifierScheme datacite:pmcid ;
          literal:hasLiteralValue ?pmcid
        ] .
      }
    } .
    VALUES ?value { "10.1093/biomet/80.3.527" }
  }

returning the following output

{
  "head" : {
    "vars" : [ "paper", "pmid", "pmcid", "value" ]
  },
  "results" : {
    "bindings" : [ {
      "value" : {
        "type" : "literal",
        "value" : "10.1093/biomet/80.3.527"
      },
      "paper" : {
        "type" : "uri",
        "value" : "https://w3id.org/oc/meta/br/06250321084"
      }
    } ]
  }
}

But when the R package does it, the results$bindings are empty. Will try to debug this: maybe it is calling the wrong endpoint or something.

Selbosh commented 1 year ago

@rkrug I have just pushed a fix, which seems to work now for oc_doi2ids("10.1097/igc.0000000000000609") and other examples I tried.

Neither oc_pmid2ids nor oc_pmcid2ids produce results for the examples in the Examples section of the documentation, but they give the same output as the sandbox, so that appears to be a separate issue.

rkrug commented 1 year ago

Thanks - I actually need the function oc_coci_refs() which is still not working. I think it is a similar issue.