NodeSet context, String sortExpr)
NodeSet contextSet, String sortExpr)
	protected ResourceSet doQuery(String query, DocumentSet docs, 		NodeSet context, String sortExpr)		throws XMLDBException {		try {			XPathLexer lexer = new XPathLexer(new StringReader(query));			XPathParser parser = new XPathParser(brokerPool, user, lexer);			PathExpr expr = new PathExpr(brokerPool);			parser.expr(expr);			LOG.info("query: " + expr.pprint());			long start = System.currentTimeMillis();			if (parser.foundErrors())				throw new XMLDBException(ErrorCodes.VENDOR_ERROR, parser.getErrorMsg());			Value resultValue = null;			docs = (docs == null ? expr.preselect() : expr.preselect(docs));			if (docs.getLength() == 0)				resultValue = new ValueNodeSet(NodeSet.EMPTY_SET);			else 				resultValue = expr.eval(docs, context, null);			LOG.info(				expr.pprint()					+ " found: "					+ resultValue.getLength()					+ " in "					+ (System.currentTimeMillis() - start)					+ "ms.");			LocalResourceSet result =				new LocalResourceSet(					user,					brokerPool,					collection,					resultValue,					properties,					sortExpr);			return result;		} catch (antlr.RecognitionException re) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, re.getMessage(), re);		} catch (antlr.TokenStreamException te) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, te.getMessage(), te);		} catch (PermissionDeniedException e) {			throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, e.getMessage(), e);		} catch (EXistException e) {			throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);		}	}