fix(fetchers): fix OpenAlex entry type assignment - #16533
Conversation
PR Summary by QodoFix OpenAlex work-type → BibEntry type mapping
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. openAlexType nullable unannotated
|
| Map.entry("reference-entry", StandardEntryType.InReference), | ||
| Map.entry("book-review", BiblatexNonStandardEntryType.Review), | ||
| Map.entry("libguides", StandardEntryType.Online), | ||
| Map.entry("peer-review", BiblatexNonStandardEntryType.Review), |
There was a problem hiding this comment.
1. Biblatex-only types mapped 🐞 Bug ≡ Correctness
OpenAlex maps some OpenAlex work types to BibLaTeX-exclusive EntryTypes (e.g., BiblatexNonStandardEntryType.Review, StandardEntryType.Report/Thesis/Online/Dataset/Software). In BibTeX-mode libraries this triggers an integrity warning (BibTeXEntryTypeChecker) and exports the non-BibTeX entry type header verbatim, which many BibTeX toolchains may not recognize.
Agent Prompt
## Issue description
OpenAlex’s type mapping includes BibLaTeX-only entry types (notably `BiblatexNonStandardEntryType.Review` and several BibLaTeX-only `StandardEntryType`s). When a user is working in a BibTeX-mode library, JabRef will flag these as “only defined for BibLaTeX” and exported `.bib` files will contain those entry-type headers.
## Issue Context
- `BibTeXEntryTypeChecker` warns in BibTeX mode when `EntryTypeFactory.isExclusiveBiblatex(entry.getType())` is true.
- `StandardEntryType` clearly separates BibTeX vs BibLaTeX-only types in the enum.
- `BibEntryWriter` writes `@` + `entry.getType().getDisplayName()` regardless of database mode.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/OpenAlex.java[62-89]
### Suggested remediation
Adjust the `OPENALEX_TYPE_TO_ENTRY_TYPE` mapping to avoid emitting BibLaTeX-exclusive types when there is a reasonable BibTeX-compatible alternative:
- Map `report` to `StandardEntryType.TechReport` (supported in both definitions).
- Map `dissertation` to `StandardEntryType.PhdThesis` or `StandardEntryType.MastersThesis` (BibTeX types), or fall back to `Misc`.
- Map `book-review` / `peer-review` to a BibTeX-safe type (e.g., `Misc` or `Article`) instead of `BiblatexNonStandardEntryType.Review`.
- Consider a design where the mapping is chosen based on the target library mode (BibTeX vs BibLaTeX) if that information is available at the call site; otherwise prefer BibTeX-safe defaults to avoid generating BibLaTeX-only types unexpectedly.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit ce757d9 |
|
Details> Task :jabgui:testLinkedFileViewModelTest > downloadHtmlFileCausesWarningDisplay(Boolean, String) > [1] "true", "Download 'https://www.google.com/ ' was a HTML file. Keeping URL." FAILED LinkedFileViewModelTest > downloadHtmlFileCausesWarningDisplay(Boolean, String) > [2] "false", "Download 'https://www.google.com/ ' was a HTML file. Removed." FAILED I think unrelated to my PR? Fetchers test - almost all unrelated, but this: Was failing before |
|
Fixed OpenAlex tests |
Summary
Just adds a mapping from OpenAlex work type to bibentry type
Steps to test
Nothing really much. Just fetch a conference paper, and it should be
InProceedings. For example this:ImageNet: A large-scale hierarchical image databaseID:
W2108598243Related issues and pull requests
Closes NA
AI usage
I have used Gemini to map the types, and GPT to write the code. The code proposed by AI was edited and analyzed.
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)