JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.66k stars 2.59k forks source link

Citation keys are always overwritten when importing through web search #7420

Closed k3KAW8Pnf7mkmdSMPHz27 closed 3 years ago

k3KAW8Pnf7mkmdSMPHz27 commented 3 years ago
The citation key generator **never** preserves citation keys while importing from sites such as INSPIRE HEP. The citation keys are overwritten even if "Overwrite existing keys" is disabled in preferences and always without warning. JabRef version ``` JabRef 5.3--2021-02-03--242a494 Mac OS X 10.15.7 x86_64 Java 15.0.2 JavaFX 15.0.1+1 ```

Relevant links

  1. JabRef renaming keys?! (I don't think these options exist anymore)
  2. InspireHEP and SAO/NASA ADS Bibtex Key Catch (feature request)
  3. Can I use Inspire citation keys when importing via jabref?
  4. There is a mention of unwanted key formatting in #7274

Temporary workaround

It is possible to keep citation keys by using the citation key pattern [CITATIONKEY] during the import. : must also be removed from the "Remove the following characters" field in preferences. It should be possible to use the regexp in https://github.com/JabRef/jabref/issues/7111#issuecomment-731763262 to create a workaround where a different pattern is used when there is no citation key in the imported entry. (If someone manages with this approach, feel free to add a comment and perhaps others will also find it useful)

Steps to reproduce the behavior:

  1. Unmark "Overwrite existing keys" Skärmavbild 2021-02-03 kl  15 41 33
  2. Make a web-search on INSPIRE and import any entry Skärmavbild 2021-02-03 kl  15 43 47
  3. Note that the citation key is overwritten Skärmavbild 2021-02-03 kl  15 47 36
bulmust commented 3 years ago

Same issue for me. I always manually rewrite bibtex-key which i fetch from inspire or ads

k3KAW8Pnf7mkmdSMPHz27 commented 3 years ago

@bulmust, the workaround(s) work for now?

bulmust commented 3 years ago

No, still problematic. Bibtex-key is not fetched from Inspire. 1

My configs and version are: 2

k3KAW8Pnf7mkmdSMPHz27 commented 3 years ago

I meant using the citation key pattern [BIBTEXKEY] or [CITATIONKEY] while importing. (discussed here on discourse) However, that might not be convenient for you unless you always want to keep the imported keys.

Siedlerchr commented 3 years ago

I debugged a bit and the problem seems to be that this import handler doesn't check the preferences if the key should be overwritten or not. And further down there isn't any check either.

So the solution would be to add a check for the setting from the CitationKeyPrefereces.

https://github.com/JabRef/jabref/blob/86d52cd6468335d9e460aaacc870aa5088c62431/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java#L196-L210

bulmust commented 3 years ago

I meant using the citation key pattern [BIBTEXKEY] or [CITATIONKEY] while importing. (discussed here on discourse) However, that might not be convenient for you unless you always want to keep the imported keys.

Thank you. It is solved.

Before Jabref 5.x versions, this option was default. Solution is following:

Peek 2021-02-06 19-02

LucasF-42 commented 3 years ago

Hey, I've (possibly) been able to fix this, but I'm not sure if it's according to JabRefs intended behaviour for this feature (more details on that can be found in the Pull Request).