Cypher { @Procedure(mode = WRITE) @Description("apoc.cypher.runMany('cypher;\\nstatements;',{params},[{statistics:true,timeout:10}]) - runs each semicolon separated statement and returns summary - currently no schema operations") public Stream<RowResult> runMany(@Name("cypher") String cypher, @Name("params") Map<String,Object> params, @Name(value = "config",defaultValue = "{}") Map<String,Object> config) { boolean addStatistics = Util.toBoolean(config.getOrDefault("statistics",true)); int timeout = Util.toInteger(config.getOrDefault("timeout",1)); int queueCapacity = Util.toInteger(config.getOrDefault("queueCapacity",100)); StringReader stringReader = new StringReader(cypher); return runManyStatements(stringReader ,params, false, addStatistics, timeout, queueCapacity); }  @Procedure @Description("apoc.cypher.run(fragment, params) yield value - executes reading fragment with the given parameters - currently no schema operations") Stream<MapResult> run(@Name("cypher") String statement, @Name("params") Map<String, Object> params); static Stream<MapResult> runCypherQuery(Transaction tx, @Name("cypher") String statement, @Name("params") Map<String, Object> params); @Procedure(mode = WRITE) @Description("apoc.cypher.runMany('cypher;\\nstatements;',{params},[{statistics:true,timeout:10}]) - runs each semicolon separated statement and returns summary - currently no schema operations") Stream<RowResult> runMany(@Name("cypher") String cypher, @Name("params") Map<String,Object> params, @Name(value = "config",defaultValue = "{}") Map<String,Object> config); static String withParamMapping(String fragment, Collection<String> keys); @Procedure(mode = WRITE) @Description("apoc.cypher.doIt(fragment, params) yield value - executes writing fragment with the given parameters") Stream<MapResult> doIt(@Name("cypher") String statement, @Name("params") Map<String, Object> params); @Procedure("apoc.when") @Description("apoc.when(condition, ifQuery, elseQuery:'', params:{}) yield value - based on the conditional, executes read-only ifQuery or elseQuery with the given parameters") Stream<MapResult> when(@Name("condition") boolean condition, @Name("ifQuery") String ifQuery, @Name(value="elseQuery", defaultValue = "") String elseQuery, @Name(value="params", defaultValue = "{}") Map<String, Object> params); @Procedure(value="apoc.do.when", mode = Mode.WRITE) @Description("apoc.do.when(condition, ifQuery, elseQuery:'', params:{}) yield value - based on the conditional, executes writing ifQuery or elseQuery with the given parameters") Stream<MapResult> doWhen(@Name("condition") boolean condition, @Name("ifQuery") String ifQuery, @Name(value="elseQuery", defaultValue = "") String elseQuery, @Name(value="params", defaultValue = "{}") Map<String, Object> params); @Procedure("apoc.case") @Description("apoc.case([condition, query, condition, query, ...], elseQuery:'', params:{}) yield value - given a list of conditional / read-only query pairs, executes the query associated with the first conditional evaluating to true (or the else query if none are true) with the given parameters") Stream<MapResult> whenCase(@Name("conditionals") List<Object> conditionals, @Name(value="elseQuery", defaultValue = "") String elseQuery, @Name(value="params", defaultValue = "{}") Map<String, Object> params); @Procedure(value="apoc.do.case", mode = Mode.WRITE) @Description("apoc.do.case([condition, query, condition, query, ...], elseQuery:'', params:{}) yield value - given a list of conditional / writing query pairs, executes the query associated with the first conditional evaluating to true (or the else query if none are true) with the given parameters") Stream<MapResult> doWhenCase(@Name("conditionals") List<Object> conditionals, @Name(value="elseQuery", defaultValue = "") String elseQuery, @Name(value="params", defaultValue = "{}") Map<String, Object> params); static final String COMPILED_PREFIX; static final int PARTITIONS; static final int MAX_BATCH; @Context
    public Transaction tx; @Context
    public GraphDatabaseService db; @Context
    public Log log; @Context
    public TerminationGuard terminationGuard; @Context
    public Pools pools; }
@Test public void testRunMany() throws Exception { testResult(db, "CALL apoc.cypher.runMany('CREATE (n:Node {name:$name});\nMATCH (n {name:$name}) CREATE (n)-[:X {name:$name2}]->(n);',$params)",map("params",map("name","John","name2","Doe")), r -> { Map<String, Object> row = r.next(); assertEquals(-1L, row.get("row")); Map result = (Map) row.get("result"); assertEquals(1L, toLong(result.get("nodesCreated"))); assertEquals(1L, toLong(result.get("labelsAdded"))); assertEquals(1L, toLong(result.get("propertiesSet"))); row = r.next(); result = (Map) row.get("result"); assertEquals(-1L, row.get("row")); assertEquals(1L, toLong(result.get("relationshipsCreated"))); assertEquals(1L, toLong(result.get("propertiesSet"))); assertEquals(false, r.hasNext()); }); }