[graph provision] select the longest abstract
This commit is contained in:
parent
0fb6af5586
commit
32fa579b80
|
@ -3,6 +3,7 @@ package eu.dnetlib.dhp.oa.provision;
|
||||||
|
|
||||||
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
|
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -167,8 +168,9 @@ public class CreateRelatedEntitiesJob_phase1 {
|
||||||
result
|
result
|
||||||
.getDescription()
|
.getDescription()
|
||||||
.stream()
|
.stream()
|
||||||
.findFirst()
|
.filter(d -> Objects.nonNull(d.getValue()))
|
||||||
.map(Field::getValue)
|
.map(Field::getValue)
|
||||||
|
.max(Comparator.comparingInt(String::length))
|
||||||
.ifPresent(
|
.ifPresent(
|
||||||
d -> re.setDescription(StringUtils.left(d, ModelHardLimits.MAX_RELATED_ABSTRACT_LENGTH)));
|
d -> re.setDescription(StringUtils.left(d, ModelHardLimits.MAX_RELATED_ABSTRACT_LENGTH)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue