Verified Owner
Top Fields Constructors Methods
org.jabref.logic.importer.fetcher.citation.opencitations

public Class OpenCitationsFetcher

extends Object
implements CitationFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.citation.CitationFetcher, org.jabref.logic.importer.fetcher.citation.CitationCountFetcher
Annotations
@NullMarked
Imports
java.net.MalformedURLException, .URI, .URISyntaxException, .URL, java.util.ArrayList, .List, .Optional, java.util.function.Function, org.jabref.logic.importer.FetcherException, .ImporterPreferences, org.jabref.logic.importer.fetcher.CrossRef, org.jabref.logic.importer.fetcher.citation.CitationFetcher, org.jabref.logic.net.URLDownload, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.identifier.DOI, com.google.gson.Gson, .JsonSyntaxException, org.jspecify.annotations.NullMarked, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private static final String
private final CrossRef
public static final String
private static final Gson
private final ImporterPreferences
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private BibEntry
private List<BibEntry>
private Optional<URI>
getApiUrl(String endpoint, BibEntry entry)

public Optional<Integer>
public List<BibEntry>
public Optional<URI>
getCitationsApiUri(BibEntry entry)

Overrides default org.jabref.logic.importer.fetcher.citation.CitationFetcher.getCitationsApiUri.

Returns the API URL for fetching citations

public String
getName()

Implements org.jabref.logic.importer.fetcher.citation.CitationFetcher.getName.

Returns the localized name of this fetcher.

public List<BibEntry>
public Optional<URI>
getReferencesApiUri(BibEntry entry)

Overrides default org.jabref.logic.importer.fetcher.citation.CitationFetcher.getReferencesApiUri.

Returns the API URL for fetching references

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

API_BASE_URLback to summary
private static final String API_BASE_URL
crossRefFetcherback to summary
private final CrossRef crossRefFetcher
FETCHER_NAMEback to summary
public static final String FETCHER_NAME
GSONback to summary
private static final Gson GSON
importerPreferencesback to summary
private final ImporterPreferences importerPreferences
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

OpenCitationsFetcherback to summary
public OpenCitationsFetcher(ImporterPreferences importerPreferences)

Method Detail

fetchBibEntryFromIdentifiersback to summary
private BibEntry fetchBibEntryFromIdentifiers(List<CitationItem.IdentifierWithField> identifiers)
fetchCitationDataback to summary
private List<BibEntry> fetchCitationData(URI apiUri, Function<CitationItem, List<CitationItem.IdentifierWithField>> identifierExtractor) throws FetcherException

API explained at https://api.opencitations.net/index/v2#/references/{id} and https://api.opencitations.net/index/v2#/citations/{id}

getApiUrlback to summary
private Optional<URI> getApiUrl(String endpoint, BibEntry entry)
getCitationCountback to summary
public Optional<Integer> getCitationCount(BibEntry entry) throws FetcherException

Implements org.jabref.logic.importer.fetcher.citation.CitationCountFetcher.getCitationCount.

API explained at https://api.opencitations.net/index/v2#/reference-count/{id}

Annotations
@Override
getCitationsback to summary
public List<BibEntry> getCitations(BibEntry entry) throws FetcherException

Implements org.jabref.logic.importer.fetcher.citation.CitationFetcher.getCitations.

Doc from org.jabref.logic.importer.fetcher.citation.CitationFetcher.getCitations.

Looks for hits which are citing the given BibEntry.

Annotations
@Override
getCitationsApiUriback to summary
public Optional<URI> getCitationsApiUri(BibEntry entry)

Overrides default org.jabref.logic.importer.fetcher.citation.CitationFetcher.getCitationsApiUri.

Doc from org.jabref.logic.importer.fetcher.citation.CitationFetcher.getCitationsApiUri.

Returns the API URL for fetching citations

Annotations
@Override
getNameback to summary
public String getName()

Implements org.jabref.logic.importer.fetcher.citation.CitationFetcher.getName.

Doc from org.jabref.logic.importer.fetcher.citation.CitationFetcher.getName.

Returns the localized name of this fetcher. The title can be used to display the fetcher in the menu and in the side pane.

Annotations
@Override
getReferencesback to summary
public List<BibEntry> getReferences(BibEntry entry) throws FetcherException

Implements org.jabref.logic.importer.fetcher.citation.CitationFetcher.getReferences.

Doc from org.jabref.logic.importer.fetcher.citation.CitationFetcher.getReferences.

Looks for hits which are cited by the given BibEntry. This typically is the "References" (or "Bibliography" or "Literature") section of a paper.

Annotations
@Override
getReferencesApiUriback to summary
public Optional<URI> getReferencesApiUri(BibEntry entry)

Overrides default org.jabref.logic.importer.fetcher.citation.CitationFetcher.getReferencesApiUri.

Doc from org.jabref.logic.importer.fetcher.citation.CitationFetcher.getReferencesApiUri.

Returns the API URL for fetching references

Annotations
@Override