feat(fetcher): implement SearchBasedFetcher for ScienceDirect using scopus search API#14551
feat(fetcher): implement SearchBasedFetcher for ScienceDirect using scopus search API#14551koppor merged 25 commits intoJabRef:mainfrom
Conversation
|
Hey @Siva-Sai22! 👋 Thank you for contributing to JabRef! We have automated checks in place, based on which you will soon get feedback if any of them are failing. After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. Please re-check our AI Usage Policy to ensure that your pull request is in line with it. It also contains links to our contribution guide in case of any other doubts related to our contribution workflow. |
koppor
left a comment
There was a problem hiding this comment.
According to https://dev.elsevier.com/technical_documentation.html Scopus is not ScienceDirect.
I see two options:
- To avoid confusion,
ScienceDirectshould be renamed toElsevier. But then, we have a "big ball of mud", because the methods in that class are not coupled, but only semnatically correlated - Add new functionality to
Scopus- this should make maintainence easier. This fetcher should be added to the list of fetchers in the "Web Search" prefernces
Please do option 2 to have the fetcher class small.
- API key should renamed from "Scopus" to "Esevier", since it covers both.
Future work: Split up API key configuration and fetcher enablement.
| String response = new BufferedReader(new InputStreamReader(inputStream)) | ||
| .lines() | ||
| .collect(Collectors.joining(OS.NEWLINE)); | ||
|
|
||
| JSONObject jsonObject = new JSONObject(response); |
There was a problem hiding this comment.
There must be a method to convert an inputstream to a JSON object directly. But maybe, not mit dem JSONObject.
There was a problem hiding this comment.
** JSONObject response = JsonReader.toJsonObject(inputStream);
**
@koppor I think it would be better to take a scopus api key also. |
I searched for the code you gave
It seems that EACH FETCHER uses that thing. Since the new fetcher is a SearchBasedFetcher displayed in the preferences, the old fetcher should use the key of the other fetcher. With that, both fetchers will share the same key and it can be configured. Update That means, my idea with "Elsevier" was wrong and a concrete fetcher name is used. -- Please double check with the preferences code. |
|
@koppor I have checked the preferences code I have changes in which we allow the user to input the api key for scopus (same as the scienceDirect one) and can display the search results. If you are okay with this approach I will update the PR. |
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
|
@Siva-Sai22 It is difficult for me to follow. Please provide a link (you can search for files on GitHub by typing T). Provide a deep link to the line number. - It is also OK to provide a class name and line number. Answers might then even take longer, since we mostly do JabRef during the day in short breaks without an IDE opened. |
No, this is not OK, because it seems that only one fetcher is displayed and not the other one. To move on, you extract your new SearchBasedFetcher out and revert the original class to their own state. Then we maybe see easier how the key handling works. |
So the keys are fetched using the fetcher name.
This cannot be done because the api key is fetched using fetcher name. As suggested by you the scienceDirect should be kept as it is (and not make it a search based fetcher) and instead make a new searchbasedfetcher known as Scopus which uses the Esevier's api for searching. The scienceDirect and this scopus one will use the same api key. But inorder to use these the user has to put in the same api key twice (one for using scienceDirect which is fulltextFetcher (not modified) and one for the new Scopus which is searchBasedFetcher) These are the changes : main...Siva-Sai22:jabref:test |
|
@Siva-Sai22 I seee that the class |
|
@koppor updated the pr with required changes. Please let me know if any other changes are required. |
| public final String ieeeAPIKey; | ||
| public final String medlineApiKey; | ||
| public final String scienceDirectApiKey; | ||
| public final String scopusApiKey; |
There was a problem hiding this comment.
I accept that we missed the alphabetical ordering here.
|
[ant:checkstyle] [ERROR] /home/runner/work/jabref/jabref/jablib/src/test/java/org/jabref/logic/importer/fetcher/ScopusTest.java:27:15: Unused import - org.junit.jupiter.api.Assertions.assertFalse. [UnusedImports] |


Closes #14421
Implemented web search capability for ScienceDirect by integrating the Scopus Search API, since the ScienceDirect Search API requires institutional access that most users don't have. Added a new
ScopusQueryTransformerto convert JabRef search queries to Scopus query syntax, and wrote theScopusclass to implementPagedSearchBasedParserFetcherinterface, enabling paginated search results with proper JSON response parsing, this allows users to search academic literature via the "Web search" feature in JabRef, which was previously not available for ScienceDirect.Modified the
ScienceDirectto use the api key of scopus.Steps to test
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)