diff --git a/.classpath b/.classpath index 534b5e5..5e8a55f 100644 --- a/.classpath +++ b/.classpath @@ -6,23 +6,14 @@ - - - - - + - - - - - - + diff --git a/src/main/java/org/gcube/resources/discovery/client/queries/impl/QueryTemplate.java b/src/main/java/org/gcube/resources/discovery/client/queries/impl/QueryTemplate.java index 7a3f27e..7da24b4 100644 --- a/src/main/java/org/gcube/resources/discovery/client/queries/impl/QueryTemplate.java +++ b/src/main/java/org/gcube/resources/discovery/client/queries/impl/QueryTemplate.java @@ -38,6 +38,7 @@ public class QueryTemplate extends QueryBox implements Query { public static final String DEFAULT = "def"; + public static final String STATEMENT = "statement"; private static final XMLInputFactory xmlif = XMLInputFactory.newInstance(); @@ -157,9 +158,14 @@ public class QueryTemplate extends QueryBox implements Query { if (name.equals(wrapper)) break; - if (parameters.containsKey(name)) + if (parameters.containsKey(name)) { + String statement =xmlr.getAttributeValue(null,STATEMENT); + if (statement != null) { + builder.append(statement).append(" "); + } builder.append(parameters.get(name)); - else { + + }else { // is there a default value? String def = xmlr.getAttributeValue(null,DEFAULT); if (def != null) diff --git a/src/main/java/org/gcube/resources/discovery/client/queries/impl/XQuery.java b/src/main/java/org/gcube/resources/discovery/client/queries/impl/XQuery.java index 4760880..634dede 100644 --- a/src/main/java/org/gcube/resources/discovery/client/queries/impl/XQuery.java +++ b/src/main/java/org/gcube/resources/discovery/client/queries/impl/XQuery.java @@ -33,8 +33,8 @@ public class XQuery extends QueryTemplate implements SimpleQuery { public static final String cond = "cond"; public static final String result = "result"; - public static final String template = " for $resource in <" + range + "/> where <" + cond + " " + DEFAULT - + "='$resource'/> return <" + result + " " + DEFAULT + "='$resource'/>"; + public static final String template = " for $resource in <" + range + "/> <" + cond + " "+ STATEMENT +"='where' "+ DEFAULT + + "=''/> return <" + result + " " + DEFAULT + "='$resource'/>"; public XQuery(Map parameters) {// add static parameters