更新时间:2022-05-15 22:46:23
我发现了另一种有前途的解决方案,在实践中效果不如
I have found another promising solution that does not work as well in practice as in
CrossRef允许您直接上传链接的csv,然后在此处执行文本查询: http://www.cros-s-ref.org/stqUpload/
CrossRef allows you to upload the linked csv directly, and then performs a text query here: http://www.cros-s-ref.org/stqUpload/
但是,在250个查询中,只有18个(〜7%)返回了doi.
However, only 18 of the 250 queries (~7%) returned a doi.
根据Brian Diggs的回答,在此尝试完成了95%的工作-编写基于xml的查询,它仍然存在一些错误,需要使用sed
进行一些删除.但是,最大的问题是提交查询时我的会话超时".
Based on the answer by Brian Diggs, here an attempt that does 95% of the work - toward writing the xml-based query, it still has a few bugs that require some deletion using sed
. But the biggest problem that my "session timed out" when the query was submitted.
xml语法包括使用模糊匹配的选项.
the xml syntax includes an option to use fuzzy matching.
doiquery.xml包含@Brians答案中的模板文本; citations.csv链接在上方.
the doiquery.xml contains the template text in @Brians answer; the citations.csv 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')
Creativyst软件提供了基于Web的 CSV到XML 一个>转换器.
步骤:
此外,请参阅以下相关问题:要解析的Shell脚本CSV转换为XML查询?
Also, see this related question: Shell script to parse CSV to an XML query?