From 6c2223d1fc8e188b2b11c56d17bbca1eb48ed934 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Fri, 24 Jul 2020 17:30:15 +0200 Subject: [PATCH] added code to get the openaire id for contexts --- .../java/eu/dnetlib/dhp/oa/graph/dump/Utils.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Utils.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Utils.java index 3e800175a..9ab99a202 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Utils.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Utils.java @@ -1,8 +1,6 @@ package eu.dnetlib.dhp.oa.graph.dump; -import eu.dnetlib.dhp.utils.ISLookupClientFactory; -import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; import org.apache.spark.api.java.function.MapFunction; import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Encoders; @@ -11,6 +9,10 @@ import org.apache.spark.sql.SparkSession; import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.dhp.common.HdfsSupport; +import eu.dnetlib.dhp.schema.dump.oaf.graph.Constants; +import eu.dnetlib.dhp.utils.DHPUtils; +import eu.dnetlib.dhp.utils.ISLookupClientFactory; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; public class Utils { public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -30,4 +32,12 @@ public class Utils { public static ISLookUpService getIsLookUpService(String isLookUpUrl) { return ISLookupClientFactory.getLookUpService(isLookUpUrl); } + + public static String getContextId(String id) { + + return String + .format( + "%s|%s::%s", eu.dnetlib.dhp.schema.dump.oaf.graph.Constants.CONTEXT_ID, Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5(id)); + } }