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

public Class CrossRef

extends Object
implements IdParserFetcher<DOI>, EntryBasedParserFetcher, SearchBasedParserFetcher, IdBasedParserFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.IdBasedParserFetcher, org.jabref.logic.importer.ParserFetcher, org.jabref.logic.importer.IdBasedFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.SearchBasedParserFetcher, org.jabref.logic.importer.SearchBasedFetcher, org.jabref.logic.importer.EntryBasedParserFetcher, org.jabref.logic.importer.EntryBasedFetcher, org.jabref.logic.importer.IdParserFetcher, org.jabref.logic.importer.IdFetcher
Imports
java.net.MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .Collections, .List, .Optional, java.util.stream.IntStream, org.jabref.logic.cleanup.FieldFormatterCleanup, org.jabref.logic.formatter.bibtexfields.ClearFormatter, .RemoveEnclosingBracesFormatter, org.jabref.logic.importer.EntryBasedParserFetcher, .FetcherException, .IdBasedParserFetcher, .IdParserFetcher, .ParseException, .Parser, .SearchBasedParserFetcher, org.jabref.logic.importer.fetcher.transformers.DefaultQueryTransformer, org.jabref.logic.importer.util.JsonReader, org.jabref.logic.util.strings.StringSimilarity, org.jabref.model.entry.Author, .AuthorList, .BibEntry, org.jabref.model.entry.field.StandardField, org.jabref.model.entry.identifier.DOI, org.jabref.model.entry.types.EntryType, .StandardEntryType, org.jabref.model.util.OptionalUtil, 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

A class for fetching DOIs from CrossRef

See their GitHub page for documentation.

Field Summary

Modifier and TypeField and Description
private static final String
private static final RemoveEnclosingBracesFormatter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private EntryType
public void
doPostCleanup(BibEntry
the entry to be cleaned-up
entry
)

Overrides default org.jabref.logic.importer.ParserFetcher.doPostCleanup.

Performs a cleanup of the fetched entry.

public Optional<DOI>
extractIdentifier(BibEntry
the entry for which we are searching the identifier (can be used to find closest match in the result)
inputEntry
,
List<BibEntry>
list of entries returned by the web service
fetchedEntries
)

Implements org.jabref.logic.importer.IdParserFetcher.extractIdentifier.

Extracts the identifier from the list of fetched entries.

public String
getIdentifierName()

Implements org.jabref.logic.importer.IdFetcher.getIdentifierName.

Returns the name of the identifier that is returned by this fetcher.

private String
getKeywords(kong.unirest.core.json.JSONArray jsonArray)

public String
getName()

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

Returns the localized name of this fetcher.

public Parser
public URL
public URL
getUrlForIdentifier(String
the ID
identifier
)

Implements org.jabref.logic.importer.IdBasedParserFetcher.getUrlForIdentifier.

Constructs a URL based on the query.

public URL
getURLForQuery(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode
the root node of the lucene query
luceneQuery
)

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getURLForQuery.

Constructs a URL based on the lucene query.

private BibEntry
jsonItemToBibEntry(kong.unirest.core.json.JSONObject item)

private String
toAuthors(kong.unirest.core.json.JSONArray authors)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

API_URLback to summary
private static final String API_URL
REMOVE_BRACES_FORMATTERback to summary
private static final RemoveEnclosingBracesFormatter REMOVE_BRACES_FORMATTER

Constructor Detail

CrossRefback to summary
public CrossRef()

Method Detail

convertTypeback to summary
private EntryType convertType(String type)
doPostCleanupback to summary
public void doPostCleanup(BibEntry entry)

Overrides default org.jabref.logic.importer.ParserFetcher.doPostCleanup.

Doc from org.jabref.logic.importer.ParserFetcher.doPostCleanup.

Performs a cleanup of the fetched entry.

Only systematic errors of the fetcher should be corrected here (i.e. if information is consistently contained in the wrong field or the wrong format) but not cosmetic issues which may depend on the user's taste (for example, LateX code vs HTML in the abstract).

Try to reuse existing Formatter for the cleanup. For example, new FieldFormatterCleanup(StandardField.TITLE, new RemoveBracesFormatter()).cleanup(entry);

By default, no cleanup is done.

Parameters
entry:BibEntry

the entry to be cleaned-up

Annotations
@Override
extractIdentifierback to summary
public Optional<DOI> extractIdentifier(BibEntry inputEntry, List<BibEntry> fetchedEntries) throws FetcherException

Implements org.jabref.logic.importer.IdParserFetcher.extractIdentifier.

Doc from org.jabref.logic.importer.IdParserFetcher.extractIdentifier.

Extracts the identifier from the list of fetched entries.

Parameters
inputEntry:BibEntry

the entry for which we are searching the identifier (can be used to find closest match in the result)

fetchedEntries:List<BibEntry>

list of entries returned by the web service

Annotations
@Override
getIdentifierNameback to summary
public String getIdentifierName()

Implements org.jabref.logic.importer.IdFetcher.getIdentifierName.

Doc from org.jabref.logic.importer.IdFetcher.getIdentifierName.

Returns the name of the identifier that is returned by this fetcher.

Annotations
@Override
getKeywordsback to summary
private String getKeywords(kong.unirest.core.json.JSONArray jsonArray)
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
getParserback to summary
public Parser getParser()

Implements org.jabref.logic.importer.IdParserFetcher.getParser, org.jabref.logic.importer.EntryBasedParserFetcher.getParser, org.jabref.logic.importer.SearchBasedParserFetcher.getParser, org.jabref.logic.importer.IdBasedParserFetcher.getParser.

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

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

Annotations
@Override
getURLForEntryback to summary
public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedURLException, FetcherException

Implements org.jabref.logic.importer.IdParserFetcher.getURLForEntry, org.jabref.logic.importer.EntryBasedParserFetcher.getURLForEntry.

Doc from org.jabref.logic.importer.IdParserFetcher.getURLForEntry.

Constructs a URL based on the BibEntry.

Parameters
entry:BibEntry

the entry to look information for

Annotations
@Override
getUrlForIdentifierback to summary
public URL getUrlForIdentifier(String identifier) throws URISyntaxException, MalformedURLException, FetcherException

Implements org.jabref.logic.importer.IdBasedParserFetcher.getUrlForIdentifier.

Doc from org.jabref.logic.importer.IdBasedParserFetcher.getUrlForIdentifier.

Constructs a URL based on the query.

Parameters
identifier:String

the ID

Annotations
@Override
getURLForQueryback to summary
public URL getURLForQuery(org.apache.lucene.queryparser.flexible.core.nodes.QueryNode luceneQuery) throws URISyntaxException, MalformedURLException, FetcherException

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getURLForQuery.

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

Constructs a URL based on the lucene query.

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

the root node of the lucene query

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