Skip to contents

Accepts an item as the Web API returns it (with key, data, library and links), the data of such an item, a row of zotLocalRecords(), or an identity list already in this shape, and returns the same identity list for all of them: one rule for every plane.

Usage

zotIdentity(record)

Arguments

record

A list or one-row data.frame in any of the shapes above.

Value

A list: itemKey, library, doi, md5, title, year, author, hasFile.

Details

year is the first four-digit year in date. author is the family name (or single-field name) of the first creator of type author; an item without one has NA. hasFile is TRUE for an API item whose links carry an attachment, the value of an explicit hasFile field, and NA when unknown, so that the file guard of zotSameItem() only acts on observed facts. library is "user" or the group id when the record says where it lives, NA otherwise.

Examples

Item <- list(
  key = "K1", library = list(type = "group", id = 555L),
  links = list(attachment = list(href = "…")),
  data = list(title = "A record", date = "March 2026", DOI = "10.1000/x",
              creators = list(list(creatorType = "editor", lastName = "First"),
                              list(creatorType = "author", lastName = "Lovelace")))
)
zotIdentity(Item)
#> $itemKey
#> [1] "K1"
#> 
#> $library
#> [1] "555"
#> 
#> $doi
#> [1] "10.1000/x"
#> 
#> $md5
#> [1] NA
#> 
#> $title
#> [1] "A record"
#> 
#> $year
#> [1] "2026"
#> 
#> $author
#> [1] "Lovelace"
#> 
#> $hasFile
#> [1] TRUE
#>