Closed bjohas closed 4 years ago
I don't think Zotero actually does moves from one library to another. I think it only supports copy.
But if owl:sameAs gets set, I could see after creation if it has any libraryIDs in there that are not its own.
Yes - it only supports copy and yes, owl:sameAs. However, when you copy to the new library, owl:replaces is removed. So it would be good to catch the move, and retain the item keys stored in owl:replaces?
Really, what we are doing is 'repairing' the fact that Zotero items don't trace their item key histories very well. (See two recent emails on Zotero dev list.) Really, it would be much better if items traced their own history like this.
There are several options:
(A) Change Zotero, so that item key histories properly appear in "relations".
Or, in our plugin:
(B) If possible via monkey patch: When an item is moved, preserve owl:replaces.
(C) When you do a "save item id" (manually), then plugin looks
It's unclear to me whether this should only be done once (i.e., only one lookup). Otherwise you might ultimately get back to templates etc or see unexpected behaviours. Or maybe it's better to just go through all items, finding as many IDs as possible.
Let's see what people say on the mailing list, and whether (A) is feasible. This would be the best way forward. If (A) cannot be done, then we can explore (B) and (C).
Thank you as always!
Yes - it only supports copy and yes, owl:sameAs. However, when you copy to the new library, owl:replaces is removed. So it would be good to catch the move, and retain the item keys stored in owl:replaces?
But that's the thing -- there isn't a move. Extensions get notified after a new item is created but get no info on how it was created -- import, user-creation and copy all look exactly the same to the extension.
(A) Change Zotero, so that item key histories properly appear in "relations".
I tried meddling with the relations data in the past and that led to my account becoming unsyncable until I deleted all data in it. Maybe that's different now, but I'd not risk it. Zotero has assumptions built in about URIs resolving to within the group.
Or, in our plugin:
(B) If possible via monkey patch: When an item is moved, preserve owl:replaces.
There is no such thing as a move. I might be able to catch the drop on the other library, but that will again require a monkey patch. I'd have to go spelunking in the Zotero source -- I don't mind, but it'll take a bit. In addition to all that, I'd strenuously recommend not storing this in the actual relations table in Zotero for the reasons described above.
(C) When you do a "save item id" (manually), then plugin looks
* At the item (as before, i.e., recording information from owl:sameAs and owl:replaces; i.e., the functionality that's in the two PRs you've just about completed); this gives us a set of groupID:itemKEY pairs.
Possible of course.
* But now, we use those groupID:itemKEY pairs to up those items in other group libraries (if the user has access) and in the trash, to pick up extra owl:sameAs and owl:replaces from those items.
That should also be possible.
It's unclear to me whether this should only be done once (i.e., only one lookup). Otherwise you might ultimately get back to templates etc or see unexpected behaviours. Or maybe it's better to just go through all items, finding as many IDs as possible.
I don't understand this part.
Thanks for the comment - I get the bit about the 'move/copy' not existing, but just the create in the new library. If the 'create' is monkey patchable, then
List items 3/4/5 could also be triggered manually by the 'save item id' (as noted above). When you do a 'save item id', it does everything it currently does (i.e., inspect the item GROUPID:ITEMKEY, plus look at owl:sameAs and owl:replaces), but then adds 'one iteration into the history of the item', i.e.
This comment: "It's unclear to me whether this should only be done once (i.e., only one lookup)" or multiple times. I meant:
But let's ignore that for now - I think one iteration is enough (and sensible).
I first want to clear the other open issue before I dive into this.
Yes please - this is not urgent!!
I've reformulated this issue as two new issues, and this issue can be closed.
In the same way as we are preserving item IDs (in extra-also-know-as) during a merge, is it possible to preserve item KEYS (not IDs) during a move to another library?
In other words: is a move to another library patchable on the same way as the merge is patchable?