Skip to content

Enable updating entries from web sources without identifiers#14644

Closed
Nusa942 wants to merge 1 commit intoJabRef:mainfrom
Nusa942:issue-14185-entry-based-update
Closed

Enable updating entries from web sources without identifiers#14644
Nusa942 wants to merge 1 commit intoJabRef:mainfrom
Nusa942:issue-14185-entry-based-update

Conversation

@Nusa942
Copy link
Copy Markdown

@Nusa942 Nusa942 commented Dec 17, 2025

Closes #14185

Adds a new Lookup menu action that updates an existing bibliographic entry using web sources based on the entry’s current metadata (title, authors, year), without requiring identifiers. The action retrieves one candidate per source and presents the results in the multi-merge dialog, updating the original entry only after user confirmation.

Steps to test

  1. Open JabRef and create or open a library.
  2. Add an entry without DOI/ISBN but with at least a title (for example: Vicsek et al., 1995).
  3. Select exactly one entry.
  4. Open the Lookup menu and click the new entry-based update action.
  5. Verify that the multi-merge dialog opens with proposals from web sources.
  6. Confirm the merge and verify that new fields (such as journal, volume, pages, or DOI) are added to the existing entry.
  7. Use undo (Ctrl+Z) to verify that changes can be reverted.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef
  • [/] I added JUnit tests for changes
  • [/] I added screenshots in the PR description
  • I described the change in CHANGELOG.md in a way that is understandable for the average user
  • [/] I checked the user documentation

@github-actions github-actions Bot added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Dec 17, 2025
@Nusa942 Nusa942 changed the title Issue 14185 entry based update Enable updating entries from web sources without identifiers Dec 17, 2025
@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Dec 17, 2025
@github-actions
Copy link
Copy Markdown
Contributor

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.

@calixtus
Copy link
Copy Markdown
Member

Dont do translation manually. See contributing guide, https://devdocs.jabref.org/code-howtos/localization.html#adding-a-new-key

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.

Do not change project files

private final TaskExecutor taskExecutor;
private final DialogService dialogService;

public UpdateEntryFromWebSourcesAction(StateManager stateManager, UndoManager undoManager, GuiPreferences preferences, NotificationService notificationService, TaskExecutor taskExecutor, DialogService dialogService) {
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.

One argument per line

Comment on lines +51 to +53
if (stateManager.getActiveDatabase().isEmpty()) {
return;
}
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.

use assert here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

i'll check all your comments and push again, thank you!

@calixtus
Copy link
Copy Markdown
Member

Meaning: Undo all changes to l10n files except english one.

Comment on lines +86 to +115
BibEntry mergedEntry = merged.get();
NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Update entry from web sources"));

Set<Field> jointFields = new TreeSet<>(Comparator.comparing(Field::getName));
jointFields.addAll(mergedEntry.getFields());
Set<Field> originalFields = new TreeSet<>(Comparator.comparing(Field::getName));
originalFields.addAll(entry.getFields());

boolean edited = false;

for (Field field : jointFields) {
Optional<String> originalString = entry.getField(field);
Optional<String> mergedString = mergedEntry.getField(field);

if (originalString.isEmpty() || !originalString.equals(mergedString)) {
String newValue = mergedString.orElse("");
entry.setField(field, newValue);
compoundEdit.addEdit(new UndoableFieldChange(entry, field, originalString.orElse(null), newValue));
edited = true;
}
}

for (Field field : originalFields) {
if (!jointFields.contains(field) && !FieldFactory.isInternalField(field)) {
Optional<String> originalString = entry.getField(field);
entry.clearField(field);
compoundEdit.addEdit(new UndoableFieldChange(entry, field, originalString.orElse(null), null));
edited = true;
}
}
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.

This is AI genereted, isn't it? Our merge dialogs should already be able to do it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I didn't realized the dialog did it already, i'll take a look.

@InAnYan
Copy link
Copy Markdown
Member

InAnYan commented Dec 29, 2025

I'll convert this to draft, as it seems there are a lot of work

@InAnYan InAnYan marked this pull request as draft December 29, 2025 14:28
# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/mergeentries/UpdateEntryFromWebSourcesAction.java
@Nusa942 Nusa942 force-pushed the issue-14185-entry-based-update branch from bf8a34a to abfd0e9 Compare January 3, 2026 18:59
@jabref-machine
Copy link
Copy Markdown
Collaborator

Hey, we noticed that you force-pushed your changes. Force pushing is a bad practice when working together on a project (mainly because it is not supported well by GitHub itself). Commits are lost and comments on commits lose their context, thus making it harder to review changes.

When the pull request is getting integrated into main, all commits will be squashed anyway. Thus, your individual commit history will not be visible in main.

In future, please avoid that. For now, you can continue working.

@jabref-machine
Copy link
Copy Markdown
Collaborator

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@github-actions
Copy link
Copy Markdown
Contributor

The requested changes were not addressed for 14 days. Please follow-up in the next 7 days or your PR will be automatically closed. You can check the contributing guidelines for hints on the pull request process.

@github-actions github-actions Bot added the status: stale Issues marked by a bot as "stale". All issues need to be investigated manually. label Jan 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This PR is being closed due to continued inactivity.

@github-actions github-actions Bot closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: fetcher good first issue An issue intended for project-newcomers. Varies in difficulty. status: changes-required Pull requests that are not yet complete status: stale Issues marked by a bot as "stale". All issues need to be investigated manually.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refine "Update with bibliographic information from the web"

5 participants