Importar BibReferences
Importar Referências Bibliográficas usando o pacote OpenDataBio R
less than a minute
#sua conexao
library(opendatabio)
base_url="http://localhost/opendatabio/api"
token ="O SEU TOKEN AQUI"
cfg = odb_config(base_url=base_url, token = token)
odb_test(cfg)
#leia no R as referencias bibliograficas
library(rbibutils)
bibs = readBib(file="yourFileWithReferences.bib")
formatbib <- function(x) {
con <- textConnection("bibref", "w")
writeBib(x,con=con)
bibref = paste(bibref,collapse = " ")
close(con)
return(bibref)
}
#prepara para importar ao odb
bibtexts = sapply(bibs,formatbib)
data = data.frame(bibtex=bibtexts,standardize=1,stringsAsFactors = F)
#importa
jobid = odb_import_bibreferences(data,odb_cfg = cfg)
#aguarda finalizacao
odb_get_jobs(params=list(id=jobid$id),odb_cfg = cfg)
#pega o log da importacao
dt = odb_get_affected_ids(job_id=jobid$id,odb_cfg = cfg)