eblondel/zen4R

Zenodo to InvenioRDM - citation export methods

oggioniale opened this issue · 15 comments

With zen4R version 0.9 I try to download the BibTeX citation of the record.
After a:
rec <- zenodo$getRecordByDOI(doi)
I do:
rec$exportAs("BibTeX", filename = "download_files_of_7041152/7041152")
or
rec$exportAsBibTeX(filename = "download_files_of_7041152/7041152")
but I obtain the same error:
Error in open.connection(x, "rb") : HTTP error 404.
Is it related with the changes of Zenodo APIs?

Yes it is related to the change to the new Zenodo API.

is there a way now to download BibTeX? Or should I assume that this is a lost functionality?

At this stage, the method has not been migrated, but it will, so it will not be lost. The overall work to migrate to the new Zenodo is quite huge, and unfortunately there was no real time to test first on sandbox before the upgrade was applied to production. This was done in one shot on both environments, and I'm migrating broken methods one by one where there is no backward compatibility. Give me some time

I had a look and changes were relatively minor. This is in implemented in a dev branch. If you want to test, install zen4R from the dev branch related to the Zenodo upgrade:

remotes::install_github("eblondel/zen4R", ref = "127-zenodo-invenio-rdm")

Let me know if it works for you

no it doesn't work

Can you give me the DOI for which you try to get the citation?

I've tested again and it works. On your side you try to use a filename containing a slash, it can't work.

This works:

library(zen4R)
ZENODO = ZenodoManager$new()
rec = ZENODO$getRecordByConceptDOI("10.5281/zenodo.7034189")
rec$exportAsBibTeX("test") # or rec$exportAs("BibTeX", "test")

I do this:

zenodo <- zen4R::ZenodoManager$new(logger = "INFO")
rec <- zenodo$getRecordByDOI("10.5281/zenodo.7034189")
rec$exportAs("BibTeX", filename = "bib_file")

and your is:

ZENODO = ZenodoManager$new()
rec = ZENODO$getRecordByConceptDOI("10.5281/zenodo.7034189")
rec$exportAsBibTeX("test") # or rec$exportAs("BibTeX", "test")

In both case the output is Error in open.connection(x, "rb") : HTTP error 404.

The error you reports means you installed zen4R from master, not from the dev branch:

remotes::install_github("eblondel/zen4R", ref = "127-zenodo-invenio-rdm")

I do this but I have the same error.

> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS 14.0

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Rome
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] zen4R_0.9      magrittr_2.0.3

I changed the package version to 0.9.9000 on the dev branch. If you can, restart R, and reinstall it, to make sure it was installed from there. This might be a package caching issue in R

Yes! Now it is work!

Thanks @oggioniale for your feedback,. For now i'll keep tickets on InvenioRDM transition open, I will close them when all the work will be merged to the main branch