changed code to dump only the programme list and not the classification list

This commit is contained in:
Miriam Baglioni 2020-10-27 16:14:18 +01:00
parent 1bd638d291
commit 5d3012eeb4
1 changed files with 9 additions and 14 deletions

View File

@ -8,6 +8,7 @@ import java.io.StringReader;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.oaf.H2020Programme;
import org.apache.spark.SparkConf; import org.apache.spark.SparkConf;
import org.apache.spark.api.java.function.MapFunction; import org.apache.spark.api.java.function.MapFunction;
import org.apache.spark.sql.Encoders; import org.apache.spark.sql.Encoders;
@ -378,20 +379,14 @@ public class DumpGraphEntities implements Serializable {
} }
} }
project project.setH2020programme(
.setH2020Classifications( Optional.ofNullable(p.getH2020classification())
Optional .map(classification -> classification
.ofNullable(p.getH2020classification()) .stream()
.map( .map(c -> Programme.newInstance(c.getH2020Programme().getCode(), c.getH2020Programme().getDescription())).collect(Collectors.toList()))
classification -> classification .orElse(new ArrayList<>()));
.stream()
.map(
c -> H2020Classification
.newInstance(
c.getH2020Programme().getCode(), c.getH2020Programme().getDescription(),
c.getLevel1(), c.getLevel2(), c.getLevel3(), c.getClassification()))
.collect(Collectors.toList()))
.orElse(new ArrayList<>()));
Optional<List<Field<String>>> ofundTree = Optional Optional<List<Field<String>>> ofundTree = Optional
.ofNullable(p.getFundingtree()); .ofNullable(p.getFundingtree());