Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

friendly wrappers for simple queries #242

Open
MLopez-Ibanez opened this issue Jun 12, 2024 · 3 comments
Open

friendly wrappers for simple queries #242

MLopez-Ibanez opened this issue Jun 12, 2024 · 3 comments

Comments

@MLopez-Ibanez
Copy link

A query like:

cr_cn(dois = "10.1007/s10479-023-05251-3", format="citeproc-json")

returns lots of data. It would be nice to have friendly wrappers for simple queries that only return the data queried as an R list:

cr_cn(dois = "10.1007/s10479-023-05251-3", format="list", fields=c("title", "author", "year"))

or to check that a doi actually exists:

doi_exists(dois = "10.1007/s10479-023-05251-3")

or to check that it matches some given data:

doi_match(dois = "10.1007/s10479-023-05251-3", title = "A title", year = "1997", exact=FALSE)

or to check that a paper is retracted or not (https://www.crossref.org/documentation/principles-practices/best-practices/versioning/#00327):

is_retracted(dois = "10.1007/s10479-023-05251-3")

Ideally, this should not require having "bibtex" installed:

cr_cn(dois = "10.1007/s10479-023-05251-3", format="bibentry")

returns:

Error: Please install bibtex
@njahn82
Copy link
Member

njahn82 commented Jun 12, 2024

Hi @MLopez-Ibanez

You can use cr_works to get parsed metadata by DOI and select the fields.

library(rcrossref)
rcrossref::cr_works(filter = list(doi="10.1007/s10479-023-05251-3"), 
                    select = c("title", "issued", "author"))
#> $meta
#>   total_results search_terms start_index items_per_page
#> 1             1           NA           0             20
#> 
#> $data
#> # A tibble: 1 × 3
#>   issued     title                                                      author  
#>   <chr>      <chr>                                                      <list>  
#> 1 2023-03-01 RETRACTED ARTICLE: Prescriptive analytics applications in… <tibble>
#> 
#> $facets
#> NULL

Created on 2024-06-12 with reprex v2.1.0

You can also select columns after getting the data.

library(rcrossref)
req <- rcrossref::cr_works(dois = "10.1007/s10479-023-05251-3") 
req[["data"]][,c("title", "issued", "author")]
#> # A tibble: 1 × 3
#>   title                                                          issued author  
#>   <chr>                                                          <chr>  <list>  
#> 1 RETRACTED ARTICLE: Prescriptive analytics applications in sus… 2023-… <tibble>

Created on 2024-06-12 with reprex v2.1.0

To check if a DOI exists, check the agency.

library(rcrossref)
rcrossref::cr_agency("10.1007/s10479-023-05251-3")
#> $DOI
#> [1] "10.1007/s10479-023-05251-3"
#> 
#> $agency
#> $agency$id
#> [1] "crossref"
#> 
#> $agency$label
#> [1] "Crossref"

Created on 2024-06-12 with reprex v2.1.0

I will look into how to discover retracted articles with Crossref.

I don't think I will support the other suggested data validation functions because they are not supported by the Crossref API.

@MLopez-Ibanez
Copy link
Author

You can use cr_works to get parsed metadata by DOI and select the fields.

cr_works does not seem to return the same output as cr_cn

cr_cn(dois="10.4230/DagRep.5.1.96")
#> [1] "@article{https://doi.org/10.4230/dagrep.5.1.96,\n  doi = {10.4230/DAGREP.5.1.96},\n  url = {https://drops.dagstuhl.de/entities/document/10.4230/DagRep.5.1.96},\n  author = {Greco, Salvatore and Klamroth, Kathrin and Knowles, Joshua D. and Rudolph, Günter},\n  keywords = {multiple criteria decision making, evolutionary multiobjective optimization},\n  language = {en},\n  title = {Understanding Complexity in Multiobjective Optimization (Dagstuhl Seminar 15031)},\n  publisher = {Schloss Dagstuhl – Leibniz-Zentrum für Informatik},\n  year = {2015},\n  copyright = {Creative Commons Attribution 3.0 Germany license}\n}\n"
cr_works(filter = list(doi="10.4230/DagRep.5.1.96"))
#> $meta
#>   total_results search_terms start_index items_per_page
#> 1             0           NA           0             20
#> $data
#> # A tibble: 0 × 0
#> $facets
#> NULL

@MLopez-Ibanez
Copy link
Author

Basically, I have a large database of bibtex entries: https://iridia-ulb.github.io/references/
I would like to do the following:

  • Check that the DOIs added are valid and point to something.
  • Check that the DOIs point to the correct paper (by for example matching the title)
  • Check that a paper in the database has not been retracted.
  • Do the above with the smallest overload on the crossref service possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants