From 0172bab25136b1a3f974c2d66ddee434a712e26f Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 25 Jul 2022 14:16:45 +0200 Subject: [PATCH] [EOSC Context Tagging] refactoring --- .../dhp/bulktag/eosc/SparkEoscBulkTag.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 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 24520ff26..66e0c8af4 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,19 +117,28 @@ 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)) && - !value.getContext().stream().anyMatch(c -> c.getId().equals("eosc"))) { + 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 - .dataInfo( - false, BULKTAG_DATA_INFO_TYPE, true, false, + context + .setDataInfo( + Arrays + .asList( OafMapperUtils - .qualifier( + .dataInfo( + false, BULKTAG_DATA_INFO_TYPE, true, false, + OafMapperUtils + .qualifier( CLASS_ID_DATASOURCE, CLASS_NAME_BULKTAG_DATASOURCE, DNET_PROVENANCE_ACTIONS, DNET_PROVENANCE_ACTIONS), - TAGGING_TRUST))); + TAGGING_TRUST))); value.getContext().add(context); }