Skip to content

Offer selection of CitationProvider in "Citations" tab #14430

@koppor

Description

@koppor

JabRef offers to display cited and citing papers.

Image

Thereby, it used the interface CitationFetcher:

There are currently two implementations.

Only one is used in the GUI:

this.citationFetcher = new SemanticScholarCitationFetcher(importerPreferences);

The CLI offers selecting one:

CitationFetcher citationFetcher = switch (provider) {
case CROSSREF -> {
CliPreferences preferences = argumentProcessor.cliPreferences;
AiService aiService = new AiService(
preferences.getAiPreferences(),
preferences.getFilePreferences(),
preferences.getCitationKeyPatternPreferences(),
LOGGER::info,
new CurrentThreadTaskExecutor());
yield new CrossRefCitationFetcher(
preferences.getImporterPreferences(),
preferences.getImportFormatPreferences(),
preferences.getCitationKeyPatternPreferences(),
preferences.getGrobidPreferences(),
aiService);
}
case SEMANTICSCHOLAR ->
new SemanticScholarCitationFetcher(
argumentProcessor.cliPreferences.getImporterPreferences()
);
};

Task

  • Create CitationFetcherFactory in package org.jabref.logic.importer.fetcher.citation. Use enum and INSTANCE
  • Implement method getCitationFetcher accepting a String as first paramter
    • The method checks org.jabref.logic.importer.fetcher.citation.crossref.CrossRefCitationFetcher#getName / org.jabref.logic.importer.fetcher.citation.semanticscholar.SemanticScholarCitationFetcher#getName and returns a new instance of the fetcher. The parameters are a union of the parameters of the respective constructors
  • Add a dropdown to the citation panel (the left panel)
    • Dropdown has "CrossRef" and "SemanticScholar" as values
    • DropDown state is stored in org.jabref.gui.entryeditor.EntryEditorPreferences (see how other classes to that; also handle the default ("SemanticScholar")
    • Location is somewhere at org.jabref.gui.entryeditor.citationrelationtab.CitationRelationsTab#getPaneAndStartSearch.
  • Have org.jabref.toolkit.commands.GetCitedWorks#call using this factory.
  • Minor: Change Crossref to CrossRef at org.jabref.logic.importer.fetcher.citation.crossref.CrossRefCitationFetcher#getName

Metadata

Metadata

Assignees

Type

Projects

Status

Assigned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions