Source:
<code>public InterpreterResult interpret(String cypherQuery, InterpreterContext interpreterContext) { logger.info("Opening session"); if (StringUtils.isEmpty(cypherQuery)) { <START> return new InterpreterResult(Code.ERROR, "Cypher query is Empty"); <END> } try { StatementResult result = this.neo4jConnectionManager.execute(cypherQuery, interpreterContext); Set<Node> nodes = new HashSet<>(); Set<Relationship> relationships = new HashSet<>(); List<String> columns = new ArrayList<>(); List<List<String>> lines = new ArrayList<List<String>>(); while (result.hasNext()) { Record record = result.next(); List<Pair<String, Value>> fields = record.fields(); List<String> line = new ArrayList<>(); for (Pair<String, Value> field : fields) { if (field.value().hasType(InternalTypeSystem.TYPE_SYSTEM.NODE())) { nodes.add(field.value().asNode()); } else if (field.value().hasType(InternalTypeSystem.TYPE_SYSTEM.RELATIONSHIP())) { relationships.add(field.value().asRelationship()); } else if (field.value().hasType(InternalTypeSystem.TYPE_SYSTEM.PATH())) { nodes.addAll(Iterables.asList(field.value().asPath().nodes())); relationships.addAll(Iterables.asList(field.value().asPath().relationships())); } else { setTabularResult(field.key(), field.value(), columns, line, InternalTypeSystem.TYPE_SYSTEM); } } if (!line.isEmpty()) { lines.add(line); } } if (!nodes.isEmpty()) { return renderGraph(nodes, relationships); } else { return renderTable(columns, lines); } } catch (Exception e) { logger.error("Exception while interpreting cypher query", e); return new InterpreterResult(Code.ERROR, e.getMessage()); } }</code><technical_language>check other interpeters? preferred do if query is empty, instead of returning error</technical_language>

Target:
public InterpreterResult interpret(String cypherQuery, InterpreterContext interpreterContext) { logger.info("Opening session"); if (StringUtils.isBlank(cypherQuery)) { return new InterpreterResult(Code.SUCCESS); } try { StatementResult result = this.neo4jConnectionManager.execute(cypherQuery, interpreterContext); Set<Node> nodes = new HashSet<>(); Set<Relationship> relationships = new HashSet<>(); List<String> columns = new ArrayList<>(); List<List<String>> lines = new ArrayList<List<String>>(); while (result.hasNext()) { Record record = result.next(); List<Pair<String, Value>> fields = record.fields(); List<String> line = new ArrayList<>(); for (Pair<String, Value> field : fields) { if (field.value().hasType(InternalTypeSystem.TYPE_SYSTEM.NODE())) { nodes.add(field.value().asNode()); } else if (field.value().hasType(InternalTypeSystem.TYPE_SYSTEM.RELATIONSHIP())) { relationships.add(field.value().asRelationship()); } else if (field.value().hasType(InternalTypeSystem.TYPE_SYSTEM.PATH())) { nodes.addAll(Iterables.asList(field.value().asPath().nodes())); relationships.addAll(Iterables.asList(field.value().asPath().relationships())); } else { setTabularResult(field.key(), field.value(), columns, line, InternalTypeSystem.TYPE_SYSTEM); } } if (!line.isEmpty()) { lines.add(line); } } if (!nodes.isEmpty()) { return renderGraph(nodes, relationships); } else { return renderTable(columns, lines); } } catch (Exception e) { logger.error("Exception while interpreting cypher query", e); return new InterpreterResult(Code.ERROR, e.getMessage()); } }