RepositoryQueryManager queryManager = repository.queryManager();
Set<String> workspaceNames = repoCache.getWorkspaceNames();
Map<String, NodeCache> overridden = null;
NodeTypes nodeTypes = repository.nodeTypeManager().getNodeTypes();
RepositoryIndexes indexDefns = repository.queryManager().getIndexes();
CancellableQuery query = queryManager.query(context, repoCache, workspaceNames, overridden, command, schemata,
indexDefns, nodeTypes, null, null);
try {
QueryResults result = query.execute();
if (result.isEmpty()) return false;
if (result.getRowCount() < 0) {
// Try to get the first row ...
NodeSequence seq = result.getRows();
Batch batch = seq.nextBatch();