broker = brokerPool.get(user);
final DocumentImpl resource = broker.getResource(new XmldbURI(uri), Permission.READ | Permission.EXECUTE);
if(resource == null) {
throw new XMLDBException(ErrorCodes.INVALID_URI, "No stored XQuery exists at: " + uri);
}
final Source xquerySource = new DBSource(broker, (BinaryDocument)resource, false);
return execute(xquerySource);
} catch(final EXistException ee) {
throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ee.getMessage(), ee);
} catch(final PermissionDeniedException pde) {
throw new XMLDBException(ErrorCodes.VENDOR_ERROR, pde.getMessage(), pde);