Search in sources :

Example 6 with ExportConfig

use of apoc.export.util.ExportConfig in project neo4j-apoc-procedures by neo4j-contrib.

the class ExportCypher method graph.

@Procedure
@Description("apoc.export.cypher.graph(graph,file,config) - exports given graph object incl. indexes as cypher statements to the provided file")
public Stream<DataProgressInfo> graph(@Name("graph") Map<String, Object> graph, @Name(value = "file", defaultValue = "") String fileName, @Name(value = "config", defaultValue = "{}") Map<String, Object> config) throws IOException {
    if (Util.isNullOrEmpty(fileName))
        fileName = null;
    Collection<Node> nodes = (Collection<Node>) graph.get("nodes");
    Collection<Relationship> rels = (Collection<Relationship>) graph.get("relationships");
    String source = String.format("graph: nodes(%d), rels(%d)", nodes.size(), rels.size());
    return exportCypher(fileName, source, new NodesAndRelsSubGraph(db, nodes, rels), new ExportConfig(config), false);
}
Also used : ExportConfig(apoc.export.util.ExportConfig) Node(org.neo4j.graphdb.Node) Relationship(org.neo4j.graphdb.Relationship) NodesAndRelsSubGraph(apoc.export.util.NodesAndRelsSubGraph)

Aggregations

ExportConfig (apoc.export.util.ExportConfig)6 NodesAndRelsSubGraph (apoc.export.util.NodesAndRelsSubGraph)5 DatabaseSubGraph (org.neo4j.cypher.export.DatabaseSubGraph)3 SubGraph (org.neo4j.cypher.export.SubGraph)3 Result (org.neo4j.graphdb.Result)3 ProgressReporter (apoc.export.util.ProgressReporter)2 ProgressInfo (apoc.result.ProgressInfo)2 CypherResultSubGraph (org.neo4j.cypher.export.CypherResultSubGraph)2 Node (org.neo4j.graphdb.Node)2 Relationship (org.neo4j.graphdb.Relationship)2 FileUtils.getPrintWriter (apoc.util.FileUtils.getPrintWriter)1 PrintWriter (java.io.PrintWriter)1 Collection (java.util.Collection)1