1
0
Fork 0

[graph cleaning] avoid NPEs

This commit is contained in:
Claudio Atzori 2023-10-12 09:13:42 +02:00
parent a460ebe215
commit 05ee7d8b09
1 changed files with 13 additions and 6 deletions

View File

@ -509,12 +509,19 @@ public class GraphCleaningFunctions extends CleaningFunctions {
// from the script from Dimitris
if ("0000".equals(i.getRefereed().getClassid())) {
final boolean isFromCrossref = ModelConstants.CROSSREF_ID
.equals(i.getCollectedfrom().getKey());
final boolean hasDoi = i
.getPid()
.stream()
.anyMatch(pid -> PidType.doi.toString().equals(pid.getQualifier().getClassid()));
final boolean isFromCrossref = Optional
.ofNullable(i.getCollectedfrom())
.map(KeyValue::getKey)
.map(id -> id.equals(ModelConstants.CROSSREF_ID))
.orElse(false);
final boolean hasDoi = Optional
.ofNullable(i.getPid())
.map(
pid -> pid
.stream()
.anyMatch(
p -> PidType.doi.toString().equals(p.getQualifier().getClassid())))
.orElse(false);
final boolean isPeerReviewedType = PEER_REVIEWED_TYPES
.contains(i.getInstancetype().getClassname());
final boolean noOtherLitType = r