jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Use default `texkeys` when importing from `Inspirehep` web search with arxiv number

Open Turgon-Aran-Gondolin opened this issue 1 year ago • 21 comments

Is your suggestion for improvement related to a problem? Please describe. When using inspirehep database in the web search, if one use normal inspirehep search syntax, the returned citekey would be what's on their website. But if one use arxiv number to search, the returned citekey will just be the url of the arxiv doi. I don't think using a long string of doi url is a good idea for a cite key.

Describe the solution you'd like The inspirehep api would give a key named "texkeys" that provides the cite key. This is the same for both the normal api and the api for arxiv/doi etc. I believe this key is used for the normal searches, but not searches with unique identifiers such as arxiv number. It should be a simple fix to include this information.

Additional context Add any other context or screenshots about the feature request here.

Turgon-Aran-Gondolin avatar Dec 13 '24 00:12 Turgon-Aran-Gondolin

I'd like to take this on, but I've started looking at it and I'm having some trouble. It seems like an issue with the parser but I'm not sure how that works. Any direction would be appreciated.

benlevycmp avatar Mar 11 '25 05:03 benlevycmp

@benlevycmp

  1. Check fetcher code. Find where inspire is used
  2. Look for the tests. Check for returned entries
  3. Search how texkeys is included
  4. Get the field content of texkeys and put it as citation key (internal jabref field) in the inspire fetcher
  5. Redo for arxiv fetcher

Longer task (not in scope)

This issue is a good thing to dive into our fetcher infrastructure: https://devdocs.jabref.org/code-howtos/fetchers.html

Currently, when pasting an Id, the IdFetcher is used. When searching normally, the selected fetcher is used. Maybe, there should be a combined fetching?


@Turgon-Aran-Gondolin JabRef has a decent key generation build in - to ensure consistent keys across fetchers. See https://docs.jabref.org/setup/citationkeypatterns - Have you seen this? Do you like this?

Image

koppor avatar Mar 11 '25 08:03 koppor

@koppor I'm aware of the built-in key generator in JabRef, and I'm personally fine with that. But in collaborations, there're reasons I'd prefer the inspire-generated keys. And I just realized that this is not just a cite key issue. Searching with arxiv number actually gives you a different entry with only arxiv information, even if the paper is published.

MWE: search for 2409.15408 in the INSPIRE web search box, the entry does not contain any information about the journal, even if it has been published; but search for "Renormalization of the SMEFT to dimension eight: Fermionic interactions I" will give you the correct entry with all the updated information. I suspect the 1st one is searching within arxiv database, not inspire's.

Turgon-Aran-Gondolin avatar Mar 11 '25 16:03 Turgon-Aran-Gondolin

I suspect the 1st one is searching within arxiv database, not inspire's.

Yes.

Our heuristics: If a user inputs an id in the web search, the id should be searched. See https://github.com/JabRef/jabref/issues/7575 and https://github.com/JabRef/jabref/issues/9674 (this was you actually ^^).

Now you say: If some catalogue (e.g., inspire) has search results for this, we should use that result.

Ideas:

  1. If identifier is arXiv, search all "pre-configured" catalogues for the string first. If nothing found, use arXiv fetcher
  2. After searching at arXiv, search all "pre-configured" and enrich the search result by the result of that result

koppor avatar Mar 11 '25 19:03 koppor

IMO, if one wants to use the arXiv fetcher, they should use the built-in 'new entry' option. When I deliberately choose the web search, I expect the results to come from the designated pre-configured catalogue. Therefore, I prefer your first idea.

I actually proposed in #9674 that doi in web search should be quoted internally (or any search string in that matter). One can still check if the input is an identifier, quote it, search for it using the selected web search, then if there's no hit, search for the id in default fetchers instead.

Turgon-Aran-Gondolin avatar Mar 11 '25 20:03 Turgon-Aran-Gondolin

Alternative 3: DOI, arXiv Id fetcher selectable in the dropdown

Image

If "normal" provider is selected, the string is routed as is to it (and no detour taken)


Alternativ 4: On entering of arXiv id, the id is prefixed with "arXiv:" in the field - and then a search done.

koppor avatar Mar 11 '25 22:03 koppor

Hi! We are students from Australian National University. We are interested in this issue and would like to take it.

SLin417 avatar Sep 30 '25 06:09 SLin417

PR https://github.com/JabRef/jabref/pull/14099 was filed, but not followed-up. Maybe, this can be an inspiration for future contributors.

koppor avatar Nov 05 '25 09:11 koppor

Hi, this is my second issue here. I read through the issue and the earlier comments. According to what i understood, the same paper can be fetched via two different routes (regular InspireHEP search vs. arXiv-based search), but JabRef currently sets the citation key differently depending on the route. Even though InspireHEP provides texkeys, they are not used when the entry is fetched via arXiv. Solution aims to to make this behavior consistent and always prefer texkeys when they are present. I would like to work on it!!

/assign-me

addix7 avatar Jan 31 '26 10:01 addix7

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

jabref-machine avatar Jan 31 '26 10:01 jabref-machine

Hello!

From what I understand so far, when a normal INSPIRE web search is performed, the BibTeX entry key provided by INSPIRE is correctly used as the citation key, so there is no issue in that path.

When the search is done using an arXiv identifier, however, an entry is initially created with an auto-generated citation key (often derived from the URL). Even if inspire metadata later provides a proper BibTeX entry key, the existing citation key is not updated accordingly.

Based on this, it seems that the problem is not in the inspire fetcher itself, as it already follows the expected behavior, but rather in how the citation key is preserved or updated in the identifier-based fetch path.

Please let me know if my understanding is incorrect anywhere — I’m eager to learn. Thanks!

addix7 avatar Feb 03 '26 14:02 addix7

This seems like a correct observation. I think the issue is: Can we find out from the arXiv IDs or data if it is coming from inspirehep

Siedlerchr avatar Feb 03 '26 15:02 Siedlerchr

I verified the fix by comparing normal INSPIRE search vs arXiv-ID search. Both now correctly use INSPIRE texkeys (e.g., hep-th/9711200 → Maldacena1997).

Image Image

addix7 avatar Feb 04 '26 13:02 addix7

@addix7 go ahead and do a PR Then

Siedlerchr avatar Feb 04 '26 13:02 Siedlerchr

Thanks for the confirmation!! I’ll open a PR shortly.

addix7 avatar Feb 04 '26 13:02 addix7

Hello @Siedlerchr, regarding your question about whether we can determine from the arXiv ID or data if an entry is coming from INSPIREHEP: although the changes I made are showing the desired behavior in practice, on pondering over the IdBasedFetcher, ArXivFetcher, and INSPIREFetcher code paths, I realized that this cannot be deduced from the arXiv ID alone. An arXiv identifier only tells us that the entry exists on arXiv. It is only after the INSPIRE arXiv endpoint is queried and INSPIRE successfully returns BibTeX metadata that we can reliably treat the entry as INSPIRE-origin data and use the provided citation key (texkey).

addix7 avatar Feb 04 '26 15:02 addix7

If I'm understanding this correctly, when searching with an arXiv ID (2409.15408 or hep-th/9711200) via the INSPIRE web search, the returned entry used to have an invalid DOI URL as the citation key and missing info instead of the proper INSPIRE texkey and full metadata. I just tested both cases on the current main build and everything looks correct on my end (got Maldacena1997 as the key with full publication info). Can anyone else verify if this is working for them too? @Siedlerchr Am I verifying it correctly?

faneeshh avatar Mar 11 '26 23:03 faneeshh

/assign-me

Efeselimsurekli avatar Jul 13 '26 07:07 Efeselimsurekli

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

At this point in time, you raised 1 pull request(s) of which 100% (1/1) have been merged.

jabref-machine avatar Jul 13 '26 07:07 jabref-machine

Hello @koppor ,

My pull request has now passed all CI checks.

Could you please take a look?

Efeselimsurekli avatar Jul 13 '26 14:07 Efeselimsurekli