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 // from the script from Dimitris
if ("0000".equals(i.getRefereed().getClassid())) { if ("0000".equals(i.getRefereed().getClassid())) {
final boolean isFromCrossref = ModelConstants.CROSSREF_ID final boolean isFromCrossref = Optional
.equals(i.getCollectedfrom().getKey()); .ofNullable(i.getCollectedfrom())
final boolean hasDoi = i .map(KeyValue::getKey)
.getPid() .map(id -> id.equals(ModelConstants.CROSSREF_ID))
.stream() .orElse(false);
.anyMatch(pid -> PidType.doi.toString().equals(pid.getQualifier().getClassid())); 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 final boolean isPeerReviewedType = PEER_REVIEWED_TYPES
.contains(i.getInstancetype().getClassname()); .contains(i.getInstancetype().getClassname());
final boolean noOtherLitType = r final boolean noOtherLitType = r