Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ropensci/oai
OAI-PMH R client
https://github.com/ropensci/oai
data-access oai-pmh peer-reviewed r r-package rstats scholarly-api
Last synced: 11 days ago
JSON representation
OAI-PMH R client
- Host: GitHub
- URL: https://github.com/ropensci/oai
- Owner: ropensci
- License: other
- Created: 2015-06-12T20:14:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T16:47:07.000Z (almost 2 years ago)
- Last Synced: 2024-10-20T00:00:58.687Z (19 days ago)
- Topics: data-access, oai-pmh, peer-reviewed, r, r-package, rstats, scholarly-api
- Language: R
- Homepage: https://docs.ropensci.org/oai
- Size: 478 KB
- Stars: 14
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
editor_options:
chunk_output_type: console
---```{r echo=FALSE}
knitr::opts_chunk$set(
warning = FALSE,
message = FALSE,
collapse = TRUE,
comment = "#>",
cache.path = "inst/cache/"
)
```# `oai`: General Purpose 'Oai-PMH' Services Client
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R-check](https://github.com/ropensci/oai/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/oai/actions/workflows/R-CMD-check.yaml)
[![cran checks](https://cranchecks.info/badges/worst/oai)](https://cranchecks.info/pkgs/oai)
[![codecov.io](https://codecov.io/github/ropensci/oai/coverage.svg?branch=master)](https://codecov.io/github/ropensci/oai?branch=master)
[![rstudio mirror downloads](https://cranlogs.r-pkg.org/badges/oai?color=2ED968)](https://github.com/r-hub/cranlogs.app)
[![cran version](https://www.r-pkg.org/badges/version/oai)](https://cran.r-project.org/package=oai)
[![](https://badges.ropensci.org/19_status.svg)](https://github.com/ropensci/software-review/issues/19)`oai` is an R client to work with OAI-PMH (Open Archives Initiative Protocol for Metadata Harvesting) services, a protocol developed by the Open Archives Initiative (https://en.wikipedia.org/wiki/Open_Archives_Initiative). OAI-PMH uses XML data format transported over HTTP.
OAI-PMH Info:
* Wikipedia (https://en.wikipedia.org/wiki/Open_Archives_Initiative_Protocol_for_Metadata_Harvesting)
* OAI V2 specification (http://www.openarchives.org/OAI/openarchivesprotocol.html)`oai` is built on `xml2` and `httr`. In addition, we give back data.frame's whenever possible to make data comprehension, manipulation, and visualization easier. We also have functions to fetch a large directory of OAI-PMH services - it isn't exhaustive, but does contain a lot.
OAI-PMH instead of paging with e.g., `page` and `per_page` parameters, uses (optionally) `resumptionTokens`, optionally with an expiration date. These tokens can be used to continue on to the next chunk of data, if the first request did not get to the end. Often, OAI-PMH services limit each request to 50 records, but this may vary by provider, I don't know for sure. The API of this package is such that we `while` loop for you internally until we get all records. We may in the future expose e.g., a `limit` parameter so you can say how many records you want, but we haven't done this yet.
## Install
Install from CRAN
```{r eval=FALSE}
install.packages("oai")
```Development version
```{r eval=FALSE}
devtools::install_github("ropensci/oai")
``````{r pkg-load}
library("oai")
```## Identify
```{r identify}
id("http://oai.datacite.org/oai")
```## ListIdentifiers
```{r list-identifiers}
list_identifiers(from = '2018-05-01T', until = '2018-06-01T')
```## Count Identifiers
```{r count-identifiers, cache=TRUE}
count_identifiers()
```## ListRecords
```{r list-records}
list_records(from = '2018-05-01T', until = '2018-05-15T')
```## GetRecords
```{r get-records}
ids <- c("87832186-00ea-44dd-a6bf-c2896c4d09b4", "d981c07d-bc43-40a2-be1f-e786e25106ac")
get_records(ids)
```## List MetadataFormats
```{r list-metadataformats}
list_metadataformats(id = "87832186-00ea-44dd-a6bf-c2896c4d09b4")
```## List Sets
```{r list-sets}
list_sets("http://api.gbif.org/v1/oai-pmh/registry")
```## Examples of other OAI providers
### Biodiversity Heritage Library
Identify
```{r bhl-identify}
id("http://www.biodiversitylibrary.org/oai")
```Get records
```{r bhl-get-records}
get_records(c("oai:biodiversitylibrary.org:item/7", "oai:biodiversitylibrary.org:item/9"),
url = "http://www.biodiversitylibrary.org/oai")
```## Acknowledgements
Michał Bojanowski thanks National Science Centre for support through grant 2012/07/D/HS6/01971.
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/oai/issues).
* License: MIT
* Get citation information for `oai` in R doing `citation(package = 'oai')`
* Please note that this project is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By participating in this project you agree to abide by its terms.```{r logo, include = FALSE, eval = FALSE}
library(hexSticker)
library(magick)
download.file(
"https://wiki.epc.ub.uu.se/download/thumbnails/34212946/images.png?version=1&modificationDate=1511952524492&api=v2",
dest = fig <- tempfile()
)image_read(fig) |>
image_crop(geometry = "x90%") |>
image_write(path = fig2 <- tempfile())sticker(
fig2,
package = "oai",
url = "https://docs.ropensci.org/oai/",
s_x = 1,
s_y = 0.83,
s_width = 0.7,
p_size = 25,
p_y = 1.5,
u_color = "#ffffff",
u_size = 5,
h_fill = "#0C0F2E",
h_color = "black",
filename = "man/figures/logo.png"
)
```