Skip to content

Commit

Permalink
Remove condition "If ISBN is equal means it's a duplicate" in "duplic…
Browse files Browse the repository at this point in the history
…ate check" (#11191)

* Remove condition "If 'ISBN' is equal means it's a duplicate" and gave 'ISBN' a weight

Signed-off-by: AbdAlRahmanGad <[email protected]>

* Remove ISBN weight

* Update CHANGELOG.md

---------

Signed-off-by: AbdAlRahmanGad <[email protected]>
Co-authored-by: Oliver Kopp <[email protected]>
  • Loading branch information
AbdAlRahmanGad and koppor authored Apr 16, 2024
1 parent a4a569f commit d92c2d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Changed

- We replaced the word "Key bindings" with "Keyboard shortcuts" in the Preferences tab. [#11153](https://github.com/JabRef/jabref/pull/11153)
- We slightly improved the duplicate check if ISBN numbers are present. [#8885](https://github.com/JabRef/jabref/issues/8885)

### Fixed

Expand Down
7 changes: 0 additions & 7 deletions src/main/java/org/jabref/logic/database/DuplicateCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.jabref.model.entry.field.OrFields;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.identifier.DOI;
import org.jabref.model.entry.identifier.ISBN;
import org.jabref.model.strings.StringUtil;

import com.google.common.collect.Sets;
Expand Down Expand Up @@ -331,12 +330,6 @@ public boolean isDuplicate(final BibEntry one, final BibEntry two, final BibData
if (oneDOI.isPresent() && twoDOI.isPresent()) {
return Objects.equals(oneDOI, twoDOI);
}
// check ISBN
Optional<ISBN> oneISBN = one.getISBN();
Optional<ISBN> twoISBN = two.getISBN();
if (oneISBN.isPresent() && twoISBN.isPresent()) {
return Objects.equals(oneISBN, twoISBN);
}

if (haveDifferentEntryType(one, two) ||
haveDifferentEditions(one, two) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.jabref.model.entry.types.StandardEntryType;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
Expand Down Expand Up @@ -382,13 +381,13 @@ public void twoEntriesWithDoiContainingUnderscoresAreNotEqual() {
}

@Test
public void twoEntriesWithSameISBNButDifferentTypesAreDuplicates() {
public void twoEntriesWithSameISBNButDifferentTypesAreNotDuplicates() {
simpleArticle.setField(StandardField.ISBN, "0-123456-47-9");
unrelatedArticle.setField(StandardField.ISBN, "0-123456-47-9");
BibEntry duplicateWithDifferentType = unrelatedArticle;
duplicateWithDifferentType.setType(StandardEntryType.InCollection);

assertTrue(duplicateChecker.isDuplicate(simpleArticle, duplicateWithDifferentType, BibDatabaseMode.BIBTEX));
assertFalse(duplicateChecker.isDuplicate(simpleArticle, duplicateWithDifferentType, BibDatabaseMode.BIBTEX));
}

public static Stream<Arguments> twoEntriesWithDifferentSpecificFieldsAreNotDuplicates() {
Expand Down Expand Up @@ -525,7 +524,9 @@ void compareOfTwoEntriesWithSameContentAndMixedLineEndingsReportsNoDifferences()
assertTrue(duplicateChecker.isDuplicate(entryOne, entryTwo, BibDatabaseMode.BIBTEX));
}

@Disabled("Book entries can have the same ISBN due to different chapters. The Test fails as crossref identifies both entries as the same.")
/**
* Book entries can have the same ISBN due to different chapters. The Test fails as crossref identifies both entries as the same.
*/
@Test
void differentArticlesFromTheSameBookAreNotDuplicates() {
BibEntry entryOne = new BibEntry(StandardEntryType.Article)
Expand Down

0 comments on commit d92c2d7

Please sign in to comment.