RDF extra field
Hello
I downloaded beetbibtex in order to make an export for French national archives HAL.
Finally I deleted it but since then I have in my extra fields some notes like Translatorsn_ XXXXX or "Reporter: journal title" and Numebr: journal issue" or "Type" etc.
I deleted these informations manually but they came back with synchronization.
How can I remove these notes knowing that I can't delete the extra field in its total because there is information I want to keep?
I'm working in a group library, anyone has betterbibtex no more
Thank you very much, best regards
Gianna
I downloaded beetbibtex in order to make an export for French national archives HAL.
Finally I deleted it but since then I have in my extra fields some notes like Translatorsn_ XXXXX or "Reporter: journal title" and Numebr: journal issue" or "Type" etc.
I deleted these informations manually but they came back with synchronization.
How can I remove these notes knowing that I can't delete the extra field in its total because there is information I want to keep?
I'm working in a group library, anyone has betterbibtex no more
Thank you very much, best regards
Gianna
Please feel free to write in French if that is easier.
J'ai utilisé betterbibtex to make a real zotero export for a French base
I finally uninstalled it
But now our shared library has in the extra field a series of notes like "Reporter and the title of the magazine" or "Number and the number of the magazine" Translators a following number" etc.
We have uninstalled and reinstalled everything again, but these notes remain.
We have manually deleted note by note (8000 records ..) but as soon as the synchronization is done the notes are back.
I can't delete the extra field altogether because there's more information I'd like to keep
How do i clean Zotero's files permanently?
Number: 46 Reporter: CrystEngComm
Number: 6
Reporter: Climate Dynamics
Artists: _:n7784
Artists: _:n64136
Series Title:
"Directors: _:
Directors: _:
Producers: _:
insu-01290806"
Issue:
Number:
Reporter:
Translators: _:n2068
Translators: _:n24268
Version Number:
Artists: _:
Book Authors: _:
Reporter:
Publication Title:
Code:
Publischer:
Place:
I have a question
Sometimes I would like to delete the label and content of this label together, but not all the extra information
For example :
Extra : Number: 1
Reporter: Current Anthropology
https://hal.archives-ouvertes.fr/hal-01462313
I would like to delete :
“Number: 1
Reporter: Current Anthropology”
But I want keep : https://hal.archives-ouvertes.fr/hal-01462313
Is it possible?
Many many thanks
Note though, that for links like that, it would be better to attach them to the item as an attached link, rather than storing them in Extra.
yes, I will follow your suggestion.
Many thanks, have a nice day
Gianna
I think writing the code takes you a long time...
I'm very sorry.
Gianna
var fieldName = "extra";
var pattern = /^((Directors)|(Producers)|(Issue)|(Number)|(Reporter)|(Translators)|(Version Number)|(Artists)|(Book Authors)|(Reporter)|(Publication Title)|(Code)|(Publisher)|(Place)):.*$(\n)?/;
var replace = "";
var fieldID = Zotero.ItemFields.getID(fieldName);
var s = new Zotero.Search();
s.libraryID = Zotero.Libraries.userLibraryID;
s.addCondition(fieldName, 'contains', 'Directors');
s.addCondition(fieldName, 'contains', 'Producers');
s.addCondition(fieldName, 'contains', 'Issue');
s.addCondition(fieldName, 'contains', 'Number');
s.addCondition(fieldName, 'contains', 'Reporter');
s.addCondition(fieldName, 'contains', 'Translators');
s.addCondition(fieldName, 'contains', 'Version Number');
s.addCondition(fieldName, 'contains', 'Artists');
s.addCondition(fieldName, 'contains', 'Book Authors');
s.addCondition(fieldName, 'contains', 'Reporter');
s.addCondition(fieldName, 'contains', 'Publication Title');
s.addCondition(fieldName, 'contains', 'Code');
s.addCondition(fieldName, 'contains', 'Publisher');
s.addCondition(fieldName, 'contains', 'Place');
s.addCondition('joinMode', 'any');
var ids = await s.search();
if (!ids.length) {
return "No items found";
}
await Zotero.DB.executeTransaction(async function () {
for (let id of ids) {
let item = await Zotero.Items.getAsync(id);
let mappedFieldID = Zotero.ItemFields.getFieldIDFromTypeAndBase(item.itemTypeID, fieldName);
var oldValue = item.getField(mappedFieldID ? mappedFieldID : fieldID);
var newValue = oldValue.replace(pattern, '');
item.setField(mappedFieldID ? mappedFieldID : fieldID, newValue);
await item.save();
}
});
return ids.length + " item(s) updated";
This should work, but I haven't tested it. If you send some example items like I asked above, I can test it out and make it work.
In Zotero, click Tools -> Developer -> Run Javascript, paste the code there, check the "Run as async function" box, and click Run. Before doing this, be sure to make a backup of your database just in case: https://www.zotero.org/support/zotero_data#backing_up_your_zotero_data
[code removed — D.S]
, I past the items here, i would keep "https://hal.archives-ouvertes.fr/hal-02458658"
:
insu plus the code is an import in extra by zotero connector, the code change by item.
Yes I can delete manually
I delete plugin (chrome and mozilla) and update it but anything is chancing.
Thank you very much for your help
Gianna
Encore merci beaucoup
Gianna
If you imported these items by importing a .bib file, can you share that file?
Our propres field are in French , the data in extra in English.
The problem is that many sites do it for our Zotero, even when they work well.
variable: value
to be deleted? That would retain any URLs you have stored in Extra.If so, then this code will do that:
var fieldName = "extra";
var fieldID = Zotero.ItemFields.getID(fieldName);
var s = new Zotero.Search();
s.libraryID = Zotero.Libraries.userLibraryID;
s.addCondition(fieldName, 'contains', ': ');
s.addCondition('joinMode', 'any');
var ids = await s.search();
if (!ids.length) {
return "No items found";
}
await Zotero.DB.executeTransaction(async function () {
for (let id of ids) {
let item = await Zotero.Items.getAsync(id);
let mappedFieldID = Zotero.ItemFields.getFieldIDFromTypeAndBase(item.itemTypeID, fieldName);
var oldValue = item.getField(mappedFieldID ? mappedFieldID : fieldID);
var newValue = oldValue.replace(/^([A-Za-z \-]+)(:\s+.+)/gm, '');
item.setField(mappedFieldID ? mappedFieldID : fieldID, newValue);
await item.save();
}
});
return ids.length + " item(s) updated";
Note that that in some cases, these are legitimate data that you would want to keep. If you are okay with that risk, this will remove all of these data quickly.
I will sent you a feedback as soon as possible.
Many thanks!
Thank you very much the tool works very well but there is a problem.
I exported the items in RDF format for groups of extras to clean.
Everything was clean.
Not easy to clean all 8055 records at once
I exported the RDF items again to import it into the good library
Unfortunately the import added all the fields that I had deleted
I gather it depends on the RDF format
The export in csl jason does not export the tags
BibText puts the extra field in notes
I'm in stanby ...
I agree Emilianonoehey it's not a BBT problem, but a RDF format problem.
In this period of lockdown, we have to feed the library quickly because it feeds the website
You should _not_ be continuously exporting and re-importing things to try to troubleshoot your library. That isn’t going to fix anything and is going to make more of a mess.
Are you still trying to fix a problem or no?
For example in the same extra field now contains:
translation espagnole de La littérature, pour quoi faire?, Paris, Collège de France / Fayard, 2007
or:
PMID: 29054166. PMCID: PMC5667889
or
postprint : https://hal.archives-ouvertes.fr/hal-00207465/document
and many others.
I can do a list
We are 4 to work in this library, I asked the group to stop for this three-day holiday to try to fix the problem