Drag-drop from My Library to Group fails for some items
Periodically, I drag-drop items from My Library to a group. But sometimes, some of the items will not get copied over. I tried to troubleshoot this and notice that one of the items will not only not copy over, but also cause another item to pop-up in the Collection to which I am copying. Example:
I am trying to drag-drop item FUGES46D from My Library to a collection in a group and each time it produces item H2N3K2GE (already present in another collection in the same group) to show-up in the target collection, while the intended item does not get copied over at all.
Title: CARB approves heavy-duty OBD amendments, adopts REAL NOx & CO2 tracking
Type: Report
MyLib: zotero://select/library/items/FUGES46D
Group: Shows up as zotero://select/groups/310273/items/H2N3K2GE
The item that shows up is:
California ARB adopting approval procedure for aftermarket DPFs
Type: Webpage
MyLib: zotero://select/library/items/R39ZFWKH
Group: zotero://select/groups/310273/items/H2N3K2GE
What might be causing this?
I am trying to drag-drop item FUGES46D from My Library to a collection in a group and each time it produces item H2N3K2GE (already present in another collection in the same group) to show-up in the target collection, while the intended item does not get copied over at all.
Title: CARB approves heavy-duty OBD amendments, adopts REAL NOx & CO2 tracking
Type: Report
MyLib: zotero://select/library/items/FUGES46D
Group: Shows up as zotero://select/groups/310273/items/H2N3K2GE
The item that shows up is:
California ARB adopting approval procedure for aftermarket DPFs
Type: Webpage
MyLib: zotero://select/library/items/R39ZFWKH
Group: zotero://select/groups/310273/items/H2N3K2GE
What might be causing this?
How can I identify all the cases? Can you or I run some code that finds the many-to-one association cases? Or some way to show me which items are missing in the collection in the group? Trying to find all of them manually, while possible, is going to be very labor intensive.
var getSelectURI = (item) => {
let uri = Zotero.URI.getItemURI(item);
uri = uri.replace('http://zotero.org/', 'zotero://select/');
uri = uri.replace(/users\/\d+/, 'library');
return uri;
};
var rows = await Zotero.DB.queryAsync(
"SELECT object, GROUP_CONCAT(itemID) AS itemIDs FROM items "
+ "JOIN itemRelations USING (itemID) "
+ "WHERE predicateID=(SELECT predicateID FROM relationPredicates WHERE predicate='owl:sameAs') "
+ "GROUP BY object HAVING COUNT(*) > 1"
);
var str = "";
for (let row of rows) {
let item = await Zotero.URI.getURIItem(row.object);
if (!item) continue;
await item.loadAllData();
str += "===============================\n";
str += item.getDisplayTitle() + "\n" + getSelectURI(item) + "\n\nLinked Items:\n\n";
let itemIDs = row.itemIDs.split(",");
for (let itemID of itemIDs) {
let item = await Zotero.Items.getAsync(parseInt(itemID));
await item.loadAllData();
str += item.getDisplayTitle() + "\n" + getSelectURI(item) + "\n" + item.dateAdded + "\n\n";
}
str += "================================\n";
}
return str;
If you have any thoughts on how the resulting items might be related (added at the same time? copied at the same time?), let us know.
https://1drv.ms/w/s!Atcr8aCyjBrulaNNraeQsAAPp_pzIQ?e=tnbNHz
From looking at the items, I think the issue is caused for items that were created by using the 'Duplicate Item' feature. I use that when the item I am creating has many fields identical to an existing item (such as conference name, date, location). Is that the wrong way to use it?
In the report I linked above, the blue colored items are in the Group library. So, I will delete those from the Group Library and then drag-drop the items linked to that in My Library. I tried this for the items on page 1 and it seemed to have worked.
In the latest Zotero beta, and for 5.0.86, I've updated it to not include cross-library linked items or merged-item links when duplicating items. Only related-item links will be kept, which are visible in the UI and can be removed if unwanted (but would often remain relevant even if the item was edited to point to represent a different source).
There's not much we can do to automatically fix existing entries for people who ended up in this situation, but we're hoping to make some UI improvements to cross-library dragging to give better visibility into and control over these connections.
1. Do I need to worry that the items created using Duplicate Items have carry over cross-library links and merged-item links from the original item? Can this cause other issues in future?
2. What was the intent of the Duplicate Item feature in the first place and am I using it in the wrong way? I use it to create a new item with many fields pre-filled to avoid manual entry. Obviously, I do not use it when the Connector will grab the metadata for me.
Related but different issue (just to mention it here): Some way to sync the metadata of items common to My Library and Groups would be super helpful.
If the original item A was the result of a merge with item B, and A was duplicated to C, incorrectly duplicated merged-item relations on C could theoretically cause citations in word processor documents that used to point to item B to update to point to C instead of A. The same query above with
dc:replaces
might work, though I haven't thought through it. It's most commonly used for book chapters, but any use is fine. Including non-related-items relations was just an oversight on our part.In general, I check if there are duplicates after a session where I have added many new items. And if there are new duplicates, I merge them such that the older item is preserved. I do this so as not to break any past citations. It seems that would prevent the kind of issue described in the A, B, C example.