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.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.util.OS, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.identifier.DOI, org.apache.hc.core5.net.URIBuilder, org.apache.lucene.queryparser.flexible.core.nodes.QueryNode, org.jsoup.Connection, .Jsoup, org.jsoup.nodes.Document, org.jsoup.select.Elements, 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
(BibEntry
The Bibtex entry
entry
)

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

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

private Document
private BufferedReader
public String
getName()

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

Returns the localized name of this fetcher.

private Document

Returns:

A URL that lets us download a .bib file
getPage
(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
the search query.
luceneQuery
)

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

public TrustLevel
getTrustLevel()

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

Returns the level of trust for this fetcher.

pack-priv Optional<String>
pack-priv Optional<String>
public List<BibEntry>

Returns:

a list of BibEntry, which are matched by the query (maybe empty)
performSearch
(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
the root node of the lucene query
luceneQuery
)

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
(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(BibEntry entry) throws IOException, FetcherException

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

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

Returns:String

the localized name

Annotations
@Override
getPageback to summary
private Document getPage(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode luceneQuery) throws URISyntaxException, IOException

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
luceneQuery:org.apache.lucene.queryparser.flexible.core.nodes.QueryNode

the search query.

Returns:Document

A URL that lets us download a .bib file

Exceptions
URISyntaxException:
from URIBuilder's build() method
IOException:
from Connection's get() method
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
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, NullPointerException
performSearchback to summary
public List<BibEntry> performSearch(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode luceneQuery) throws FetcherException

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

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

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

the root node of the lucene query

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(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 (maybe empty)

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