|
|
|
@ -6,6 +6,7 @@ import static eu.dnetlib.dhp.actionmanager.bipmodel.Constants.UPDATE_CLASS_NAME;
|
|
|
|
|
import static eu.dnetlib.dhp.common.SparkSessionSupport.runWithSparkSession;
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -28,6 +29,7 @@ import eu.dnetlib.dhp.actionmanager.bipmodel.BipScore;
|
|
|
|
|
import eu.dnetlib.dhp.application.ArgumentApplicationParser;
|
|
|
|
|
import eu.dnetlib.dhp.common.HdfsSupport;
|
|
|
|
|
import eu.dnetlib.dhp.schema.common.ModelConstants;
|
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.Instance;
|
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.KeyValue;
|
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.Measure;
|
|
|
|
|
import eu.dnetlib.dhp.schema.oaf.Result;
|
|
|
|
@ -39,7 +41,7 @@ public class PrepareBipFinder implements Serializable {
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(PrepareBipFinder.class);
|
|
|
|
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
|
|
|
|
|
|
|
|
|
public static <I extends Result> void main(String[] args) throws Exception {
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
|
|
|
|
|
String jsonConfiguration = IOUtils
|
|
|
|
|
.toString(
|
|
|
|
@ -75,7 +77,7 @@ public class PrepareBipFinder implements Serializable {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static <I extends Result> void prepareResults(SparkSession spark, String inputPath, String outputPath) {
|
|
|
|
|
private static void prepareResults(SparkSession spark, String inputPath, String outputPath) {
|
|
|
|
|
|
|
|
|
|
final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext());
|
|
|
|
|
|
|
|
|
@ -95,7 +97,9 @@ public class PrepareBipFinder implements Serializable {
|
|
|
|
|
Result r = new Result();
|
|
|
|
|
|
|
|
|
|
r.setId(DHPUtils.generateUnresolvedIdentifier(v.getId(), DOI));
|
|
|
|
|
r.setMeasures(getMeasure(v));
|
|
|
|
|
Instance inst = new Instance();
|
|
|
|
|
inst.setMeasures(getMeasure(v));
|
|
|
|
|
r.setInstance(Arrays.asList(inst));
|
|
|
|
|
return r;
|
|
|
|
|
}, Encoders.bean(Result.class))
|
|
|
|
|
.write()
|
|
|
|
|