Skip to content

Show fetch exception at citation relation#13549

Merged
koppor merged 12 commits intomainfrom
citation-relations
Jul 29, 2025
Merged

Show fetch exception at citation relation#13549
koppor merged 12 commits intomainfrom
citation-relations

Conversation

@koppor
Copy link
Copy Markdown
Member

@koppor koppor commented Jul 15, 2025

image

Background

The API does not return the citing information, but their web page does

image

https://www.semanticscholar.org/paper/Decentralized-Application-Placement-in-Fog-Mann/6870975f7f4db00ad1e2fa041545b67c6e8ef73c

Steps to test

  1. Add paper with DOI 10.1109/TPDS.2022.3148985
  2. Open tab "Citaton relations"

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • [/] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [/] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 15, 2025

implementation("com.fasterxml:aalto-xml")

implementation("org.hisp.dhis:json-tree")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why another json library?

Copy link
Copy Markdown
Member

@Siedlerchr Siedlerchr Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For optionals use kongs unirest json

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why another json library?

Because I know the author personally. And it is fast

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For optionals use kongs unirest json

Show me. 😅

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I know the author personally. And it is fast
Argument by authority is not a valid reason

see: eg.g
JSONObject result = item.getJSONObject("resultList").getJSONArray("result").getJSONObject(0);

Optional.ofNullable(result.optString("pubModel")).ifPresent(pubModel -> entry.setField(StandardField.HOWPUBLISHED, pubModel));


if (referencesResponse.getData() == null) {
JsonNode json = JsonNode.of(response);
JsonNode disclaimerJson = json.getOrNull("citingPaperInfo.openAccessPdf.disclaimer");
Copy link
Copy Markdown
Member

@Siedlerchr Siedlerchr Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use kong's unirest json that allows you to use optionals

            JSONObject response = JsonReader.toJsonObject(inputStream);


      JSONObject journal = journalInfo.getJSONObject("journal");
                    Optional.ofNullable(journal.optString("title")).ifPresent(title -> entry.setField(StandardField.JOURNAL, title));
                    ```

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chaining will be very ugly here?! Sure that we want to have 4 Optional.ofNullable calls? Or some chaining of null checks?

Copy link
Copy Markdown
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no new json library
use kongs unirest json for this

@Siedlerchr Siedlerchr added status: changes-required Pull requests that are not yet complete and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Jul 20, 2025
ReferencesResponse referencesResponse = GSON.fromJson(response, ReferencesResponse.class);

if (referencesResponse.getData() == null) {
// Get error message from citingPaperInfo.openAccessPdf.disclaimer
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment simply describes what the following code does without adding any new information or reasoning, violating the principle of meaningful comments.

Siedlerchr
Siedlerchr previously approved these changes Jul 28, 2025
Copy link
Copy Markdown
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good boy! using the best json

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 28, 2025
@koppor koppor enabled auto-merge July 28, 2025 19:45
Siedlerchr
Siedlerchr previously approved these changes Jul 28, 2025
@koppor koppor added automerge PR is tagged with that label will be merged if workflows are green and removed status: changes-required Pull requests that are not yet complete status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels Jul 28, 2025
jabref-machine
jabref-machine previously approved these changes Jul 28, 2025
@trag-bot
Copy link
Copy Markdown

trag-bot bot commented Jul 28, 2025

@trag-bot didn't find any issues in the code! ✅✨

@koppor koppor added this pull request to the merge queue Jul 29, 2025
Merged via the queue into main with commit ebfc893 Jul 29, 2025
2 checks passed
@koppor koppor deleted the citation-relations branch July 29, 2025 00:16
Siedlerchr added a commit that referenced this pull request Aug 2, 2025
* 'main' of github.com:JabRef/jabref: (26 commits)
  Change Open AI to Open AI  (or API Compatible)  (#13608)
  Remove all assignment tracking labels
  Updated architecture and components link in CONTRIBUTING.md (#13606)
  #13301 Fix/unicode reference marks (#13590)
  Show fetch exception at citation relation (#13549)
  More jbang caching
  Sequential run for moving issues
  Update CSL Styles (#13601)
  Fix gradle issues (#13603)
  Add System.exit (#13510)
  New Crowdin updates (#13600)
  Automatic lookup DOI at citation information. (#13596)
  Update heylogs from 0.10.0 to 0.11.1 (#13594)
  add fallback and reenable defaultcomeslast (#13593)
  Fix debian vagrant image (#13589)
  Fix: Replace string "Tests" with "Source Code Tests" in PR Comment (#13587)
  Fix version for SNAPSHOT (#13581)
  Update JDK and JavaFX (#13580)
  Add icon (#13579)
  Fixes link I broke in PR 13568 (#13577)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge PR is tagged with that label will be merged if workflows are green component: citation-relations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants