Remove all tags

13
  • I guess the sqlite structure have changed since.
    I had to adapt the sqlite commands to:

    delete from itemTags where tagID in (select tagID from tags where type=1);
    delete from tags where type = 1;
  • Thanks latsami for the updated commands. I was able to use it on SQLite Database Browser with no problems. However, I wasn't able to use the command on SQLite Manager (firefox addons)

    The tags are just too crazy, especially importing from Endnote... I think a nuclear blast and then starting over was the best choice for me. I had over 5000 tags of which 20 were useful...I think a better tag editor is in order
  • I have what is probably a dumb question regarding group libraries and eliminating the automatic tags by editing the Zotero sqlite database, as described in this thread.

    We have a group library with 18 members and 3000 items. For a long time the default for downloading automatic tags was in force but we now want to set up our own system of tags and eliminate the mess of auto tags.

    So, with a group library, if I edit the sqlite file as described on one machine, will this tag-free database sync unproblematically to all the other users or are there complications in such a case?

    Some members use Zotero FF and some use Standalone: does this have any implications?

    Obviously, to remain auto-tag free, we then need to insure that the right default is set on the Zotero of all the members.

    Given how Zotero works, I guess it would not be possible to have a group library setting to prevent the downloading of auto tags for the group library?

    Sorry, that's a total of three questions!
  • Here's a more pressing query about eliminating tags:

    I assume it is one zotero.sqlite file for both the personal library and any group libraries? So it possible to eliminated tags from a group library while not doing so to the personal library?
  • libraryID (which distinguishes between different groups & your personal library) can be included in an sqlite query, so generally the answer is yes, it's possible.
  • Thanks – can you elucidate as to which id is associated with which library, or will it be obvious?

    Also, adamsmith, can you shed any light on my previous questions questions regarding the elimination of tags in a group library?

    thanks, ap
  • I'm not sure about syncing - modifying the sqlite isn't recommended in general and I don't know, e.g., if relevant date-stamps will update. Thinking of a way of doing this via the javascript API would be preferable, https://www.zotero.org/support/dev/client_coding/javascript_api
    but I don't think the examples on that page provide close guidance for that.

    The library ID should be pretty clear, yes - your group's library ID is included in the URL of a report you generate, for example.
  • +1 for native tag editing! (Or +2, even -- what a pain!)
  • edited September 23, 2014
    Well I edited the local database, getting rid of all of the tags and starting afresh. Very nice!

    But I had the same experience as others above. In my online library, it seems that both the old tags and the ones I've created since the database edit are now mixed together.
  • Here's a pretty simple solution for when importing a bibtex library from Mendeley or similar:

    1. Open the bibtex in a text editor
    2. Find-and-replace "keywords" with something else like "old-words".
    3. Import bibtex library into Zotero.

    When importing, the old tags will not be processed as tags, hey presto they're gone.
  • Has there been any developments on this issue? I have the same problem, making using tags useless. I'd love to be able to delete all of them, then add as I need them. Thanks.
  • no, there's nothing new on this. Most automatically imported tags you can just hide in the tag selector, though, as previously mentioned.
  • edited October 11, 2015
    I've been playing around with the javascript API and this script below seems to work to delete an array of named tags in selected (highlighted) items. A few "alerts" or "console.log" can be added for testing.


    /*CODE*/

    // https://www.zotero.org/support/dev/client_coding/javascript_api

    var ZoteroPane = Components.classes["@mozilla.org/appshell/window-mediator;1"]
    .getService(Components.interfaces.nsIWindowMediator)
    .getMostRecentWindow("navigator:browser").ZoteroPane;

    // Then grab the currently selected items from the zotero pane:

    // get first selected item
    var selected_items = ZoteroPane.getSelectedItems();
    var item = selected_items[0];

    // proceed if selected item is neither a collection nor a note
    if ( ! item.isCollection() & ! item.isNote()) {
    if (item.isAttachment()) {
    // find out about attachment
    }
    if (item.isRegularItem()) {
    // we could grab attachments:
    // var att_ids = item.getAttachments(false);
    // if (att_ids.length>1) exit(); // bailout
    // item_att=Zotero.Items.get(att_ids[0]);
    }
    // alert(item.id);


    // define array of tags to purge in selected items
    var tags = ["tag1", "tag2", "tag3"]
    var ids = [];
    var allTags = Zotero.Tags.search();

    tags = tags.map(tag => tag.toLowerCase());

    for (var id in allTags) {
    if (tags.indexOf(allTags[id].name.toLowerCase()) != -1) {
    ids.push(id);
    }
    }
    Zotero.Tags.erase(ids);
    }



    I have previously installed CustomButtons add-on for Firefox.

    Then it is a matter of creating a CustomButton and just dropping the above code into the CustomButton > edit > code field.

    I guess that the ExecuteJS add-on could be tried.

    This rough experiment needs to be refined but does show how to link a CustomButton in Firefox to run a method.

    p.s.

    The above scripts were found by browsing around and by trial and error. Also tried SQLite Manager to export itemTags and Tags as csv files.
  • Did you try exporting your library as Bibtex and using the 'find-and-replace solution?

    That should get rid of existing tags, then you can turn off the setting for automatically tagging with keywords in the future to make sure it doesn't happen anymore.
  • well, export-import really isn't recommended. Search&replace is great when you're moving from other software, but not only do you lose some data on export/import, you also mess with syncing (every item will have to resync) and you break links to existing Word or LibreOffice documents (they will still work, but changes in the items in Zotero won't be reflected in the document). So, I'd only do this as an absolute last resource.

    I haven't reviewed dragonfly's code, but in general that'd be the way to go.
  • I've just noticed that the tag selector window which I understand should appear in the left pane is missing? How can I restore this?
  • Just click and drag up at the bottom of the left hand pane
  • Hey, Adam. Thanks. I'll wait until there's a feature to delete all tags, if it ever happens. That would suffice for me because I'd rather have a blank slate and rebuild than see all of the extraneous tags and not use them. I would be happy with a button in the preferences that clearly states all tags will be deleted, with a clear warning, of course.

    Take care!
  • Can't believe this is STILL a problem from 2008!

    Another +1 for better tag management please.
  • implemented for the next major version. https://github.com/zotero/zotero/commit/4b16210ac6449f07c3ccd06a2e540fd701d34406 (I think it's likely going to be called 5.0 but not sure)
  • Done, entered into the "Standalone" discussion.

    RELATED query:

    I have figured out how to remove the item.Tags that I do not want, but I can only operate on my personal library. I cannot figure out how to manipulate the zotero.sqlite database for the Group Library.

    Is this possible? Or do I need to copy the Group Library into my personal library, make the changes, and then copy it back to the Group Library?

    Another way to phrase the question: is information about Group Libraries stored locally or only on the cloud? (If on the cloud, I presume I cannot edit/change things like database information directly).
  • edited December 29, 2015
    Group data is stored in the database as well, but it's synced by nature, so you shouldn't modify it directly in the database, since changes won't sync properly.

    You can make changes via code, but how you do that would depend on the exact code you're using. Groups have a libraryID, which other objects (e.g., items and tags) reference.
  • edited December 29, 2015
    Dan
    I think I understand and am seeing the behavior you describe. I'm a bit at a loss about how to do what I want to do.

    I have modified a fairly large number of tags, working with the Zotero xmlite file. The changes appear to be reflected in "My Library" and my "Group Libraries".

    Then I made some manual changes to locally stored items in the "Group Library." These changes are reflected in this item, in "My Library" and in "Group Library."

    However, on the web, the changes are NOT in the "Group Library" even though they ARE in "My Library." And, as noted earlier in the thread, the tags that I removed locally were not removed on the cloud.

    I know this sounds confusing, it certainly is to me! But somehow the group libraries on the web are not at all synchronized with changes I make locally, at least insofar as tagging is concerned.
  • Changes won't sync if you make changes directly to the database. We also can't provide any support for manually modified databases.
  • edited December 30, 2015
    Dan
    Thanks, that's unfortunate to learn at this point since I removed a whole bunch of unnecessary tags using the techniques described in this thread.

    Essentially, then, they exist in some sort of tag set on the cloud but don't correspond to the tags on my local machine? That's surprising, I would have expected the sync process to check not just the database entries but also the tags.

    My other "solution" worked, though--deleting the whole group library, fixing things up locally, then recreating the group library. The only tags that seem to appear on the cloud version are the ones I wanted.

    Thanks for the help here, btw. I have not used Zotero in this way before, and I think I am going to be able convince the organization I am working with to use Zotero to organize a pretty large and complex set of documents, but I have to set up a very careful taxonomy ahead of time. That's why i've been doing so much work on the tags.
  • Essentially, then, they exist in some sort of tag set on the cloud but don't correspond to the tags on my local machine? That's surprising, I would have expected the sync process to check not just the database entries but also the tags.
    It does, of course — but when you directly modify the database, you're circumventing parts of the sync process.

    While we can only vouch for the built-in functionality, if you're going to make database changes manually, I'd strongly recommend only following solutions in these forums that use the JavaScript API, which have a much higher likelihood of following built-in behavior (e.g., syncing). Generally speaking, SQL-based changes shouldn't be made unless you're using Zotero as a completely local database.
  • Dan is there a way to "recover" the longer tag list or somehow edit the tags in the cloud version so I can remove them? (And here I was so proud of myself for learning how to edit a sql-lite database...live and learn...)

    Would one way to do this be to a) remove my online account then b) reestablish it from the local program interface, thereby refreshing the whole cloud database?
  • I was about to post on another thread but realise I have already said what I wanted to say above four years ago.

    Adam Smith's solution (turn off automatic tags) is not bad at all.

    Also I realised that I can delete tags from the tag pane, one by one.
  • I'd like to give a +1000 for a native solution! Currently, the tag feature is useless
Sign In or Register to comment.