Compare commits

...

2 Commits

Author SHA1 Message Date
Miriam Baglioni be4954b5ff changed version of schema dependency 2024-08-29 10:41:41 +02:00
Miriam Baglioni 0a2c28c620 [SKGIF-v1.1] minor 2024-08-14 16:55:43 +02:00
7 changed files with 16 additions and 24 deletions

View File

@ -11,9 +11,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* @Date 01/09/23 * @Date 01/09/23
*/ */
public class Relations implements Serializable { public class Relations implements Serializable {
@JsonProperty("relation_type")
private String relation_type; private String relation_type;
@JsonProperty("product_list")
private List<String> products; private List<String> products;
public static Relations newInstance(String relClass, List<String> target) { public static Relations newInstance(String relClass, List<String> target) {

View File

@ -16,15 +16,15 @@ public class ResearchProduct extends Entity implements Serializable {
private List<Identifier> identifiers; private List<Identifier> identifiers;
private Map<String, List<String>> titles; private Map<String, List<String>> titles;
private Map<String, List<String>> abstracts; private Map<String, List<String>> abstracts;
@JsonProperty("product_type")
private String product_type; private String product_type;
private List<ResultTopic> topics; private List<ResultTopic> topics;
private List<Contribution> contributions; private List<Contribution> contributions;
private List<Manifestation> manifestations; private List<Manifestation> manifestations;
@JsonProperty("relevant_organizations")
private List<String> relevant_organizations; private List<String> relevant_organizations;
private List<String> funding; private List<String> funding;
@JsonProperty("related_products")
private List<Relations> related_products; private List<Relations> related_products;
public ResearchProduct() { public ResearchProduct() {

View File

@ -143,7 +143,7 @@ public class DumpResearchProduct implements Serializable {
(MapFunction<Tuple2<ResearchProduct, ProductsRelation>, ResearchProduct>) t2 -> { (MapFunction<Tuple2<ResearchProduct, ProductsRelation>, ResearchProduct>) t2 -> {
if (t2._2() == null) if (t2._2() == null)
return t2._1(); return t2._1();
t2._1().setRelated_products(t2._2().getRelated_products()); t2._1().setRelated_products(t2._2().getProducts());
return t2._1(); return t2._1();
}, Encoders.bean(ResearchProduct.class)) }, Encoders.bean(ResearchProduct.class))

View File

@ -8,12 +8,9 @@ import java.util.*;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.spark.SparkConf; import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.function.FilterFunction; import org.apache.spark.api.java.function.FilterFunction;
import org.apache.spark.api.java.function.MapFunction; import org.apache.spark.api.java.function.MapFunction;
import org.apache.spark.api.java.function.MapGroupsFunction; import org.apache.spark.api.java.function.MapGroupsFunction;
import org.apache.spark.api.java.function.PairFunction;
import org.apache.spark.sql.*; import org.apache.spark.sql.*;
import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.types.DataTypes; import org.apache.spark.sql.types.DataTypes;
@ -21,18 +18,13 @@ import org.apache.spark.sql.types.StructType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.dhp.application.ArgumentApplicationParser; import eu.dnetlib.dhp.application.ArgumentApplicationParser;
import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.ExtendingOrganization; import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.ExtendingOrganization;
import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.GrantRelation; import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.GrantRelation;
import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.ProductsRelation; import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.ProductsRelation;
import eu.dnetlib.dhp.oa.graph.dump.skgif.beans.RelationPerProduct;
import eu.dnetlib.dhp.schema.oaf.*; import eu.dnetlib.dhp.schema.oaf.*;
import eu.dnetlib.dhp.schema.oaf.Organization; import eu.dnetlib.dhp.schema.oaf.Organization;
import eu.dnetlib.dhp.skgif.model.*; import eu.dnetlib.dhp.skgif.model.*;
import scala.Tuple2;
import scala.Tuple5;
/** /**
* @author miriam.baglioni * @author miriam.baglioni
@ -183,7 +175,7 @@ public class SelectRelation implements Serializable {
} }
private static void addResulRelations(ProductsRelation pr, Iterator<Row> v) { private static void addResulRelations(ProductsRelation pr, Iterator<Row> v) {
pr.setRelated_products(new ArrayList<>()); pr.setProducts(new ArrayList<>());
Map<String, ArrayList<String>> hashMap = new HashMap<>(); Map<String, ArrayList<String>> hashMap = new HashMap<>();
while (v.hasNext()) { while (v.hasNext()) {
Row next = v.next(); Row next = v.next();
@ -196,7 +188,7 @@ public class SelectRelation implements Serializable {
hashMap hashMap
.keySet() .keySet()
.stream() .stream()
.forEach(key -> pr.getRelated_products().add(Relations.newInstance(key, hashMap.get(key)))); .forEach(key -> pr.getProducts().add(Relations.newInstance(key, hashMap.get(key))));
} }
private static String convertToSkgIFSem(String sem) { private static String convertToSkgIFSem(String sem) {

View File

@ -12,7 +12,7 @@ import eu.dnetlib.dhp.skgif.model.Relations;
*/ */
public class ProductsRelation implements Serializable { public class ProductsRelation implements Serializable {
private String resultId; private String resultId;
private java.util.List<Relations> related_products; private java.util.List<Relations> products;
public String getResultId() { public String getResultId() {
return resultId; return resultId;
@ -22,11 +22,11 @@ public class ProductsRelation implements Serializable {
this.resultId = resultId; this.resultId = resultId;
} }
public List<Relations> getRelated_products() { public List<Relations> getProducts() {
return related_products; return products;
} }
public void setRelated_products(List<Relations> related_products) { public void setProducts(List<Relations> products) {
this.related_products = related_products; this.products = products;
} }
} }

View File

@ -272,9 +272,9 @@
<jar>dump-${projectVersion}.jar</jar> <jar>dump-${projectVersion}.jar</jar>
<spark-opts> <spark-opts>
--executor-cores=4 --executor-cores=4
--executor-memory=5G --executor-memory=6G
--driver-memory=${sparkDriverMemory} --driver-memory=${sparkDriverMemory}
--conf spark.executor.memoryOverhead=5G --conf spark.executor.memoryOverhead=6G
--conf spark.extraListeners=${spark2ExtraListeners} --conf spark.extraListeners=${spark2ExtraListeners}
--conf spark.sql.queryExecutionListeners=${spark2SqlQueryExecutionListeners} --conf spark.sql.queryExecutionListeners=${spark2SqlQueryExecutionListeners}
--conf spark.yarn.historyServer.address=${spark2YarnHistoryServerAddress} --conf spark.yarn.historyServer.address=${spark2YarnHistoryServerAddress}

View File

@ -103,7 +103,7 @@
<junit-jupiter.version>5.6.1</junit-jupiter.version> <junit-jupiter.version>5.6.1</junit-jupiter.version>
<dhp.commons.lang.version>3.5</dhp.commons.lang.version> <dhp.commons.lang.version>3.5</dhp.commons.lang.version>
<dhp.guava.version>11.0.2</dhp.guava.version> <dhp.guava.version>11.0.2</dhp.guava.version>
<dhp-schemas.version>[6.1.1]</dhp-schemas.version> <dhp-schemas.version>[6.1.3]</dhp-schemas.version>
</properties> </properties>
</project> </project>