diff --git a/docs/code-howtos/fetchers.md b/docs/code-howtos/fetchers.md index e10c800b940..81331ed7592 100644 --- a/docs/code-howtos/fetchers.md +++ b/docs/code-howtos/fetchers.md @@ -12,7 +12,7 @@ Fetchers are the implementation of the [search using online services](https://do | [SAO/NASA Astrophysics Data System](https://docs.jabref.org/collect/import-using-online-bibliographic-database#sao-nasa-astrophysics-data-system) | [ADS UI](https://ui.adsabs.harvard.edu/user/settings/token) | `AstrophysicsDataSystemAPIKey` | 5000 calls/day | | [ScienceDirect](https://www.sciencedirect.com) | | `ScienceDirectApiKey` | | | [SemanticScholar](https://www.semanticscholar.org/) | | `SemanticScholarApiKey` | | -| [Springer Nature](https://docs.jabref.org/collect/import-using-online-bibliographic-database#springer) | [Springer Nature API Portal](https://dev.springernature.com) | `SpringerNatureAPIKey` | 5000 calls/day | +| [Springer Nature](https://docs.jabref.org/collect/import-using-online-bibliographic-database#springer) | [Springer Nature API Portal](https://dev.springernature.com). Use the "Meta API" API key. | `SpringerNatureAPIKey` | 5000 calls/day | | [Zentralblatt Math](https://www.zbmath.org) | (none) | (none) | Depending on the current network | | [Biodiversity Heritage Library](https://www.biodiversitylibrary.org/) | [Biodiversitylibrary](https://about.biodiversitylibrary.org/tools-and-services/developer-and-data-tools/#APIs) | `BiodiversityHeritageApiKey` | - | diff --git a/jablib/build.gradle.kts b/jablib/build.gradle.kts index 95aae5b2158..ce098a9c7ac 100644 --- a/jablib/build.gradle.kts +++ b/jablib/build.gradle.kts @@ -431,25 +431,30 @@ jmh { zip64 = true } +val testSourceSet = sourceSets["test"] + tasks.register("fetcherTest") { + group = LifecycleBasePlugin.VERIFICATION_GROUP + testClassesDirs = testSourceSet.output.classesDirs + classpath = testSourceSet.runtimeClasspath useJUnitPlatform { includeTags("FetcherTest") } - maxParallelForks = 1 } tasks.register("databaseTest") { + group = LifecycleBasePlugin.VERIFICATION_GROUP + testClassesDirs = testSourceSet.output.classesDirs + classpath = testSourceSet.runtimeClasspath useJUnitPlatform { includeTags("DatabaseTest") } - testLogging { // set options for log level LIFECYCLE events("FAILED") exceptionFormat = TestExceptionFormat.FULL } - maxParallelForks = 1 } diff --git a/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureFullTextFetcher.java b/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureFullTextFetcher.java index 378f18fc8bc..0bc8a273e09 100644 --- a/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureFullTextFetcher.java +++ b/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureFullTextFetcher.java @@ -31,6 +31,9 @@ public class SpringerNatureFullTextFetcher implements FulltextFetcher, Customiza private static final Logger LOGGER = LoggerFactory.getLogger(SpringerNatureFullTextFetcher.class); + // TODO: Update to the new [fulltext API](https://dev.springernature.com/docs/api-endpoints/fulltext-api/?source=jabref) + // as well as [Open Access API](https://dev.springernature.com/docs/api-endpoints/open-access/?source=jabref) + // Both APIs also [require separate API keys](https://dev.springernature.com/subscription/). private static final String API_URL = "https://api.springer.com/meta/v1/json"; private static final String CONTENT_HOST = "link.springer.com"; diff --git a/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureWebFetcher.java b/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureWebFetcher.java index 78305d4914c..c7cc54bcd3a 100644 --- a/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureWebFetcher.java +++ b/jablib/src/main/java/org/jabref/logic/importer/fetcher/SpringerNatureWebFetcher.java @@ -32,19 +32,17 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * Fetches data from the Springer - * - * @see API documentation for more details - */ +/// Fetches data from Springer Nature +/// +/// See for more information public class SpringerNatureWebFetcher implements PagedSearchBasedParserFetcher, CustomizableKeyFetcher { public static final String FETCHER_NAME = "Springer"; private static final Logger LOGGER = LoggerFactory.getLogger(SpringerNatureWebFetcher.class); - private static final String API_URL = "https://api.springernature.com/meta/v1/json"; + private static final String API_URL = "https://api.springernature.com/meta/v2/json"; // Springer query using the parameter 'q=doi:10.1007/s11276-008-0131-4s=1' will respond faster - private static final String TEST_URL_WITHOUT_API_KEY = "https://api.springernature.com/meta/v1/json?q=doi:10.1007/s11276-008-0131-4s=1&p=1&api_key="; + private static final String TEST_URL_WITHOUT_API_KEY = "https://api.springernature.com/meta/v2/json?q=doi:10.1007/s11276-008-0131-4s=1&p=1&api_key="; private final ImporterPreferences importerPreferences; @@ -53,7 +51,7 @@ public SpringerNatureWebFetcher(ImporterPreferences importerPreferences) { } /** - * Convert a JSONObject obtained from http://api.springer.com/metadata/json to a BibEntry + * Convert a JSONObject obtained from the Metadata API to a BibEntry * * @param springerJsonEntry the JSONObject from search results * @return the converted BibEntry diff --git a/jablib/src/main/java/org/jabref/logic/importer/fetcher/transformers/SpringerQueryTransformer.java b/jablib/src/main/java/org/jabref/logic/importer/fetcher/transformers/SpringerQueryTransformer.java index ab83f30fca0..63f7612a4bb 100644 --- a/jablib/src/main/java/org/jabref/logic/importer/fetcher/transformers/SpringerQueryTransformer.java +++ b/jablib/src/main/java/org/jabref/logic/importer/fetcher/transformers/SpringerQueryTransformer.java @@ -1,10 +1,11 @@ package org.jabref.logic.importer.fetcher.transformers; -/** - * This class converts a query string written in lucene syntax into a complex query. - * - * For simplicity this is currently limited to fielded data and the boolean AND operator. - */ +/// This class converts a query string written in lucene syntax into a complex query. +/// +/// For simplicity this is currently limited to fielded data and the boolean AND operator. +/// +/// See for a complete list of supported fields. +/// `handleUnFieldedTerm` is not overridden, because the API handles unfielded terms. public class SpringerQueryTransformer extends AbstractQueryTransformer { @Override