1
0
Fork 0

[graph provision] select the longest abstract

This commit is contained in:
Claudio Atzori 2024-10-28 10:03:02 +01:00
parent 0fb6af5586
commit 32fa579b80
1 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package eu.dnetlib.dhp.oa.provision;
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -167,8 +168,9 @@ public class CreateRelatedEntitiesJob_phase1 {
result
.getDescription()
.stream()
.findFirst()
.filter(d -> Objects.nonNull(d.getValue()))
.map(Field::getValue)
.max(Comparator.comparingInt(String::length))
.ifPresent(
d -> re.setDescription(StringUtils.left(d, ModelHardLimits.MAX_RELATED_ABSTRACT_LENGTH)));
}