From af1d40351b99d2865e5aa3bd7e66164a69f46f58 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Mon, 22 Jun 2020 19:20:54 +0200 Subject: [PATCH 1/5] changed XQuery to add also the main Zenodo community among the communities associated to the openaire community --- .../dhp/bulktag/community/QueryInformationSystem.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java index 7ec2f916f..95976f102 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java @@ -17,6 +17,8 @@ public class QueryInformationSystem { + " let $datasources := $x//CONFIGURATION/context/category[./@id=concat($x//CONFIGURATION/context/@id,'::contentproviders')]/concept " + " let $organizations := $x//CONFIGURATION/context/category[./@id=concat($x//CONFIGURATION/context/@id,'::resultorganizations')]/concept " + " let $communities := $x//CONFIGURATION/context/category[./@id=concat($x//CONFIGURATION/context/@id,'::zenodocommunities')]/concept " + + + "let $zenodo := $x//param[./@name='zenodoCommunity']/text() " + " where $x//CONFIGURATION/context[./@type='community' or ./@type='ri'] " + " return " + " " @@ -38,7 +40,14 @@ public class QueryInformationSystem { + " {$d/param[./@name='selcriteria']/text()} " + " " + " } " - + " " + + " " + + "{for $zc in $zenodo " + + "return " + + " " + + " " + + "{$zc} " + + " " + + "}" + " " + " {for $zc in $communities " + " return " From 507f7a94a89aa0309840479ffa481774229067ce Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 23 Jun 2020 08:45:27 +0200 Subject: [PATCH 2/5] added one of the main zenodo communities to the tagging conf for testing purposes --- .../dhp/bulktag/communityconfiguration/tagging_conf.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dhp-workflows/dhp-enrichment/src/test/resources/eu/dnetlib/dhp/bulktag/communityconfiguration/tagging_conf.xml b/dhp-workflows/dhp-enrichment/src/test/resources/eu/dnetlib/dhp/bulktag/communityconfiguration/tagging_conf.xml index a44372e4d..d4c83438b 100644 --- a/dhp-workflows/dhp-enrichment/src/test/resources/eu/dnetlib/dhp/bulktag/communityconfiguration/tagging_conf.xml +++ b/dhp-workflows/dhp-enrichment/src/test/resources/eu/dnetlib/dhp/bulktag/communityconfiguration/tagging_conf.xml @@ -257,6 +257,9 @@ bodhgaya + + oac_dh-ch + From 54a12978d3a293ec79dcbb5f5131797f1675e4bc Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 25 Jun 2020 16:30:20 +0200 Subject: [PATCH 3/5] fixed issue in xquery --- .../dnetlib/dhp/bulktag/community/QueryInformationSystem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java index 95976f102..cb5ad083b 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java @@ -41,6 +41,7 @@ public class QueryInformationSystem { + " " + " } " + " " + + " "+ "{for $zc in $zenodo " + "return " + " " + @@ -48,7 +49,6 @@ public class QueryInformationSystem { "{$zc} " + " " + "}" - + " " + " {for $zc in $communities " + " return " + " " From 4a7de07ea257bf87d6be767af9adb40c7b06356d Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 25 Jun 2020 16:32:40 +0200 Subject: [PATCH 4/5] refactoring --- .../CommunityConfigurationFactory.java | 24 +++++++++---------- .../dhp/bulktag/community/Provider.java | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java index 607315f3f..e3662e04c 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/CommunityConfigurationFactory.java @@ -110,13 +110,13 @@ public class CommunityConfigurationFactory { } private static List parseZenodoCommunities(final Node node) { - final Node oacommunitynode = node.selectSingleNode("./oacommunity"); - String oacommunity = null; - if (oacommunitynode != null) { - String tmp = oacommunitynode.getText(); - if (StringUtils.isNotBlank(tmp)) - oacommunity = tmp; - } +// final Node oacommunitynode = node.selectSingleNode("./oacommunity"); +// String oacommunity = null; +// if (oacommunitynode != null) { +// String tmp = oacommunitynode.getText(); +// if (StringUtils.isNotBlank(tmp)) +// oacommunity = tmp; +// } final List list = node.selectNodes("./zenodocommunities/zenodocommunity"); final List zenodoCommunityList = new ArrayList<>(); @@ -127,11 +127,11 @@ public class CommunityConfigurationFactory { zenodoCommunityList.add(zc); } - if (oacommunity != null) { - ZenodoCommunity zc = new ZenodoCommunity(); - zc.setZenodoCommunityId(oacommunity); - zenodoCommunityList.add(zc); - } +// if (oacommunity != null) { +// ZenodoCommunity zc = new ZenodoCommunity(); +// zc.setZenodoCommunityId(oacommunity); +// zenodoCommunityList.add(zc); +// } log.info("size of the zenodo community list " + zenodoCommunityList.size()); return zenodoCommunityList; } diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Provider.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Provider.java index b9c37f4dc..a9427b594 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Provider.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/Provider.java @@ -44,7 +44,7 @@ public class Provider implements Serializable { } private void setSelCriteria(String json, VerbResolver resolver) { - log.info("Selection constraints for datasource = " + json); + log.debug("Selection constraints for datasource = " + json); selectionConstraints = new Gson().fromJson(json, SelectionConstraints.class); selectionConstraints.setSelection(resolver); @@ -54,7 +54,7 @@ public class Provider implements Serializable { try { setSelCriteria(n.getText(), resolver); } catch (Exception e) { - log.info("not set selection criteria... "); + log.debug("not set selection criteria... "); selectionConstraints = null; } } From faea30cda0fd4ccae91be5d83d34b5427ec528c3 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 9 Jul 2020 14:05:21 +0200 Subject: [PATCH 5/5] - --- .../community/QueryInformationSystem.java | 2 +- .../dhp/bulktag/community/ResultTagger.java | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java index cb5ad083b..6a40bc2e2 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/QueryInformationSystem.java @@ -41,7 +41,7 @@ public class QueryInformationSystem { + " " + " } " + " " + - " "+ + " " + "{for $zc in $zenodo " + "return " + " " + diff --git a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/ResultTagger.java b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/ResultTagger.java index f5a985d15..d58704b75 100644 --- a/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/ResultTagger.java +++ b/dhp-workflows/dhp-enrichment/src/main/java/eu/dnetlib/dhp/bulktag/community/ResultTagger.java @@ -71,10 +71,9 @@ public class ResultTagger implements Serializable { // tagging for Subject final Set subjects = new HashSet<>(); - Optional> oresultsubj = Optional.ofNullable(result.getSubject()); - if (oresultsubj.isPresent()) { - oresultsubj - .get() + + if (Objects.nonNull(result.getSubject())){ + result.getSubject() .stream() .map(subject -> subject.getValue()) .filter(StringUtils::isNotBlank) @@ -90,15 +89,23 @@ public class ResultTagger implements Serializable { final Set datasources = new HashSet<>(); final Set tmp = new HashSet<>(); - Optional> oresultinstance = Optional.ofNullable(result.getInstance()); - if (oresultinstance.isPresent()) { - for (Instance i : oresultinstance.get()) { - tmp.add(StringUtils.substringAfter(i.getCollectedfrom().getKey(), "|")); - tmp.add(StringUtils.substringAfter(i.getHostedby().getKey(), "|")); + if (Objects.nonNull(result.getInstance())) { + for (Instance i : result.getInstance()) { + if(Objects.nonNull(i.getCollectedfrom())){ + if(Objects.nonNull(i.getCollectedfrom().getKey())){ + tmp.add(StringUtils.substringAfter(i.getCollectedfrom().getKey(), "|")); + } + } + if(Objects.nonNull(i.getHostedby())){ + if(Objects.nonNull(i.getHostedby().getKey())){ + tmp.add(StringUtils.substringAfter(i.getHostedby().getKey(), "|")); + } + } + } - oresultinstance - .get() + result + .getInstance() .stream() .map(i -> new Pair<>(i.getCollectedfrom().getKey(), i.getHostedby().getKey())) .flatMap(p -> Stream.of(p.getFst(), p.getSnd()))