From 144c103b672c3165f8af4bc27f5515f620b3c7d2 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 25 Jul 2022 13:52:45 +0200 Subject: [PATCH] [EOSC Context Tagging] add check to avoid the insertion of the context if already present --- .../java/eu/dnetlib/dhp/bulktag/eosc/SparkEoscBulkTag.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/eosc/SparkEoscBulkTag.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/eosc/SparkEoscBulkTag.java index 99ff92223..24520ff26 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/eosc/SparkEoscBulkTag.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/eosc/SparkEoscBulkTag.java @@ -117,8 +117,9 @@ public class SparkEoscBulkTag implements Serializable { } private static R enrich(R value, List hostedByList) { - if (value.getInstance().stream().anyMatch(i -> hostedByList.contains(i.getHostedby().getKey())) || - (value.getEoscifguidelines() != null && value.getEoscifguidelines().size() > 0)) { + if (value.getInstance().stream().anyMatch(i -> (hostedByList.contains(i.getHostedby().getKey())) || + (value.getEoscifguidelines() != null && value.getEoscifguidelines().size() > 0)) && + !value.getContext().stream().anyMatch(c -> c.getId().equals("eosc"))) { Context context = new Context(); context.setId("eosc"); context.setDataInfo(Arrays.asList(OafMapperUtils