From eae10c58943a6c0d7797facb69531dc442ae5b30 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 13 Jul 2021 18:07:25 +0200 Subject: [PATCH] modification to allow the dump for a single community --- .../oa/graph/dump/QueryInformationSystem.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java index fe40369250..d1f295fcf6 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/QueryInformationSystem.java @@ -17,7 +17,7 @@ public class QueryInformationSystem { private ISLookUpService isLookUp; - private static final String XQUERY = "for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') " + private static final String XQUERY_ALL = "for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') " + " where $x//CONFIGURATION/context[./@type='community' or ./@type='ri'] " + " and ($x//context/param[./@name = 'status']/text() = 'all') " @@ -28,9 +28,22 @@ public class QueryInformationSystem { "{$x//CONFIGURATION/context/@label}" + ""; - public CommunityMap getCommunityMap() + private static final String XQUERY_CI = "for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') " + + + " where $x//CONFIGURATION/context[./@type='community' or ./@type='ri'] " + + " and $x//CONFIGURATION/context[./@id=%s] " + + + " return " + + " " + + "{$x//CONFIGURATION/context/@id}" + + "{$x//CONFIGURATION/context/@label}" + + ""; + + public CommunityMap getCommunityMap(boolean singleCommunity, String community_id) throws ISLookUpException, DocumentException { - return getMap(isLookUp.quickSearchProfile(XQUERY)); + if (singleCommunity) + return getMap(isLookUp.quickSearchProfile(XQUERY_CI.replace("%s", "'" + community_id + "'"))); + return getMap(isLookUp.quickSearchProfile(XQUERY_ALL)); }