-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(fetcher): implement SearchBasedFetcher for ScienceDirect using scopus search API #14551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
** 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 For the tests I thought that if they covered the cases correctly then it is enough. So generated it through ai by explaining it the cases and focused more on the actual implementation. Sorry for that, next time onwards will write the tests also myself. |
…pdate related tests and docs - Use Scopus API key for ScienceDirect fetcher and remove separate ScienceDirect API key handling - Update environment variable and build configuration to use ScopusApiKey - Adjust tests to reflect unified API key usage - Remove redundant or obsolete test cases in Scopus and query transformer tests - Update documentation and changelog to clarify Scopus/ScienceDirect API key requirements
…pdate related tests and docs - Use Scopus API key for ScienceDirect fetcher and remove separate ScienceDirect API key handling - Update environment variable and build configuration to use ScopusApiKey - Adjust tests to reflect unified API key usage - Remove redundant or obsolete test cases in Scopus and query transformer tests - Update documentation and changelog to clarify Scopus/ScienceDirect API key requirements # Conflicts: # jablib/src/main/java/org/jabref/logic/importer/fetcher/ScienceDirect.java
jablib/src/main/java/org/jabref/logic/importer/fetcher/ScienceDirect.java
Outdated
Show resolved
Hide resolved
jablib/src/main/java/org/jabref/logic/importer/fetcher/Scopus.java
Outdated
Show resolved
Hide resolved
| * Note: ScienceDirect Search API requires institutional access, so we use Scopus API instead | ||
| * which is available to all registered developers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure? I think, it is different functionalit!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I tried using the same api key from elsevier to the scienceDirect api. It always returned authorization error.
{"status":{"statusCode":"AUTHORIZATION_ERROR","statusText":"The requestor is not authorized to access the requested view or fields of the resource"}}}
…Direct.java Co-authored-by: Oliver Kopp <[email protected]>
Removed unnecessary comments about the Scopus Search API.
koppor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you have the energy to have a good java doc and fix other small nitpicks.
It is OK to say: no time - then someone of the team will try to finish.
| /** | ||
| * Query transformer for the Scopus Search API. | ||
| * <p> | ||
| * Scopus uses specific field codes for advanced search: | ||
| * - TITLE-ABS-KEY-AUTH() for searching in title, abstract, author and keywords | ||
| * - AUTH() for author search | ||
| * - SRCTITLE() for journal/source title search | ||
| * - PUBYEAR for publication year | ||
| * - DOI() for DOI search | ||
| * <p> | ||
| * Scopus supports AND, OR, AND NOT as boolean operators. | ||
| * <p> | ||
| * See: https://dev.elsevier.com/sc_search_tips.html | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert to markdown - or use proper HTML - the item list is not correctly displayed as is.
| @Nullable | ||
| private BibEntry parseScopusEntry(JSONObject jsonEntry) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In JabRef, we use Optionals.
|
@koppor updated the pr with required changes. Please let me know if any other changes are required. |


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)