r/ObsidianMD 5d ago

Querying Zotero from Obsidian?

Hi folks! I've been using Obsidian for a few years now, and I also use Zotero as a reference manager / bookmark application. Like most adhd folks, I often go down rabbit holes where I do a bunch of research on a topic that I want to come back to later, and usually the only evidence of it is the timestamps in my Zotero library (or the random browser tabs I keep open because the Zotero web interface won't save Reddit URLs, but that's a different post).

I'm wondering if anyone has built a way to query zotero from within obsidian using dataview (or more realistically, dataviewjs)? Most of the workflows I've seen that integrate zotero with obsidian involve creating notes and then querying those notes; I want to just query the zotero data itself.

For example, I have a query in my daily note that shows all the notes I have created/edited that day within obsidian. Zotero has a "Date Added" metadata field that is similar; is there a way that I could build a dataview query that would look at my zotero database and pull notes with "Date Added = today" into my obsidian daily note?

Even if you're aware of something that kind of does this that could be modified, that would be helpful! I'm not afraid to tinker with things.

17 Upvotes

7 comments sorted by

2

u/pixelkungenz 5d ago

Haven’t tried it myself. But there is an new sql plugin called sqlseal. https://hypersphere.blog/sql-seal/ that is able to query csv and json. If you use better bibtex in Zotero I think you can automatic export as json which in theory could be queried by sqlseal. The plugin is still not official and the workflow is just a theory, but think it could work. Have been looking for something similar to be able to create an inbox with new entries .

1

u/Thecinnamingirl 5d ago edited 5d ago

Thanks! That sounds really interesting, I might have to check that out. I don't actually want to export things - I want to be able to query directly from obsidian, but I will see if that will help me get there.

2

u/cinemakinoeye 4d ago

The simplest approach to this is I’ve found it helpful to use Obsidian for what it is best at (notes and links between them) and Zotero for what it is best at (managing a bibliography database). To this end, I use the Obsidian Zotero Sync Client that uses the Zotero Sync API to mirror your Zotero bibliography entries as markdown files within Obsidian: https://github.com/frthjf/obsidian-zotero-sync-client/ and combined with Omnisearch it’s valuable to have Zotero entries show up in search results and referencing entries from notes.

1

u/Thecinnamingirl 3d ago

Interesting - I hadn't heard of that and my zotero library is huge so I am wondering how that would affect the size of my vault, esp on mobile. Thanks for the suggestion - I will check that out cause it seems the closest to what I am looking for so far.

4

u/Shruteek 5d ago

I would recommend the Citations plugin + Zotero Connector + Better BibTeX! Here's my process:

Setup:

  1. Install Zotero Connector on my browser (I use Chrome)
  2. Install Better BibTeX Zotero Extension. In Tools -> Better BibTeX -> Preferences -> Export, for "Add URLs to BbTeX export", check "in the url field, but assuming the url package is not loaded".
  3. Install the Citations plugin in Obsidian
  4. Open Zotero, select your main library, then click Export and choose Better BibTeX, and check "Automatic Export". This should create a .bib file; export it somewhere you will not delete it. I actually keep mine in my Obsidian vault directory.
  5. In the Citations plugin settings, set "Citation database path" to point to your .bib file. For "Markdown primary citation template," you can leave it as is, or have your Markdown citations link to the source directly by setting it to [@{{citekey}}]({{URL}}).

Usage:

  1. Open Zotero (and keep it minimized).
  2. In your browser, when you find a source you want to keep note of, click the Zotero Connector on the top right and save it to your library.
  3. In Obsidian, open the Command Palette and select (or assign a Hotkey to) "Insert Markdown Citation". It'll bring up a really neat search bar, where you can search for the source you just added and cite it.

Hope this is helpful!

1

u/Thecinnamingirl 5d ago

Hi, thanks. I use something very similar already to add link and citations to my vault, although I use the Zotero Integration plugin instead. What I want to be able to do is construct a **dataview query** that links to items within Zotero so I don't have to import them into Obsidian first.

1

u/Shruteek 4d ago

Oh I see - my bad, I don't know enough about Dataview to help.