Skip to contents

AFAICT this API is a REST wrapper around the SPARQL service

Usage

oc_coci_refs(doi, exclude = NULL, filter = NULL, sort = NULL, ...)

oc_coci_cites(doi, exclude = NULL, filter = NULL, sort = NULL, ...)

oc_coci_meta(doi, exclude = NULL, filter = NULL, sort = NULL, ...)

oc_coci_citation(oci, ...)

Arguments

doi

(character) one or more Digital Object Identifiers (DOIs)

exclude

(character) a field_name; all the rows that have an empty value in the field_name specified are removed from the result set

filter

=<field_name>:<operator><value>: only the rows compliant with <value> are kept in the result set. The parameter <operation> is not mandatory. If <operation> is not specified, <value> is interpreted as a regular expression, otherwise it is compared by means of the specified operation. Possible operators are "=", "<", and ">". For instance, filter=title:semantics? returns all the rows that contain the string "semantic" or "semantics" in the field title, while filter=date:>2016-05 returns all the rows that have a date greater than May 2016.

sort

=<order>(<field_name>): sort in ascending (<order> set to "asc") or descending (<order> set to "desc") order the rows in the result set according to the values in <field_name>. For instance, sort=desc(date) sorts all the rows according to the value specified in the field date in descending order.

...

curl options passed on to crul::verb-GET

oci

(character) one or more Open Citation Identifiers (OCIs)

Value

data.frame, see http://opencitations.net/index/coci/api/v1 for explanation of the resulting columns

References

http://opencitations.net/index/coci/api/v1, https://github.com/opencitations/api-coci

Examples

doi1 <- "10.1108/jd-12-2013-0166"
doi2 <- "10.1371/journal.pgen.1005937"
oci1 <-
 "02001010806360107050663080702026306630509-0200101080636102704000806"
oci2 <-
 "0200101000836191363010263020001036300010606-020010003083604090301050910"

if (
crul::ok(
"http://opencitations.net/index/coci/api/v1/references/10.1108/jd-12-2013-0166",
timeout_ms = 1000L)
) {
try(
  oc_coci_cites(doi1),
  silent = TRUE
)
}
#> # A tibble: 34 × 7
#>    citing                     timespan creation journal_sc cited oci   author_sc
#>  * <chr>                      <chr>    <chr>    <chr>      <chr> <chr> <chr>    
#>  1 10.7717/peerj-cs.421       P6Y0M1D  2021-03… no         10.1… 0610… no       
#>  2 10.3233/ds-190019          P4Y8M16D 2019-11… no         10.1… 0610… no       
#>  3 10.3233/ds-190016          P4Y8M16D 2019-11… no         10.1… 0610… yes      
#>  4 10.3233/sw-180307          P3Y10M1… 2019-01… no         10.1… 0610… no       
#>  5 10.3233/sw-160224          P1Y0M14D 2016-03… no         10.1… 0610… yes      
#>  6 10.1057/s41275-017-0070-x  P2Y4M    2017-08  no         10.1… 0610… no       
#>  7 10.7287/peerj.preprints.3… P2Y11M2… 2018-03… no         10.1… 0611… no       
#>  8 10.1101/108480             P1Y11M5D 2017-02… no         10.1… 0613… no       
#>  9 10.59350/zcrhs-r7h02       P3Y10M2… 2019-02… no         10.1… 0613… no       
#> 10 10.1007/978-3-030-01379-0… P2Y      2018     no         10.1… 0615… yes      
#> # ℹ 24 more rows

### More examples
if (FALSE) { # \dontrun{
# references
oc_coci_refs(doi1, exclude = "oci")
oc_coci_refs(doi1, filter = "date:>2016-05", verbose = TRUE)
oc_coci_refs(doi2)
oc_coci_refs(c(doi1, doi2))

# citations
oc_coci_cites(doi1, exclude = "oci")
oc_coci_cites(doi2)
oc_coci_cites(c(doi1, doi2))

# metadata
oc_coci_meta(doi2)
oc_coci_meta(c(doi1, doi2))

# citation - an OCI instead of a DOI
oc_coci_citation(oci1)
oc_coci_citation(c(oci1, oci2))
} # }