Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
eval one result
public static EvalResultIterator eval(String functionCall) throws TestEvalException {
String imports =
"import module namespace sem = 'http://marklogic.com/semantics' at '/MarkLogic/semantics.xqy';\n";
ServerEvaluationCall call =
client.newServerEval().xquery(entityServicesImport + functionCall);
EvalResultIterator results = null;
try {
results = call.eval();
} catch (FailedRequestException e) {
throw new TestEvalException(e);
}
return results;
}
protected static <T extends AbstractReadHandle> T evalOneResult(String functionCall, T handle) throws TestEvalException {
EvalResultIterator results = eval(functionCall);
EvalResult result = null;
if (results.hasNext()) {
result = results.next();
return result.get(handle);
} else {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment