Top Fields Constructors Methods
org.jabref.logic.importer.fetcher

public Class SemanticScholar

extends Object
implements FulltextFetcher, PagedSearchBasedParserFetcher, EntryBasedFetcher, CustomizableKeyFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.fetcher.CustomizableKeyFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.EntryBasedFetcher, 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, org.jabref.logic.importer.FulltextFetcher
Imports
java.io.IOException, java.net.MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .Collections, .List, .Objects, .Optional, java.util.stream.Collectors, .IntStream, org.jabref.logic.importer.EntryBasedFetcher, .FetcherException, .FulltextFetcher, .ImporterPreferences, .PagedSearchBasedParserFetcher, .ParseException, .Parser, org.jabref.logic.importer.fetcher.transformers.DefaultQueryTransformer, org.jabref.logic.importer.util.JsonReader, org.jabref.logic.net.URLDownload, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.identifier.ArXivIdentifier, .DOI, org.jabref.model.entry.types.StandardEntryType, org.jabref.model.strings.StringUtil, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONException, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.apache.lucene.queryparser.flexible.core.nodes.QueryNode, org.jsoup.Jsoup, org.jsoup.nodes.Document, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final ImporterPreferences
private static final Logger
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public
SemanticScholar(ImporterPreferences importerPreferences)

Method Summary

Modifier and TypeMethod and Description
public Optional<URL>

Returns:

The fulltext PDF URL Optional, if found, or an empty Optional if not found.
findFullText
(BibEntry
The Bibtex entry
entry
)

Implements org.jabref.logic.importer.FulltextFetcher.findFullText.

Tries to find a fulltext URL for a given BibTex entry.

public String

Returns:

the localized name
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 TrustLevel
getTrustLevel()

Overrides default org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher.

pack-priv String
public URL
getURLForQuery(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
the search query
luceneQuery
,
int
the number of the page indexed from 0
pageNumber
)

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

Constructs a URL based on the query, size and page number.

private BibEntry

Returns:

The BibEntry that corresponds to the received object
jsonItemToBibEntry
(kong.unirest.core.json.JSONObject
an entry received, needs to be parsed into a BibEntry
item
)

This is copy-paste from CrossRef, need to be checked.

public List<BibEntry>

Returns:

a list of BibEntry, which are matched by the query (may be empty)
performSearch
(BibEntry
entry to search bibliographic information for
entry
)

Implements org.jabref.logic.importer.EntryBasedFetcher.performSearch.

Looks for hits which are matched by the given BibEntry.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

importerPreferencesback to summary
private final ImporterPreferences importerPreferences
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

SemanticScholarback to summary
public SemanticScholar(ImporterPreferences importerPreferences)

Method Detail

findFullTextback to summary
public Optional<URL> findFullText(BibEntry entry) throws IOException, FetcherException

Implements org.jabref.logic.importer.FulltextFetcher.findFullText.

Tries to find a fulltext URL for a given BibTex entry.

Uses the DOI if present, otherwise the arXiv identifier.

Parameters
entry:BibEntry

The Bibtex entry

Returns:Optional<URL>

The fulltext PDF URL Optional, if found, or an empty Optional if not found.

Annotations
@Override
Exceptions
IOException:
if a page could not be fetched correctly
FetcherException:
if the received page differs from what was expected
getNameback to summary
public String getName()

Implements 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.

Returns:String

the localized name

Annotations
@Override
getParserback to summary
public Parser getParser()

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

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

Annotations
@Override
getTrustLevelback to summary
public TrustLevel getTrustLevel()

Overrides default org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Doc from org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher. We distinguish between publishers and meta search engines for example.

Returns:TrustLevel

The trust level of the fetcher, the higher the better

Annotations
@Override
getURLBySourceback to summary
pack-priv String getURLBySource(String source) throws IOException, FetcherException
getURLForQueryback to summary
public URL getURLForQuery(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode luceneQuery, int pageNumber) throws URISyntaxException, MalformedURLException, FetcherException

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

Doc from org.jabref.logic.importer.PagedSearchBasedParserFetcher.getURLForQuery.

Constructs a URL based on the query, size and page number.

Parameters
luceneQuery:org.apache.lucene.queryparser.flexible.core.nodes.QueryNode

the search query

pageNumber:int

the number of the page indexed from 0

Annotations
@Override
jsonItemToBibEntryback to summary
private BibEntry jsonItemToBibEntry(kong.unirest.core.json.JSONObject item) throws ParseException

This is copy-paste from CrossRef, need to be checked.

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

an entry received, needs to be parsed into a BibEntry

Returns:BibEntry

The BibEntry that corresponds to the received object

Exceptions
ParseException:
if the JSONObject could not be parsed
performSearchback to summary
public List<BibEntry> performSearch(BibEntry entry) throws FetcherException

Implements org.jabref.logic.importer.EntryBasedFetcher.performSearch.

Looks for hits which are matched by the given BibEntry.

Parameters
entry:BibEntry

entry to search bibliographic information for

Returns:List<BibEntry>

a list of BibEntry, which are matched by the query (may be empty)

Annotations
@Override
Exceptions
FetcherException:
if an error linked to the Fetcher applies