Here are two options
CSV upload
I have found another promising solution that does not work as well in practice as uploading a CSV directly and performing a text query here at http://www.crossref.org/stqUpload/.
However, only 18 of the 250 queries (≈7%) returned a DOI.
XML Query
Based on the answer by Brian Diggs, here is an attempt in the R programming language that does 95% of the work—toward writing the XML-based query. It still has a few bugs that need to be removed using sed
. But the biggest problem is the “session timed out” errors I had encountered when the query was submitted.
The XML syntax includes an option to use fuzzy matching.
The doiquery.xml
file contains the template text from Brian’s answer; the citations.csv
file is linked above.
library(XML)
doiquery.xml <- xmlTreeParse('doiquery.xml')
query <- doiquery.xml$doc$children$query_batch[["body"]]
citations <- read.csv("citations.csv")
new.query <- function(citation, query = query){
xmlValue(query[["author"]]) <- as.character(citation$author)
xmlValue(query[["year"]]) <- as.character(citation$year)
xmlValue(query[["article_title"]][["text"]]) <- citation$title
xmlValue(query[["journal_title"]]) <- citation$journal
return(query)
}
for (i in 1:nrow(citations)){
q <- addChildren(q, add.query(citations[i,]))
}
axml <- addChildren(doiquery.xml$doc$children$query_batch, q )
saveXML(axml, file = 'foo.xml')
CSV to XML Converter
Creativyst software provides a Web-based CSV to XML converter.
The necessary steps to take are as follows.
- Enter the column names in the ElementIDs field.
- Enter
document
in the DocID field.
- Enter
query
in RowID field.
- Copy and paste the CSV file into the Input CSV file field.
- Click Convert.
See also a related question: Shell script to parse CSV to an XML query?