How to do Zotero plugin sync?

How should the Zotero Logseq plug-in handle sync for information that can be updated in either Zotero or Logseq? (continuation of discussion started on Discord here).

It is common for items in Zotero to change their information or metadata. Sometimes this means adding data to an otherwise empty field, and sometimes it is changing existing data, and sometimes it is changing info connected to attached files, such as adding annotations to pdfs attached to Zotero items.

In the Zotero-Roam plugin that is the model for the Zotero-Logseq plugin, item metadata is imported manually from within Roam and a new copy is added to previous imports every time. So to update metadata, the user has to reimport the new metadata and delete the old metadata.

This is ok, but not ideal. So here are possible things the Zotero-Logseq plugin might do, and I’m not sure what is technically possible.

One-way Zotero to Logseq import:

  • (current) manual import, nothing removed
  • automatically delete and replace all existing metadata in Logseq (could be only when run manually or could be run automatically)
  • compare metadata and update/change only changed metadata (manual or automatic)
  • note: not sure if individual annotations taken on pdfs from within Zotero (using the new beta pdf viewer) need to be treated differently than other metadata

Two-way Zotero-Logseq import:

  • is it possible or desirable to have changes to item metadata in Logseq written to items in the Zotero database?

Hopefully others will add their thoughts, especially if they have more technical knowledge of what can be done and how.

hi @Cobblepot,

I believe two-way sync is technically possible since all the metadata we fetched from api are also updatable. We can send back a modified version of metadata back to zotero for updates.

https://www.zotero.org/support/dev/web_api/v3/write_requests

But from a plugin implementation perspective, this will add a lot of complexity compared to the current one way sync approach that we simply pull data from Zotero manually per request.

In the short term, two-way sync won’t be in scope. But once we get a stable and robust version of one-way zotero to logseq import, there’s a possibility that we will add the two-way sync capability based on more users’ requests.

As for updates within the current approach, for now, we decided to take an append-only approach instead of replace-in-place. Each new import for same page would append a new version of metadata block. The advanctage of this is that it’ll make sure it won’t overwite anything in that same page accidentally. And user can comapre the new version metadata and delete the old block manually.

Thanks,
Weihua

Also if this can be done to a Zotero Local instance, when LogSeq is also of local instance?

1 Like

+1 Having Logseq talk to the local instance of Zotero seems more useful than trying to talk to the remote service.

3 Likes

I also noted this

3 Likes

Dumb question but how do you update a Zotero entry in Logseq after it’s been created?