git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/information-system/ic-client/1.0@139987 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
81062f433d
commit
8501fde466
|
@ -169,13 +169,7 @@ public class Helper {
|
|||
if (letFound) letPathIndex=letMat.start();
|
||||
}catch(IllegalStateException e){ log.error("error parsing let statement"); throw new MalformedQueryException("error parsing let statement");}
|
||||
|
||||
int indexOfFor = queryFiltered.indexOf("for ");
|
||||
|
||||
String functionContainsDeclaration =" declare namespace functx = \"http://www.functx.com\"; declare function functx:is-value-in-sequence "+
|
||||
" ( $value as xs:anyAtomicType? , $seq as xs:anyAtomicType* ) as xs:boolean { $value = $seq } ; \n";
|
||||
|
||||
queryFiltered = queryFiltered.substring(0,indexOfFor)+functionContainsDeclaration+queryFiltered.substring(indexOfFor);
|
||||
|
||||
|
||||
if (!letFound) {
|
||||
queryFiltered=queryFiltered.substring(0,wherePathIndex)+forInsertFinal +queryFiltered.substring(wherePathIndex);
|
||||
}
|
||||
|
@ -187,6 +181,21 @@ public class Helper {
|
|||
queryFiltered = queryFiltered.replace(entry.getKey(), entry.getValue());
|
||||
|
||||
|
||||
String functionContainsDeclaration =" declare namespace functx = \"http://www.functx.com\"; declare function functx:is-value-in-sequence "+
|
||||
" ( $value as xs:anyAtomicType? , $seq as xs:anyAtomicType* ) as xs:boolean { $value = $seq } ; \n";
|
||||
|
||||
Pattern declarePattern=Pattern.compile("(declare namespace .*;)*", Pattern.DOTALL);
|
||||
Matcher declareMat=declarePattern.matcher(queryFiltered);
|
||||
|
||||
boolean declareFound = declareMat.find(0);
|
||||
int declareIndex = 0;
|
||||
if (declareFound){
|
||||
declareIndex = declareMat.end();
|
||||
queryFiltered = queryFiltered.substring(0, declareIndex)+functionContainsDeclaration+queryFiltered.substring(declareIndex);
|
||||
} else
|
||||
queryFiltered= functionContainsDeclaration +queryFiltered;
|
||||
|
||||
|
||||
log.trace("submitting filtered query: {}",queryFiltered);
|
||||
return queryFiltered;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue