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

public Class Scopus

extends Object
implements PagedSearchBasedParserFetcher, CustomizableKeyFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.CustomizableKeyFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.PagedSearchBasedParserFetcher, org.jabref.logic.importer.ParserFetcher, org.jabref.logic.importer.PagedSearchBasedFetcher, org.jabref.logic.importer.SearchBasedFetcher, org.jabref.logic.importer.SearchBasedParserFetcher
Annotations
@NullMarked
Imports
java.io.IOException, .InputStream, java.net.MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .List, .Optional, org.jabref.logic.importer.FetcherException, .ImporterPreferences, .PagedSearchBasedParserFetcher, .ParseException, .Parser, org.jabref.logic.importer.fetcher.transformers.ScopusQueryTransformer, org.jabref.logic.importer.util.JsonReader, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.types.StandardEntryType, org.jabref.model.paging.Page, org.jabref.model.search.query.BaseQueryNode, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONException, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.jspecify.annotations.NullMarked, .Nullable, org.slf4j.Logger, .LoggerFactory

SearchBasedFetcher implementation using Elsevier's Scopus Search API. API Documentation: Scopus Search API

Field Summary

Modifier and TypeField and Description
private static final String
public static final String
private final ImporterPreferences
private static final Logger
private @Nullable ScopusQueryTransformer

Constructor Summary

AccessConstructor and Description
public
Scopus(ImporterPreferences importerPreferences)

Method Summary

Modifier and TypeMethod and Description
private URL
buildSearchURL(String
the query string to pass directly as the query parameter
rawQuery
,
int
zero based page number; converted to a zero based start offset.
pageNumber
)

Builds the Scopus search API URL for the given raw query string and page number.

private StandardEntryType

Returns:

appropriate StandardEntryType
determineEntryType
(String
the aggregation type (Journal, Book, Conference Proceeding, etc.)
aggregationType
,
String
the document subtype (ar, cp, re, etc.)
subtype
)

Determines the BibTeX entry type based on Scopus aggregationType and subtype.

private List<BibEntry>
fetchEntries(String
the value placed verbatim into the Scopus query parameter
query
,
int
zero based page number
pageNumber
)

Downloads and parses Scopus search results for an already built query string

public String
getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Returns the localized name of this fetcher.

public Parser
getParser()

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getParser.

Returns the parser used to convert the response to a list of BibEntry.

public String
public URL

Returns:

URL for the Scopus API request
getURLForQuery
(BaseQueryNode
the search query node
queryNode
,
int
the page number (0-indexed)
pageNumber
)

Implements org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForQuery.

Constructs a URL for querying the Scopus Search API.

public URL
getURLForRawQuery(String rawQuery, int pageNumber)

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForRawQuery.

Sends the raw, catalog-native query verbatim as Scopus's query parameter, bypassing ScopusQueryTransformer.

private Optional<BibEntry>

Returns:

Optional containing the BibEntry, or empty if parsing fails
parseScopusEntry
(kong.unirest.core.json.JSONObject
the JSON object representing a Scopus search result
jsonEntry
)

Parses a single Scopus JSON entry into a BibEntry.

public List<BibEntry>
performSearch(BaseQueryNode queryNode)

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.performSearch.

This method is used to send queries with advanced URL parameters.

public Page<BibEntry>
private boolean
shouldIncludeEntry(BibEntry entry, ScopusQueryTransformer transformer)

Checks if the entry should be included based on year filtering.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

API_URLback to summary
private static final String API_URL
FETCHER_NAMEback to summary
public static final String FETCHER_NAME
importerPreferencesback to summary
private final ImporterPreferences importerPreferences
LOGGERback to summary
private static final Logger LOGGER
transformerback to summary
private @Nullable ScopusQueryTransformer transformer

Constructor Detail

Scopusback to summary
public Scopus(ImporterPreferences importerPreferences)

Method Detail

buildSearchURLback to summary
private URL buildSearchURL(String rawQuery, int pageNumber) throws URISyntaxException, MalformedURLException

Builds the Scopus search API URL for the given raw query string and page number. The raw query is sent verbatim as the query parameter, bypassing ScopusQueryTransformer.

Parameters
rawQuery:String

the query string to pass directly as the query parameter

pageNumber:int

zero based page number; converted to a zero based start offset.

determineEntryTypeback to summary
private StandardEntryType determineEntryType(String aggregationType, String subtype)

Determines the BibTeX entry type based on Scopus aggregationType and subtype.

Parameters
aggregationType:String

the aggregation type (Journal, Book, Conference Proceeding, etc.)

subtype:String

the document subtype (ar, cp, re, etc.)

Returns:StandardEntryType

appropriate StandardEntryType

fetchEntriesback to summary
private List<BibEntry> fetchEntries(String query, int pageNumber) throws FetcherException

Downloads and parses Scopus search results for an already built query string

Parameters
query:String

the value placed verbatim into the Scopus query parameter

pageNumber:int

zero based page number

getNameback to summary
public String getName()

Implements org.jabref.logic.importer.WebFetcher.getName.

Doc from org.jabref.logic.importer.WebFetcher.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.

Todo

This name is also used for identifying the fetcher in preferences for API keys. Thus, any switch of the language will "remove" API keys.

Annotations
@Override
getParserback to summary
public Parser getParser()

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getParser.

Doc from org.jabref.logic.importer.SearchBasedParserFetcher.getParser.

Returns the parser used to convert the response to a list of BibEntry.

Annotations
@Override
getTestUrlback to summary
public String getTestUrl()
getURLForQueryback to summary
public URL getURLForQuery(BaseQueryNode queryNode, int pageNumber) throws URISyntaxException, MalformedURLException

Implements org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForQuery.

Constructs a URL for querying the Scopus Search API.

Parameters
queryNode:BaseQueryNode

the search query node

pageNumber:int

the page number (0-indexed)

Returns:URL

URL for the Scopus API request

Annotations
@Override
getURLForRawQueryback to summary
public URL getURLForRawQuery(String rawQuery, int pageNumber) throws URISyntaxException, MalformedURLException

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForRawQuery.

Sends the raw, catalog-native query verbatim as Scopus's query parameter, bypassing ScopusQueryTransformer. The blank-query short-circuit, download, parse, and post-cleanup are handled by the shared default in PagedSearchBasedParserFetcher#performRawSearchQueryPaged(String, int). Year filtering lives in performSearchPaged(BaseQueryNode, int) and is therefore naturally skipped on the raw path.

Annotations
@Override
parseScopusEntryback to summary
private Optional<BibEntry> parseScopusEntry(kong.unirest.core.json.JSONObject jsonEntry)

Parses a single Scopus JSON entry into a BibEntry.

Parameters
jsonEntry:kong.unirest.core.json.JSONObject

the JSON object representing a Scopus search result

Returns:Optional<BibEntry>

Optional containing the BibEntry, or empty if parsing fails

performSearchback to summary
public List<BibEntry> performSearch(BaseQueryNode queryNode) throws FetcherException

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.performSearch.

Doc from org.jabref.logic.importer.SearchBasedParserFetcher.performSearch.

This method is used to send queries with advanced URL parameters. This method is necessary as the performSearch method does not support certain URL parameters that are used for fielded search, such as a title, author, or year parameter.

Annotations
@Override
performSearchPagedback to summary
public Page<BibEntry> performSearchPaged(BaseQueryNode queryNode, int pageNumber) throws FetcherException

Overrides default org.jabref.logic.importer.PagedSearchBasedParserFetcher.performSearchPaged.

Annotations
@Override
shouldIncludeEntryback to summary
private boolean shouldIncludeEntry(BibEntry entry, ScopusQueryTransformer transformer)

Checks if the entry should be included based on year filtering.