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

public Class ZbMATH

extends Object
implements SearchBasedParserFetcher, IdBasedParserFetcher, EntryBasedParserFetcher
Class Inheritance
All Implemented Interfaces
org.jabref.logic.importer.EntryBasedParserFetcher, org.jabref.logic.importer.ParserFetcher, org.jabref.logic.importer.EntryBasedFetcher, org.jabref.logic.importer.WebFetcher, org.jabref.logic.importer.IdBasedParserFetcher, org.jabref.logic.importer.IdBasedFetcher, org.jabref.logic.importer.SearchBasedParserFetcher, org.jabref.logic.importer.SearchBasedFetcher
Annotations
@NullMarked
Imports
java.io.IOException, .InputStream, java.net.MalformedURLException, .URISyntaxException, .URL, java.util.ArrayList, .List, .Optional, .Set, java.util.regex.Pattern, java.util.stream.Collectors, org.jabref.logic.cleanup.FieldFormatterCleanup, .MoveFieldCleanup, org.jabref.logic.formatter.bibtexfields.RemoveEnclosingBracesFormatter, org.jabref.logic.help.HelpFile, org.jabref.logic.importer.EntryBasedParserFetcher, .FetcherException, .IdBasedParserFetcher, .ImportFormatPreferences, .ParseException, .Parser, .SearchBasedParserFetcher, org.jabref.logic.importer.fetcher.transformers.ZbMathQueryTransformer, org.jabref.logic.importer.util.JsonReader, org.jabref.logic.util.strings.StringSimilarity, .StringUtil, org.jabref.model.entry.AuthorList, .BibEntry, org.jabref.model.entry.field.AMSField, .StandardField, .UnknownField, org.jabref.model.entry.types.StandardEntryType, org.jabref.model.search.query.BaseQueryNode, .OperatorNode, .SearchQueryNode, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONObject, org.apache.hc.core5.net.URIBuilder, org.jspecify.annotations.NullMarked

Fetches data from the Zentralblatt Math (zbmath.org)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record

Field Summary

Modifier and TypeField and Description
private static final double
private static final String
private static final String
private static final int
private static final double
private static final double
private static final double
private static final Pattern
private final ImportFormatPreferences
private static final Pattern

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addSearchNode(List<BaseQueryNode> searchNodes, StandardField field, String value)

private String
public void
doPostCleanup(BibEntry entry)

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

Performs a cleanup of the fetched entry.

private double
familyNameOverlap(String inputAuthors, String candidateAuthors)

private Optional<BibEntry>
findBestMatchingEntry(BibEntry inputEntry, List<BibEntry> candidates)

private List<BibEntry>
public Optional<HelpFile>
getHelpPage()

Overrides default org.jabref.logic.importer.WebFetcher.getHelpPage.

Returns the help page for this fetcher.

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 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 URL
getURLForSearchQuery(String searchQuery, String resultCount)

private static String
private List<BibEntry>
private void
parseSource(BibEntry entry, kong.unirest.core.json.JSONObject source)

public List<BibEntry>
performSearch(BibEntry entry)

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

Looks for hits which are matched by the given BibEntry.

private double
scoreCandidate(BibEntry inputEntry, BibEntry candidate)

private BibEntry
toBibEntry(kong.unirest.core.json.JSONObject entryJson)

private StandardEntryType
toEntryType(kong.unirest.core.json.JSONObject entryJson)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AMBIGUITY_DELTAback to summary
private static final double AMBIGUITY_DELTA
DOCUMENT_SEARCH_URLback to summary
private static final String DOCUMENT_SEARCH_URL
DOCUMENT_URLback to summary
private static final String DOCUMENT_URL
ENTRY_SEARCH_RESULT_COUNTback to summary
private static final int ENTRY_SEARCH_RESULT_COUNT
MIN_AUTHOR_OVERLAPback to summary
private static final double MIN_AUTHOR_OVERLAP
MIN_CONFIDENCEback to summary
private static final double MIN_CONFIDENCE
MIN_TITLE_SIMILARITYback to summary
private static final double MIN_TITLE_SIMILARITY
NON_ALNUM_OR_SPACE_PATTERNback to summary
private static final Pattern NON_ALNUM_OR_SPACE_PATTERN
preferencesback to summary
private final ImportFormatPreferences preferences
WHITESPACE_PATTERNback to summary
private static final Pattern WHITESPACE_PATTERN

Constructor Detail

ZbMATHback to summary
public ZbMATH(ImportFormatPreferences preferences)

Method Detail

addSearchNodeback to summary
private void addSearchNode(List<BaseQueryNode> searchNodes, StandardField field, String value)
buildSearchQueryback to summary
private String buildSearchQuery(BibEntry entry)
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
familyNameOverlapback to summary
private double familyNameOverlap(String inputAuthors, String candidateAuthors)
findBestMatchingEntryback to summary
private Optional<BibEntry> findBestMatchingEntry(BibEntry inputEntry, List<BibEntry> candidates)
getBibEntriesback to summary
private List<BibEntry> getBibEntries(URL urlForQuery) throws FetcherException

Redeclares private: org.jabref.logic.importer.SearchBasedParserFetcher.getBibEntries.

getHelpPageback to summary
public Optional<HelpFile> getHelpPage()

Overrides default org.jabref.logic.importer.WebFetcher.getHelpPage.

Doc from org.jabref.logic.importer.WebFetcher.getHelpPage.

Returns the help page for this fetcher.

Annotations
@Override
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
getParserback to summary
public Parser getParser()

Implements org.jabref.logic.importer.SearchBasedParserFetcher.getParser, org.jabref.logic.importer.IdBasedParserFetcher.getParser, org.jabref.logic.importer.EntryBasedParserFetcher.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, FetcherException

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

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

Constructs a URL based on the BibEntry.

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
getURLForSearchQueryback to summary
private URL getURLForSearchQuery(String searchQuery, String resultCount) throws URISyntaxException, MalformedURLException
normalizeForTitleMatchingback to summary
private static String normalizeForTitleMatching(String title)
parseEntriesback to summary
private List<BibEntry> parseEntries(InputStream stream) throws ParseException
parseSourceback to summary
private void parseSource(BibEntry entry, kong.unirest.core.json.JSONObject source)
performSearchback to summary
public List<BibEntry> performSearch(BibEntry entry) throws FetcherException

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

Doc from org.jabref.logic.importer.EntryBasedFetcher.performSearch.

Looks for hits which are matched by the given BibEntry.

Annotations
@Override
scoreCandidateback to summary
private double scoreCandidate(BibEntry inputEntry, BibEntry candidate)
toBibEntryback to summary
private BibEntry toBibEntry(kong.unirest.core.json.JSONObject entryJson)
toEntryTypeback to summary
private StandardEntryType toEntryType(kong.unirest.core.json.JSONObject entryJson)
org.jabref.logic.importer.fetcher back to summary

private final Record ZbMATH.ScoredEntry

extends Record
Class Inheritance
Record Components
entry:BibEntry 
score:double 

Field Summary

Modifier and TypeField and Description
private final BibEntry
entry

Record Component accessed by entry().

private final double
score

Record Component accessed by score().

Constructor Summary

AccessConstructor and Description
private
ScoredEntry(BibEntry entry, double score)

Method Summary

Modifier and TypeMethod and Description
public BibEntry
entry()

Record Component getter of entry.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public double
score()

Record Component getter of score.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

entryback to summary
private final BibEntry entry

Record Component accessed by entry().

scoreback to summary
private final double score

Record Component accessed by score().

Constructor Detail

ScoredEntryback to summary
private ScoredEntry(BibEntry entry, double score)

Method Detail

entryback to summary
public BibEntry entry()

Record Component getter of entry.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

scoreback to summary
public double score()

Record Component getter of score.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.