@Override public String evaluate(String script) { if (script.trim().equals("")) { return ""; } try { Query query = CypherParser.parseConsole(script); ExecutionResult result = engine.execute(query); return result.toString(); } catch (SyntaxException error) { return error.getMessage(); } catch (Exception exception) { log.error(exception); return "Error: " + exception.getClass().getSimpleName() + " - " + exception.getMessage(); } }
@POST @Path(PATH_GRAPHDB_EXTENSION_METHOD) public Response invokeGraphDatabaseExtension( @PathParam("name") String name, @PathParam("method") String method, String data) { try { return output.ok( this.invokeGraphDatabaseExtension(name, method, input.readParameterList(data))); } catch (BadInputException e) { return output.badRequest(e); } catch (PluginLookupException e) { return output.notFound(e); } catch (BadPluginInvocationException e) { return output.badRequest(e.getCause()); } catch (SyntaxException e) { return output.badRequest(e.getCause()); } catch (PluginInvocationFailureException e) { return output.serverError(e.getCause()); } catch (Exception e) { return output.serverError(e); } }