Package org.neo4j.cypher.javacompat

Examples of org.neo4j.cypher.javacompat.ExecutionEngine


        return executeQuery(db, name, "MERGE (ref:ReferenceNode {name:{name}}) RETURN ref");
    }

    private static Node executeQuery(GraphDatabaseService db, String name, String query) {
        if (engine == null || db != dbRef) {
            engine = new ExecutionEngine(db);
            dbRef = db;
        }

        ExecutionResult result = engine.execute(query, map("name", name));
        return IteratorUtil.single(result.<Node>columnAs("ref"));
View Full Code Here


    private GraphDatabaseService database;

    @Before
    public void setUp() {
        database = new TestGraphDatabaseFactory().newImpermanentDatabase();
        new ExecutionEngine(database).execute("CREATE " +
                "(a), " +
                "(b {key:'value'})," +
                "(b)-[:test]->(a)," +
                "(c {key:'value'})");
    }
View Full Code Here

    return relationship.getType().name();
  }
  public Result query(final GraphDatabaseService graphDb, final String query, final Map<String, Object> params) {
    ArrayList<Object[]> results = new ArrayList<>();
    ArrayList<String> columnNames = new ArrayList<>();
    ExecutionEngine engine = new ExecutionEngine(graphDb);
    ExecutionResult result = engine.execute(query, params);

    Boolean firstRow = true;
    for(Map<String, Object> row : result) {
      ArrayList<Object> rowResult = new ArrayList<>();
      for(Map.Entry<String, Object> column : row.entrySet()) {
View Full Code Here

                Iterator<Map<String, Object>> iterator = null;
                List<String> columns = new ArrayList<String>();
                //
                if ( currentAlias.getConnectionMode() != ConnectionMode.REMOTE )
                {
                    ExecutionEngine engine = new ExecutionEngine( graphDb );
                    ExecutionResult result = engine.execute( cypherQuery );
                    // message = result.toString().substring( result.toString().lastIndexOf( "+" ) + 1 ).trim();
                    columns = result.columns();
                    iterator = result.iterator();
                }
                else if ( currentAlias.getConnectionMode() == ConnectionMode.REMOTE )
View Full Code Here

  private T deserialize( @Nonnull AbstractNeo4jSerializer<T> serializer, @Nonnull String serialized ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    //Fill the db initially
    try ( Transaction tx = db.beginTx() ) {
      ExecutionResult result = new ExecutionEngine( db ).execute( serialized );
      tx.success();
    }

    try ( Transaction tx = db.beginTx() ) {
      return serializer.deserialize( db.getNodeById( 0 ) );
View Full Code Here

  private T deserialize( @Nonnull AbstractNeo4jSerializer<T> serializer, @Nonnull String serialized ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    //Fill the db initially
    try ( Transaction tx = db.beginTx() ) {
      ExecutionResult result = new ExecutionEngine( db ).execute( serialized );
      tx.success();
    }

    try ( Transaction tx = db.beginTx() ) {
      return serializer.deserialize( db.getNodeById( 0 ) );
View Full Code Here

    }

    @Test
    public void testExecutionEngine() throws Exception {
        GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
        ExecutionEngine engine = new ExecutionEngine(db);
        long time = System.currentTimeMillis();
        Map<String, Object> params = map("i", null);
        Map.Entry<String, Object> entry = params.entrySet().iterator().next();
        for (int i=1;i<1_000_000;i++) {
            entry.setValue(i);
            engine.execute("return {i}",params);
            if (i % 50_000 == 0) {
                System.out.println("commit " + i + " " + (System.currentTimeMillis() - time) + " ms since start");
            }
        }
        time = System.currentTimeMillis() - time;
View Full Code Here

    private final GraphDatabaseService db;
    private final ExecutionEngine executionEngine;

    public CypherFormat(GraphDatabaseService db) {
        this.db = db;
        executionEngine = new ExecutionEngine(db);
    }
View Full Code Here

                "Quoted Strings in file" ) );
    }

    private ExecutionEngine engine;
    protected ExecutionEngine getEngine() {
        if (engine==null) engine=new ExecutionEngine(getServer().getDb(), StringLogger.SYSTEM);
        return engine;
    }
View Full Code Here

                "Add all nodes of selected relationships" ) );
    }

    private ExecutionEngine engine;
    protected ExecutionEngine getEngine() {
        if (engine==null) engine=new ExecutionEngine(getServer().getDb(), StringLogger.SYSTEM);
        return engine;
    }
View Full Code Here

TOP

Related Classes of org.neo4j.cypher.javacompat.ExecutionEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.