Skip to content

feat(citation): add support for selecting citation fetcher in Citatio…#14652

Merged
calixtus merged 27 commits intoJabRef:mainfrom
Siva-Sai22:fix/#14430
Dec 29, 2025
Merged

feat(citation): add support for selecting citation fetcher in Citatio…#14652
calixtus merged 27 commits intoJabRef:mainfrom
Siva-Sai22:fix/#14430

Conversation

@Siva-Sai22
Copy link
Copy Markdown
Contributor

Closes #14430

  • Introduce CitationFetcherFactory and CitationFetcherType for managing fetcher selection
  • Add dropdown in CitationRelationsTab to choose between Semantic Scholar and CrossRef fetchers
  • Persist selected fetcher in EntryEditorPreferences
  • Update SearchCitationsRelationsService and related classes to use selected fetcher
  • Refactor CrossRefCitationFetcher to standardize fetcher name

Steps to test

  • Add a lib entry
  • Go to the citations tab to see the new drop down menu.
Screenshot_20251218_160004

Mandatory checks

…nRelationsTab

- Introduce CitationFetcherFactory and CitationFetcherType for managing fetcher selection
- Add dropdown in CitationRelationsTab to choose between Semantic Scholar and CrossRef fetchers
- Persist selected fetcher in EntryEditorPreferences
- Update SearchCitationsRelationsService and related classes to use selected fetcher
- Refactor CrossRefCitationFetcher to standardize fetcher name
@github-actions github-actions Bot added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Dec 18, 2025
@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 18, 2025
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Dec 20, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Dec 20, 2025
Comment thread CHANGELOG.md Outdated
Comment thread jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java Outdated
fetcherCombo.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
// Cancel any running searches so they don't continue with the old fetcher
if (citingTask != null && !citingTask.isCancelled()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this variable have a @Nullable annotation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant with the comment: Either mark the variable as @Nullable or remove the null check.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, I don't see when a user can select null

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah removed the null check

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 20, 2025
@github-actions github-actions Bot added status: changes-required Pull requests that are not yet complete and removed status: changes-required Pull requests that are not yet complete labels Dec 20, 2025
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Dec 23, 2025
Copy link
Copy Markdown
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some architecture comments.

Update following is not related to this pr - And also a runtime issue

image

fetcherCombo.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
// Cancel any running searches so they don't continue with the old fetcher
if (citingTask != null && !citingTask.isCancelled()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, I don't see when a user can select null

image

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 23, 2025
@koppor koppor mentioned this pull request Dec 23, 2025
1 task
@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 23, 2025

@Siva-Sai22 Do you have time today to finish this? Would be nice to have it in the release :)

@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

Siva-Sai22 commented Dec 23, 2025

@koppor Yeah just updating the changes. Will raise the pr in an hour.

@koppor
Copy link
Copy Markdown
Member

koppor commented Dec 23, 2025

@koppor Yeah just updating the changes. Will raise the new pr in an hour.

No new PR, just push to your branch fix/#14430

@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

yeah to this pr only

…d service

- Expose citationFetcherTypeProperty in EntryEditorPreferences for property binding
- Update CitationRelationsTab to use property binding for fetcher selection and remove default fallback
- Refactor SearchCitationsRelationsService to subscribe to citationFetcherType changes via property binding, removing manual fetcher switching logic
- Simplify CitationFetcherType by removing unreachable default case
…d service

- Expose citationFetcherTypeProperty in EntryEditorPreferences for property binding
- Update CitationRelationsTab to use property binding for fetcher selection and remove default fallback
- Refactor SearchCitationsRelationsService to subscribe to citationFetcherType changes via property binding, removing manual fetcher switching logic
- Simplify CitationFetcherType by removing unreachable default case
@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Dec 23, 2025
@Siva-Sai22
Copy link
Copy Markdown
Contributor Author

@koppor actually I was travelling to my home from college. Sorry for that will implement it

@github-actions github-actions Bot removed the status: changes-required Pull requests that are not yet complete label Dec 26, 2025
koppor
koppor previously approved these changes Dec 27, 2025
return entry
.getDOI()
.map(doi -> relationsMap.getOrDefault(doi.asString(), new LinkedHashSet<>()).stream().toList())
.map(doi -> relationsMap.getOrDefault(doi.asString() + citationFetcherPropertyType.get().getName(), new LinkedHashSet<>()).stream().toList())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calixtus This is not clean, but works. I would do that refactoring as follow-up.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have fun!

@koppor koppor added the status: awaiting-second-review For non-trivial changes label Dec 27, 2025
@koppor koppor requested a review from calixtus December 27, 2025 23:38
@koppor koppor mentioned this pull request Dec 28, 2025
1 task
Comment thread jabkit/src/main/java/org/jabref/toolkit/commands/GetCitedWorks.java
Comment on lines +11 to +28
public enum CitationFetcherFactory {
INSTANCE;

public CitationFetcher getCitationFetcher(CitationFetcherType citationFetcherName,
ImporterPreferences importerPreferences,
ImportFormatPreferences importFormatPreferences,
CitationKeyPatternPreferences citationKeyPatternPreferences,
GrobidPreferences grobidPreferences,
AiService aiService) {
return switch (citationFetcherName) {
case CROSSREF ->
new CrossRefCitationFetcher(importerPreferences, importFormatPreferences,
citationKeyPatternPreferences, grobidPreferences, aiService);
case SEMANTIC_SCHOLAR ->
new SemanticScholarCitationFetcher(importerPreferences);
};
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the strong feeling that this Singleton is completly faulty.

koppor
koppor previously approved these changes Dec 28, 2025
@calixtus calixtus enabled auto-merge December 28, 2025 23:00
@calixtus calixtus added this pull request to the merge queue Dec 28, 2025
Merged via the queue into JabRef:main with commit d5f1f63 Dec 29, 2025
48 checks passed
@Siva-Sai22 Siva-Sai22 deleted the fix/#14430 branch December 29, 2025 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: fetcher good first issue An issue intended for project-newcomers. Varies in difficulty. status: awaiting-second-review For non-trivial changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offer selection of CitationProvider in "Citations" tab

3 participants