Revert "Store references in document"

Is it possible to revert the "Store references in document" so that the references are made again to items stored in the local database file (I can't uncheck the corresponding box in Word's preferences dialog, it's greyed out)?

1st EDIT: If I understand correctly, references are always made to items in the local SQL file but the corresponding data can also be included in the Word document itself. So the question here really is: Why can't I uncheck the "Store references in document" box once I have checked it? And why are changes made to items in the database not reflected in the citations in the document? (Seems to be a problem with my machine/setup...)

2nd EDIT: I just saw that if I try to add an additional reference to an item stored in the document itself, the citation dialog box offers me a choice between referencing the stored version of the item and the (possibly changed) originary item in the SQL database. Hmm, that's not the behavior I want or expect...
  • You can't uncheck the box because one or more of the citations in the document isn't linked to your Zotero library, maybe because you deleted it and added it a second time or transferred your library between computers by export/import? This is also why your changes are not reflected in the document, and why you see both the item in the document and the item in your database when adding a citation.

    At the moment, there's no way to change all of the links to a given item in the document to point to another, although that's probably something we should have. If there's only one affected item, you could delete the citations to that item and re-add the version in the database.
  • Ah, I see... which means I'm f*#!&d (pardon my language): I have 30 single documents (making up an edited collection) with 1500+ references to 500+ items. Yes, at some point I had to export/import my library (can't remember why). That seems to have broken most links in most documents. I have to think about the whole mess (and maybe have a couple of drinks to relax ;-)
  • you wouldn't happen to have a backup of your database prior to re-imoirting those references, would you?
  • edited May 9, 2013
    I'll have to check my Dropbox history...

    EDIT: I have several versions in my Dropbox history going back to about a month. What could I do once I have figured out which of these versions is the best?
  • If you have a copy of your library prior to the import/export, the items in that library will still be linked to the cites in your word documents.

    Of course, if you go back to an older version of your database, you'll want to update it with the items you have added/changed since. You could export these items from your current library, replace the database with an older version, and import the newer items into that. That will break the links of these newer items that have been cited in your documents, though.
  • The alternative to what Rintze suggests would be to restore the back-up
    http://www.zotero.org/support/zotero_data#restoring_your_zotero_library_from_a_backup
    to a different computer or a different Firefox profile and then sync.
    The downside is that you'd have hundreds of duplicates which you'd need to merge. The upside would be that all citations - pre and post import/export - would still work.
  • Okay, thanks guys for your help. I'll think about it and then try one of the suggested strategies.
  • edited May 9, 2013
    If my understanding of Zotero syncing is correct, it won't work to use @adamsmith's approach and simply delete the older items (that exist in the "old" database) from your current database prior to the sync-merge, since the deletion would carry over to the sync-merged library and make you lose your old items. (Dan, correct me if I'm wrong)

    But perhaps the following approach would prevent the need to merge duplicates:

    - identify the items in your current library that also exist in your old library (you can sort them by e.g. "Date Modified" and select the oldest ones; their date should match the date of import)
    - add these items to a collection, e.g. "orphans"
    - set up the sync-merge, as @adamsmith suggested
    - after the sync, delete the items from the "orphans" collection
    - merge any duplicates that are left. These would include old items that have been changed since they were imported.

    (and, whenever you mess around with your Zotero data directory, first make a backup)
  • Actually, I think I'm wrong :). Zotero would regard an item from before and after the export/import as two separate items.

    And my proposal would only work cleanly if your old library would be recent enough to include all the items that existed when you exported/imported.
  • Actually, I think I'm wrong :). Zotero would regard an item from before and after the export/import as two separate items.
    yes. That's why I say there'd be hundreds of duplicates. What Rintze says might help you reduce that problem.
  • edited May 9, 2013
    here's what I had in mind.

    technical details to follow if everyone else thinks this will work.

    sync new database to Zotero.org. turn off internet. restore old database. disable sync. identify references that we're cited from the old database (I.e the ones that had lost their connection to the new database). tag them with whatever tag you want (this should bump the date modified). get back online. enable sync. now everything but the tagged items should be deleted and your new items synced to your computer. merge duplicates.

    Edit:
    The step-by-step guide:

    1. Sync your current database with zotero.org

    2. Disable automatic sync

    3. Close Zotero

    4. Back up your data directory locally

    5. Restore your zotero.sqlite file from backup. Don't restore the "storage" folder.

    6. Find all (or as many as you can) references cited in your document in Zotero and tag them with, say, "old references". You can tag multiple references at a time by selecting them and dragging to the tag in the tag selector pane (bottom left). The tag must already exist in the pane of course.

    7. Sync. All the new references that you have tagged should pop up with sync conflicts that you will need to resolve. You should have a choice between the reference in your database and "Deleted" (remote) reference. You will of course want to choose the local version. (Dan, Simon, adamsmith, please correct me on this if I'm wrong, but all file and note attachments will be deleted, right? That's what we want)

    8. Now merge the duplicates

    9. You can remove the "old references" tag (right-click in the tag pane). Also, re-enable automatic sync.

  • Thank you all for your help. I followed aurimas' instructions with a copy of the zotero.sqlite I thought was old enough. Funnily, though, only 3 of the 500+ items showed up with a sync conflict and the "Store references in document" box is still greyed out in most (but not all) of the 30 documents. Maybe I'll have to try an even older version of zotero.sqlite.
  • Thanks to your suggestions, I could restore a version of zotero.sqlite (from my Dropbox history) that seems to have all the items referenced in the Word documents (except one) and thus let me uncheck the "Store references in document" box.

    In a few documents, when I opened them, Zotero would complain that some entries don't exist in the Zotero library anymore, so I had to re-assign them (not such a big deal).

    Now, I don't want to screw things up again, so please excuse my asking: Is there a safe way to find out which entries in the now restored older zotero.sqlite file have changed in newer versions of zotero.sqlite? (I have a backup of the most recent zotero.sqlite that has correct entries but won't work with the Word files.)
  • Is there a safe way to find out which entries in the now restored older zotero.sqlite file have changed in newer versions of zotero.sqlite?
    Not exactly sure what you mean by "changed" here. If you synced your library with zotero.org before all of this and then synced afterwards, all of your entries in Zotero should be current (as you had them before restoring the old copy). Performing the duplicate merge would have added the old item keys to the new copies of the items, thus restoring the link between the word document and Zotero.
  • edited May 10, 2013
    By "changed" I mean that I made changes to some entries in the Zotero library after I inadvertently broke the links in the Word documents (probably by ex-/importing the library). These changes are mostly corrections of titles, names, dates (small stuff but still important).
  • edited May 10, 2013
    Everything seems to work now with the restored older zotero.sqlite file. However, when I sync this local file with the most recent one on Zotero.org I get (only) 7 sync conflicts (with a total of 500+ entries) *but* Zotero will then complain that almost all references in almost all of the 30 documents are no longer in the Zotero library. Syncing isn't an option... (but it's probably not necessary).

    Looks like I avoided disaster. Thank you all for your help!
  • odd. looks like adding a tag did not change the modified date, so I'm guessing the sync would have deleted all the items you restored. I'll try to replicate this tomorrow. Syncing would be the solution to your previous question about changed items.
  • Hold on, I forgot to tag/untag the entries when I restored the correct version of zotero.sqlite. I guess that explains it.
Sign In or Register to comment.