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

public Class ResearchGate

extends Object
implements FulltextFetcher, EntryBasedFetcher, SearchBasedFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.SearchBasedFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.EntryBasedFetcher, org.jabref.logic.importer.FulltextFetcher
Imports
java.io.BufferedReader, .IOException, .InputStreamReader, java.net.MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .List, .Objects, .Optional, java.util.stream.Collectors, org.jabref.logic.importer.EntryBasedFetcher, .FetcherException, .FulltextFetcher, .ImportFormatPreferences, .ParseException, .SearchBasedFetcher, org.jabref.logic.importer.fetcher.transformers.DefaultQueryTransformer, org.jabref.logic.importer.fileformat.BibtexParser, org.jabref.logic.layout.format.RTFChars, org.jabref.logic.net.URLDownload, org.jabref.logic.os.OS, org.jabref.logic.util.URLUtil, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.identifier.DOI, org.jabref.model.search.query.BaseQueryNode, org.apache.hc.core5.net.URIBuilder, org.jsoup.Connection, .Jsoup, org.jsoup.nodes.Document, org.jsoup.select.Elements, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
ResearchGate(ImportFormatPreferences importFormatPreferences)

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
(@NonNull BibEntry
The Bibtex entry
entry
)

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

private Document
private Optional<BufferedReader>
public String
getName()

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

Returns the localized name of this fetcher.

private Document
getPage(URL url)

public TrustLevel
getTrustLevel()

Implements org.jabref.logic.importer.FulltextFetcher.getTrustLevel.

Returns the level of trust for this fetcher.

pack-priv Optional<String>
pack-priv Optional<String>
private static URL

Returns:

A URL that lets us download a .bib file
getUrlForQuery
(BaseQueryNode
the search query.
queryNode
)

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

public List<BibEntry>

Returns:

a list of BibEntry, which are matched by the query (maybe empty)
performSearch
(BaseQueryNode
the first node from the search parser
queryNode
)

Implements org.jabref.logic.importer.SearchBasedFetcher.performSearch.

This method is used to send complex queries using fielded search.

public List<BibEntry>

Returns:

a list of BibEntry, which are matched by the query (maybe empty)
performSearch
(@NonNull 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

formatPreferencesback to summary
private final ImportFormatPreferences formatPreferences
GOOGLE_SITEback to summary
private static final String GOOGLE_SITE
HOSTback to summary
private static final String HOST
LOGGERback to summary
private static final Logger LOGGER
SEARCH_FOR_BIB_ENTRYback to summary
private static final String SEARCH_FOR_BIB_ENTRY

Constructor Detail

ResearchGateback to summary
public ResearchGate(ImportFormatPreferences importFormatPreferences)

Method Detail

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

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

Search by title first, as DOI is not searchable directly. When the title is not present, the search is made with DOI via google.com with site:researchgate.net

Parameters
entry:@NonNull 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 an IO operation has failed
FetcherException:
if the ResearchGate refuses to serve the page
getHTMLback to summary
private Document getHTML(BibEntry entry) throws FetcherException, IOException
getInputStreamback to summary
private Optional<BufferedReader> getInputStream(String urlString)
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
getPageback to summary
private Document getPage(URL url) throws IOException
getTrustLevelback to summary
public TrustLevel getTrustLevel()

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

Annotations
@Override
getURLByDoiback to summary
pack-priv Optional<String> getURLByDoi(DOI doi) throws IOException, NullPointerException
getURLByStringback to summary
pack-priv Optional<String> getURLByString(String query) throws IOException, FetcherException
getUrlForQueryback to summary
private static URL getUrlForQuery(BaseQueryNode queryNode) throws URISyntaxException, MalformedURLException

Constructs a URL based on the query, size and page number. Extract the numerical internal ID and add it to the URL to receive a link to a BibEntry

Parameters
queryNode:BaseQueryNode

the search query.

Returns:URL

A URL that lets us download a .bib file

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

Implements org.jabref.logic.importer.SearchBasedFetcher.performSearch.

This method is used to send complex queries using fielded search.

Parameters
queryNode:BaseQueryNode

the first node from the search parser

Returns:List<BibEntry>

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

Annotations
@Override
Exceptions
FetcherException:
if the ResearchGate refuses to serve the page
performSearchback to summary
public List<BibEntry> performSearch(@NonNull BibEntry entry) throws FetcherException

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

Looks for hits which are matched by the given BibEntry.

Parameters
entry:@NonNull BibEntry

entry to search bibliographic information for

Returns:List<BibEntry>

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

Annotations
@Override
Exceptions
FetcherException:
if the ResearchGate refuses to serve the page