Search in sources :

Example 1 with GraphResult

use of org.apache.zeppelin.interpreter.graph.GraphResult in project zeppelin by apache.

the class Neo4jCypherInterpreter method renderGraph.

private InterpreterResult renderGraph(Set<Node> nodes, Set<Relationship> relationships) {
    LOGGER.info("Executing renderGraph method");
    List<org.apache.zeppelin.tabledata.Node> nodesList = new ArrayList<>();
    List<org.apache.zeppelin.tabledata.Relationship> relsList = new ArrayList<>();
    for (Relationship rel : relationships) {
        relsList.add(Neo4jConversionUtils.toZeppelinRelationship(rel));
    }
    Map<String, String> labels = getLabels(true);
    for (Node node : nodes) {
        nodesList.add(Neo4jConversionUtils.toZeppelinNode(node, labels));
    }
    return new GraphResult(Code.SUCCESS, new GraphResult.Graph(nodesList, relsList, labels, getTypes(true), true));
}
Also used : GraphResult(org.apache.zeppelin.interpreter.graph.GraphResult) Node(org.neo4j.driver.types.Node) Relationship(org.neo4j.driver.types.Relationship) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 GraphResult (org.apache.zeppelin.interpreter.graph.GraphResult)1 Node (org.neo4j.driver.types.Node)1 Relationship (org.neo4j.driver.types.Relationship)1