jabref: Duplicate groups in an input file are not detected
JabRef version 5.2, 5.3, master commit 049acb9 on Linuxmint-20.1.
JabRef 100.0.0 Linux 5.8.0-45-generic amd64 Java 14.0.2 JavaFX 16+8
- Mandatory: I have tested the latest development version from http://builds.jabref.org/master/ and the behaviour persists
Duplicated groups in different branches of the group tree are not detected when a database that contains them is read in.
But on a second thought, and after playing a bit with JabRef 5.x master branch, I start thinking that this is not a bug but actually a very useful feature! I’ve opened a detailed discussion in https://discourse.jabref.org/t/hierarchical-groups-with-duplicated-names-are-actually-working-in-jabref-5-x/2619. So don’t fix it!
Steps to reproduce the behavior:
- Start a new JabRef process, create a new library, add an entry, save the database as ‘new.bib’ (see the attached ‘biblio.zip’);
- Show the groups interface, create two groups ‘Human’ and ‘Computer’, create a subgroup ‘Languages’ in ‘Human’, save over the ‘new.bib’;
- Assign the new entry to ‘Human/Languages’;
- Copy ‘new.bib’ to ‘new-duplicate-group.bib’;
- Open the ‘new-duplicate-group.bib’ with a text editor, and duplicate the ‘Languages’ group in the ‘Computer’ branch:
saulius@starta duplicate-groups-created-by-hand-are-not-detected/ $ diff -u new.bib new-duplicate-group.bib
--- new.bib 2021-03-20 14:13:07.189182296 +0200
+++ new-duplicate-group.bib 2021-03-20 13:35:47.348262111 +0200
@@ -17,4 +17,5 @@
1 StaticGroup:Human\;2\;1\;0x8a8a8aff\;\;\;;
2 StaticGroup:Languages\;0\;1\;0x8a8a8aff\;\;\;;
1 StaticGroup:Computer\;0\;1\;0x8a8a8aff\;\;\;;
+2 StaticGroup:Languages\;0\;1\;0x6a7a9aff\;\;\;;
}
The resulting BibTeX files are attached in ‘biblio.zip’: biblio.zip
- Load the edited file into JabRef; no error report is produced, both groups are shown (correctly?), even though the GUI would not allow me to create such situation; the entry is reported to belong to both groups:
The manually created duplicate is used only to reproduce a minimal example of this behaviour; in real life large number of duplicates emerged when porting previous group trees from the previous revisions of my database.
This behaviour actually seems to be very useful, since it allows me to create (once again!) groups with identical names in different places of the group hierarchy, and assignment to one such group adds the same entry to all such groups, which might be very useful (detailed discussion in https://discourse.jabref.org/t/hierarchical-groups-with-duplicated-names-are-actually-working-in-jabref-5-x/2619 ).
This is how it looks after some editing of the database:
The resulting bibtex file is added in ‘experimets-with-group-hierarchy.zip’. experimets-with-group-hierarchy.zip
Log File
Paste an excerpt of your log file here
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 65 (50 by maintainers)
Well, I use this all the time, since finding the group in the tree takes much longer if you have to go through thousands of groups. So, this is a real use case.
Thanks for the ongoing discussion. The twitter poll clearly showed that many users would like to have groups with the same name. However, it became also clear that it might be confusing if the entries are automatically shared. In the devcall we also discussed that there are also scenarios where the groups with the same name actually don’t show the same entries (e.g. if one uses the hierarchical modifiers), potentially leading to even more confusion.
For this reason I would strongly propose to go the id-based solution:
groups
field and searching for the identifier of the other group.This unique identifier will also be very helpful for other scenarios. For example, we are planning a new feature in connection with JabRef Online, where users can share a group. For this a unique identifier is essential, since one needs to a way to identify the group even for different users.
@sauliusg your work here in this PR is very much appreciated. But I think the id-based system is the more universal way forward. Would you be interested in implementing it? We core developers help of course where we can!
I agree with you that it sometimes could be advantages to have the same group in two different places. However,
is a highly unusual concept from a user-interface perspective. For example, files with the same name but in different folders don’t automatically sync their content. I think we should really stick to the tree nature of the group interface, meaning that groups are independent.
As a way forward, I would propose the following:
What do you think? Help on this of course very much appreciated.
So lets sum up the current situation:
A possible (easy?) way to reconcile these two requirements could be:
Example:
When creating a subgroup called
Treatment
inAsthma
, the GUI could respond:I deliberately suggest using ‘Treatment (Asthma)’ instead of ‘Asthma/Treatment’ to avoid impression that the group name is strictly bound to group’s position in the hierarchy. It is not; so moving group ‘Treatment (Asthma)’, say, one level up to ‘Medicine’ would not make its name “incorrect”, in the sense that the group still contains papers about asthma treatment no matter where in the hierarchy it resides. This also means that JabRef does not need to bother about renaming groups when their position in the hierarchy changes (as is implemented now).
The suggested change would: