From 2e503ee101bca19d610b51ad1738cc0c0c12ad0e Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Thu, 17 Dec 2020 13:47:38 +0100 Subject: [PATCH 1/3] code formatting --- .../java/eu/dnetlib/dhp/actionmanager/bipfinder/BipScore.java | 4 ++-- .../actionmanager/bipfinder/SparkAtomicActionScoreJob.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/BipScore.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/BipScore.java index da9a4bd0c..247546694 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/BipScore.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/BipScore.java @@ -9,8 +9,8 @@ import java.util.List; */ public class BipScore implements Serializable { - private String id; //doi - private List scoreList; //unit as given in the inputfile + private String id; // doi + private List scoreList; // unit as given in the inputfile public String getId() { return id; diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java index 23764f38e..50bda898c 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java @@ -144,7 +144,6 @@ public class SparkAtomicActionScoreJob implements Serializable { } - private static List getMeasure(BipScore value) { return value .getScoreList() From 1361c9eb0c6c4f929eefaa071405d8e1d93ba202 Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Thu, 7 Jan 2021 10:07:30 +0100 Subject: [PATCH 2/3] [BIP! Scores integration] Create updates as Result rather than subclasses; Result considers also metrics in the mergeFrom operation --- dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java | 2 +- .../dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java index 443c18230..0026ee9aa 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/Result.java @@ -243,7 +243,7 @@ public class Result extends OafEntity implements Serializable { Result r = (Result) e; - // TODO consider merging also Measures + measures = mergeLists(measures, r.getMeasures()); instance = mergeLists(instance, r.getInstance()); diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java index 50bda898c..dfe48542c 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java @@ -126,7 +126,7 @@ public class SparkAtomicActionScoreJob implements Serializable { }, Encoders.bean(BipScore.class)) .groupByKey((MapFunction) value -> value.getId(), Encoders.STRING()) .mapGroups((MapGroupsFunction) (k, it) -> { - Result ret = inputClazz.newInstance(); + Result ret = new Result(); BipScore first = it.next(); ret.setId(first.getId()); From 34229970e6df31c3d5520e6151b53e31943ad35c Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Fri, 8 Jan 2021 16:29:17 +0100 Subject: [PATCH 3/3] [BIP! Scores integration] Create updates as Result rather than subclasses; Result considers also metrics in the mergeFrom operation --- .../actionmanager/bipfinder/SparkAtomicActionScoreJob.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java index dfe48542c..2cd37d9ea 100644 --- a/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java +++ b/dhp-workflows/dhp-aggregation/src/main/java/eu/dnetlib/dhp/actionmanager/bipfinder/SparkAtomicActionScoreJob.java @@ -125,16 +125,17 @@ public class SparkAtomicActionScoreJob implements Serializable { return ret; }, Encoders.bean(BipScore.class)) .groupByKey((MapFunction) value -> value.getId(), Encoders.STRING()) - .mapGroups((MapGroupsFunction) (k, it) -> { + .mapGroups((MapGroupsFunction) (k, it) -> { Result ret = new Result(); + ret.setDataInfo(getDataInfo()); BipScore first = it.next(); ret.setId(first.getId()); ret.setMeasures(getMeasure(first)); it.forEachRemaining(value -> ret.getMeasures().addAll(getMeasure(value))); - return (I) ret; - }, Encoders.bean(inputClazz)) + return ret; + }, Encoders.bean(Result.class)) .toJavaRDD() .map(p -> new AtomicAction(inputClazz, p)) .mapToPair(