-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1302 from libris/feature/softer-work-matching
Feature/softer work matching
- Loading branch information
Showing
9 changed files
with
65 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
librisworks/src/main/groovy/se/kb/libris/mergeworks/compare/ContentType.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package se.kb.libris.mergeworks.compare | ||
|
||
import static se.kb.libris.mergeworks.Util.asList | ||
|
||
class ContentType extends StuffSet { | ||
private static def allowedValues = ['https://id.kb.se/term/rda/StillImage', 'https://id.kb.se/term/rda/Text'] | ||
|
||
@Override | ||
boolean isCompatible(Object a, Object b) { | ||
asList(a).every { it['@id'] in allowedValues } && asList(b).every { it['@id'] in allowedValues } | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
librisworks/src/main/groovy/se/kb/libris/mergeworks/compare/IntendedAudience.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package se.kb.libris.mergeworks.compare | ||
|
||
import se.kb.libris.mergeworks.Doc | ||
|
||
import static se.kb.libris.mergeworks.Util.asList | ||
|
||
class IntendedAudience extends StuffSet { | ||
private static def GENERAL = ['@id': 'https://id.kb.se/marc/General'] | ||
private static def ADULT = ['@id': 'https://id.kb.se/marc/Adult'] | ||
|
||
@Override | ||
boolean isCompatible(Object a, Object b) { | ||
!a || !b || asList(a) == [GENERAL] || asList(b) == [GENERAL] | ||
|| !(asList(a) + asList(b)).findResults { it == ADULT }.containsAll([true, false]) | ||
} | ||
|
||
static void preferredComparisonOrder(Collection<Doc> docs) { | ||
docs.sort { Doc d -> | ||
d.intendedAudience().with { | ||
it.isEmpty() || it == [GENERAL] || it == [ADULT] | ||
} | ||
}.reverse(true) | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
librisworks/src/main/groovy/se/kb/libris/mergeworks/compare/SameOrEmpty.groovy
This file was deleted.
Oops, something went wrong.