Jump to content

Zotero Support


Recommended Posts

Hi,

 

it would be great if Alfred would work together with Zotero so that Zotero references can be searched from Alfred. How could that be implemented?  The 'search Mail.app' workflow shows the results from a mail search. I am thinking about something similar. What does Alfred need to do that? What scripting would be necessary?

 

Thanks! 

Link to comment
Share on other sites

I'm not too familiar with Zotero so I could totally off key here but first off we'd have to know where and how Zotero stores its data.

Is it open? Do they have some form of API?

With this info it could be feasible.

Link to comment
Share on other sites

I'm not too familiar with Zotero so I could totally off key here but first off we'd have to know where and how Zotero stores its data.

Is it open? Do they have some form of API?

With this info it could be feasible.

 

There are basically two ways to access Zotero's data:

 

(A) A server API, which is well documented: http://www.zotero.org/support/dev/server_api/v2/start

Here is also a python library: https://github.com/urschrei/pyzotero

Maybe there are also libraries for other languages

 

(b ) Access the local zotero database (read only). It's a SQLite database. The documentation isn't very good but it's easy to open and take a look at. 

http://www.zotero.org/support/dev/client_coding/direct_sqlite_database_access

Here is a python project that reads the local database: https://github.com/smathot/qnotero

Edited by greghoch
Link to comment
Share on other sites

There are basically two ways to access Zotero's data:

 

(A) A server API, which is well documented: http://www.zotero.org/support/dev/server_api/v2/start

Here is also a python library: https://github.com/urschrei/pyzotero

Maybe there are also libraries for other languages

 

(b ) Access the local zotero database (read only). It's a SQLite database. The documentation isn't very good but it's easy to open and take a look at. 

http://www.zotero.org/support/dev/client_coding/direct_sqlite_database_access

Here is a python project that reads the local database: https://github.com/smathot/qnotero

It shouldn't be too difficult then to get a functional workflow. I don't have much free time right now but when I do get some, if nobody has tackled this then I'll give it a go.

Link to comment
Share on other sites

Yeah me too.. I've been longing for that for such a long time...If you can implement that Pedro, that would be amazingly welcome :)

 

I am pretty far with a workflow that allows you to search for items in your zotero database, open attachments and reveal items in zotero standalone. But it's still going to take some time before I can share the version, which requires adding some settings for the location of the zotero database etc. 

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi,

 

is there already progress on a Zotero workflow?

Zotero integration would be greatly appreciated!

 

 

For now, the workflow is running with two operations: a) open attachment file, B) reveal item in Zotero library. 

It is not as fast I would hope though (despite caching) and I still need to implement some settings (mainly directory of zotero library). I will also not really be able to maintain the workflow. So are there people who could help with the last steps and be willing to contribute to maintaining the workflow? I will clean things up and upload it to github over the next days with a beta release.

Link to comment
Share on other sites

Hi,

 

didn't see the post until today. opening attachments and finding items is great.

Looking forward to installing the workflow.

For maintenance: not sure I can contribute - not a skilled programmer at all.

cheers

Link to comment
Share on other sites

  • 7 months later...

For now, the workflow is running with two operations: a) open attachment file, B) reveal item in Zotero library. 

It is not as fast I would hope though (despite caching) and I still need to implement some settings (mainly directory of zotero library). I will also not really be able to maintain the workflow. So are there people who could help with the last steps and be willing to contribute to maintaining the workflow? I will clean things up and upload it to github over the next days with a beta release.

I'd love to see a beta of this workflow, and I'd also be willing to work on keeping it running. Is it up on GitHub yet?

Link to comment
Share on other sites

I have a beta version of a Zotero workflow that I've just gotten off the ground. No actions yet, I've just been fiddling with the script filter. I think I've figured out how to access the local zotero database, regardless of the user (assuming it is consistently located nested within the ~/Library/Application Support/Zotero folder). It is also pretty darn fast. I would love to have a really robust Zotero + Alfred workflow out there, so I'm willing to merge/work together. Hopefully I will get this beta code up on GitHub soon. If you're interested tho, just shoot me a message.

 

stephen

Link to comment
Share on other sites

  • 3 weeks later...

The first collection of code is now up on GitHub. The project isn't complete, particularly on the backend. I haven't finished my code for formatting the data once you choose an item. I've spent a vast majority of my time on the true heart of the workflow, which is the script that reads the user's Zotero sqlite database and creates a JSON cache of the citation information. I have also written filters to search that cache generally, title-specific, author-specific, tag-specific, and collection-specific. 

 

This workflow is written in Python using the alp module. 

 

All of the code can be found here: https://github.com/smargh/ZotQuery

 

Feel free to fork anything and help me along.

Link to comment
Share on other sites

I have put my code on github and invited you as a collaborator. It's private now just because I wanted to get it to you as quickly as possible and still have to check whether there is some private information in there. Afterwards, I will make it public.

 

I haven't looked at the code for a long time so I don't even know whether I included everything. Let me know whether it is working. You have to change the location of the zotero folder in 'cache.py' (mine is not at the default location). It's the zotero_folder variable. I don't think the location is defined anywhere else but maybe I am wrong. 

 

The workflow itself is actually pretty elaborate. You can search zotero items using fuzzy search (‘Ein1931’ would list ’Einstein-1931-Theory’ as one of the top hits), open attachment files or reveal items in the zotero library using cmd as a modifier key. If there are multiple attachments, I am using chaining to open a separate Aldred window that lists the attachments. The Zotero library is cached and updated whenever the zotero file changes. I always had the feeling that the workflow is a little to slow but maybe that is because my library is big and because I want things to be instant. There are two other things missing:
- settings (e.g. to define the location of the zotero library)
- The chaining approach for multiple attachments is way to slow for my taste and there has to be a better approach. My old notes are "filter like the skype workflow" but not sure about that. 
Link to comment
Share on other sites

Alright. Thanks. I can see the code. Could you also push the actual .workflow file? Its really hard to get a sense of the structure without the big-picture as well. 

 

I already see that we both worked off of libzotero. I ended up highly modifying that stuff (creating my own hybrid versions of sqlite queries) but its at the foundation of my workflow as well. With your auto-cache updating, did you have any problems when Zotero itself was open. I've found that when the app is open, the sqlite database is locked, so I can't read any data. It's primarily for this reason that I made the cache updating manual (so the user can ensure that the app is closed). 

 

Anyway, I'm going to explore some, and I'll get back to you. I'd love to hear your thoughts tho on the functionality you were envisioning. It seems like the goal was to have a simpler search mechanism. So the actions you could take on the item once you chose it was either to open its attachment, or open the Zotero app at that item? I'm interested in formatting the item for inserting in a document, as well as your functions. But like I said, I haven't gotten to that stuff yet. 

Link to comment
Share on other sites

The workflow file is on github now with '~/Library/Application Support/Zotero' as the location of the Zotero folder. So it might work out of the box but I haven't tested it. 

 

I also modified parts of libzotero but I don't remember how much. My goal was a quick search and lookup function and I never had problems with the caching file zotero is running. Right now, the workflow always caches after a search has ended because it would slow down the search when I do it first. 

Link to comment
Share on other sites

Well, I've already learned something. Your Gnotero-based script can cache even with Zotero running because the libzotero script creates a clone .sqlite database first, and then reads from that. You can clone a .sqlite database, even if it is locked, while you cannot read/write a locked database. I'm about to update my code accordingly. 

 

Would you be interested in collaborating to create a single workflow? I tried hard to comment out much of my code, to make it fairly explanatory, so that should help somewhat in reaching a modicum of equal knowledge. It will take me a while to digest all of your code (I'm still fairly new to Python, plus, like most decent workflows, there are alot of moving parts and scripts). But I think having one kick-ass workflow for Zotero would be awesome. And I know splitting the coding would save some time (after the initial catch up on each ind. project). It will undoubtedly take time to figure out which parts to merge and how best to merge them, so if that sounds to time-consuming, we can go our separate ways. Tho I would still like to chat. 

 

Let me know what you think,

stephen

Link to comment
Share on other sites

I really like the idea but my plate is pretty full right now and I wasn't planing to work on my code anytime soon. I am happy to have a conversation though and answer some question if my code is confusing so that you can better use it. How does that sound?

Link to comment
Share on other sites

Can you confirm that the workflow is working for you, Shawn? The nature of the initial replies is such that only people with problems speak up. It's been working great for me, but I want to ensure that this workflow does indeed function for other people. 

 

I'm also working on a static page on my blog that will have the full README, and along the way I will be posting short blurbs on how I use the workflow in my writing process. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...