Accessing Zotero data from biber

I'm thinking about an input datasource plugin for biber which would allow direct extraction from Zotero but I have a few questions:

1. I know that there is an ItemID in the database but this doesn't appear to be visible to users even though the REST needs it to retrieve items. biber/biblatex requires citation by a key so it's not clear how to get round this if users can't see the itemID for their items in the UI.
2. What is the likely use case? Extraction from local database or the remote Zotero synced copy. The former would use SQLlite access and the latter probably REST.
  • Just wanted to say that the idea of making Zotero's data available to biblatex/biber seems very intriguing to me. AFAIK the whole citekey has been discussed for quite some time now, but AFAICS with no result so far. If this gets resolved, Zotero would become much more interesting for the LaTeX/BibTeX world, especially if biber could access it directly.
  • No answer so far. Isn't there any interest in biber/biblatex support from Zotero's side?
  • Yes, this is quite doable. One relatively easy approach is opening a read-only connection to the Sqlite database. Even better, you can build off of Gnotero, which gives you Python bindings for read access to the database.
  • @ajylon: Phil's question was not how to access the database, but if there was some kind of citekey (ItemID) which is exposed in Zotero's GUI. In LaTeX, the users refers to an item with \cite{citekey}. If he doesn't know the citekey, there is no sensible way to use Zotero's data in a LaTeX document.
  • So the idea here is that biber will query the local database or online library and feed that into BibLaTeX? Zotero here would then work as a backend for BibLaTeX. Nice.

    ItemIDs will work, but they're really not very pleasant-- hexadecimal strings. They can be easily produced by an export translator (i.e., https://github.com/ajlyon/zotero-bits/blob/master/zotselect-link.js), but that's still not very convenient. I think it would be more convenient to build a little command-line tool using Gnotero's Python library for Zotero access -- the tool would take a short string (title, author, year keywords) and return potential results, user picks one, the tool outputs the ItemID. That could easily be tied into Vim or other editors for resolution of, say, \cite{Jones 2001} into \cite{0_FA342A1}.
  • edited January 23, 2011
    So the idea here is that biber will query the local database or online library and feed that into BibLaTeX? Zotero here would then work as a backend for BibLaTeX.
    Yes, that is exactly the idea. Phil has done a lot of work on abstracting the data handling of biber so that all kind of data could theoretically be used for biber/biblatex.
    I think it would be more convenient to build a little command-line tool using Gnotero's Python library for Zotero access -- the tool would take a short string (title, author, year keywords) and return potential results, user picks one, the tool outputs the ItemID. That could easily be tied into Vim or other editors for resolution of, say, \cite{Jones 2001} into \cite{0_FA342A1}.
    From the perspective of a normal LaTeX/BibTeX workflow this seems quite cumbersome. When you cite in LaTeX you normally just go to the bibliography app, pick the citekey of the item you want to cite and write \cite{citekey} in your LaTeX document. Going the route of an additional query tool seems like adding unnecessary complexity without any real gain. Really, the only thing needed here is some kind of unique identifier for each item which is accessible in both the GUI and the database.
  • My concern is that these cite keys are not very nice. While they are stable and unique, they will have to be copied and pasted anyway. The export translator I linked to should make it possible to get citekeys by typing Ctrl-Shift-C and pasting into the document.
  • The translator doesn't work here with Zotero 2.1b4 on Firefox 4 with OSX 10.6.6.
  • Sorry about that -- the translator needed to be updated for the changes in the translator infrastructure in the 2.1 betas. Try the version up now at the same link.
  • The default auto-generated cite keys in the stock BibTeX translator aren't as cumbersome as item ids & are unique. They can most likely be mapped back to the original records with the only caveat being that the numbering of otherwise duplicate citekeys is not stable. One could use the convention that the record with the oldest creation date does not have a number appended & the next oldest has a 1 & so on. It is not as good as it will be when Zotero gets local identifiers, but it seems like a reasonable compromise & is somewhat similar to what is done in pandoc.
  • Currently biber uses the rdf:about attribute but this isn't ideal. When Zotero has real local identifiers, I'll use them and also make a direct SQLlite driver probably.
Sign In or Register to comment.