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

public Class MathSciNet

extends Object
implements SearchBasedParserFetcher, EntryBasedParserFetcher, 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.EntryBasedParserFetcher, org.jabref.logic.importer.EntryBasedFetcher, org.jabref.logic.importer.SearchBasedParserFetcher, org.jabref.logic.importer.SearchBasedFetcher
Imports
java.io.BufferedReader, .InputStreamReader, java.net.MalformedURLException, .URISyntaxException, .URL, java.nio.charset.StandardCharsets, java.util.ArrayList, .List, .Map, .Optional, java.util.stream.Collectors, .IntStream, org.jabref.logic.cleanup.DoiCleanup, .FieldFormatterCleanup, .MoveFieldCleanup, org.jabref.logic.formatter.bibtexfields.ClearFormatter, org.jabref.logic.importer.EntryBasedParserFetcher, .IdBasedParserFetcher, .ImportFormatPreferences, .ParseException, .Parser, .SearchBasedParserFetcher, org.jabref.logic.importer.fetcher.transformers.DefaultQueryTransformer, org.jabref.logic.importer.fileformat.BibtexParser, org.jabref.logic.os.OS, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.AMSField, .StandardField, .UnknownField, org.jabref.model.entry.identifier.DOI, org.jabref.model.entry.types.StandardEntryType, org.jabref.model.search.query.BaseQueryNode, org.jabref.model.util.DummyFileUpdateMonitor, kong.unirest.core.JsonNode, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONException, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

Fetches data from the MathSciNet API.

Field Summary

Modifier and TypeField and Description
private static final Map<StandardField, List<String>>
private static final Logger
private final ImportFormatPreferences

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
doPostCleanup(BibEntry entry)

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

Performs a cleanup of the fetched entry.

private String
fixStringEncoding(String value)

Method to change character set, to fix output string encoding If we don't convert to the correct character set, the parser outputs anomalous characters.

private Optional<String>
getKeywords(kong.unirest.core.json.JSONObject primaryClass)

public String
getName()

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

Returns the localized name of this fetcher.

private Optional<String>
getOthers(kong.unirest.core.json.JSONObject item, List<String> keys)

public Parser
public URL
getURLForEntry(BibEntry entry)

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

We use MR Lookup instead of the usual search since this tool is also available without subscription and, moreover, is optimized for finding a publication based on partial information.

public URL
getUrlForIdentifier(String identifier)

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

Constructs a URL based on the query.

public URL
getURLForQuery(BaseQueryNode queryNode)

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 Optional<String>
toAuthors(kong.unirest.core.json.JSONArray authors)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FIELD_MAPPINGSback to summary
private static final Map<StandardField, List<String>> FIELD_MAPPINGS
LOGGERback to summary
private static final Logger LOGGER

Hides org.jabref.logic.importer.IdBasedParserFetcher.LOGGER.

preferencesback to summary
private final ImportFormatPreferences preferences

Constructor Detail

MathSciNetback to summary
public MathSciNet(@NonNull ImportFormatPreferences preferences)

Method Detail

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 org.jabref.logic.formatter.Formatter for the cleanup. For example, new FieldFormatterCleanup(StandardField.TITLE, new RemoveBracesFormatter()).cleanup(entry);

By default, no cleanup is done.

Annotations
@Override
fixStringEncodingback to summary
private String fixStringEncoding(String value)

Method to change character set, to fix output string encoding If we don't convert to the correct character set, the parser outputs anomalous characters. This is observed in case of non-UTF-8 characters, such as accented characters.

getKeywordsback to summary
private Optional<String> getKeywords(kong.unirest.core.json.JSONObject primaryClass)
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
getOthersback to summary
private Optional<String> getOthers(kong.unirest.core.json.JSONObject item, List<String> keys)
getParserback to summary
public Parser getParser()

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

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

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

We use MR Lookup instead of the usual search since this tool is also available without subscription and, moreover, is optimized for finding a publication based on partial information.

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

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

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

Constructs a URL based on the query.

Annotations
@Override
getURLForQueryback to summary
public URL getURLForQuery(BaseQueryNode queryNode) throws URISyntaxException, MalformedURLException

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

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

Constructs a URL based on the lucene query.

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