Package org.neo4j.cypher.javacompat

Examples of org.neo4j.cypher.javacompat.ExecutionEngine


    @Before
    public void setUp() {
        database = new TestGraphDatabaseFactory().newImpermanentDatabase();

        new ExecutionEngine(database).execute("CREATE " +
                "(m:Employee {name:'Michal'})-[:WORKS_FOR {role:'Director', since:2013}]->(ga:Company {name:'GraphAware', form:'Ltd'})," +
                "(v:Intern {name:'Vojta', age:25})-[:WORKS_FOR {since:2014, until:2014}]->(ga)," +
                "(m)-[:LIVES_IN]->(l:Place {name:'London'})<-[:LIVES_IN]-(v)"
        );
    }
View Full Code Here


        }
    }

    @Test
    public void totalFriendshipStrengthShouldBeCorrectlyCalculated() {
        new ExecutionEngine(database).execute("CREATE " +
                "(p1:Person)-[:FRIEND_OF {strength:2}]->(p2:Person)," +
                "(p1)-[:FRIEND_OF {strength:1}]->(p3:Person)");

        try (Transaction tx = database.beginTx()) {
            assertEquals(3, new FriendshipStrengthCounter(database).getTotalFriendshipStrength());
View Full Code Here

        }
    }

    @Test
    public void totalFriendshipStrengthShouldBeCorrectlyCalculated() {
        new ExecutionEngine(database).execute("CREATE " +
                "(p1:Person)-[:FRIEND_OF {strength:2}]->(p2:Person)," +
                "(p1)-[:FRIEND_OF {strength:1}]->(p3:Person)");

        try (Transaction tx = database.beginTx()) {
            assertEquals(3, new FriendshipStrengthCounter(database).getTotalFriendshipStrength());
View Full Code Here

        assertEquals(8L, getTotalFriendshipStrength(database));
    }

    @Test
    public void totalFriendshipStrengthShouldBeCountedUsingCypher() {
        ExecutionEngine executionEngine = new ExecutionEngine(database);

        executionEngine.execute("CREATE " +
                "(p1:Person), (p2:Person), (p3:Person)," +
                "(p1)-[:FRIEND_OF {strength:3}]->(p2)," +
                "(p2)-[:FRIEND_OF {strength:1}]->(p1)," +
                "(p1)-[:FRIEND_OF {strength:2}]->(p3)");

        String query = "MATCH (c:FriendshipCounter) RETURN c.totalFriendshipStrength as result";

        for (Map<String, Object> result : executionEngine.execute(query)) {
            assertEquals(6L, result.get("result"));
        }

        executionEngine.execute("MATCH (p1:Person)-[f:FRIEND_OF {strength:3}]->(p2) DELETE f");

        for (Map<String, Object> result : executionEngine.execute(query)) {
            assertEquals(3L, result.get("result"));
        }
    }
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

    }

    @Test
    public void shouldDeleteNodeWithAllRelationships() {
        database = new TestGraphDatabaseFactory().newImpermanentDatabase();
        new ExecutionEngine(database).execute("CREATE " +
                "(a), " +
                "(b {name:'node1'})," +
                "(c {name:'node2'})," +
                "(c)-[:test {key1:'value1'}]->(b)," +
                "(c)-[:test {key1:'value1'}]->(a)");
View Full Code Here

* Test for {@link com.graphaware.test.unit.GraphUnit} when Runtime is present.
*/
public class GraphUnitTest extends DatabaseIntegrationTest {

    private void populateDatabase(String cypher) {
        new ExecutionEngine(getDatabase()).execute(cypher);
    }
View Full Code Here

    private ExecutionEngine executionEngine;

    @Before
    public void setUp() {
        database = new TestGraphDatabaseFactory().newImpermanentDatabase();
        executionEngine = new ExecutionEngine(database);
    }
View Full Code Here

    private CapturingTransactionEventHandler eventHandler;

    @Before
    public void setUp() {
        database = new TestGraphDatabaseFactory().newImpermanentDatabase();
        executionEngine = new ExecutionEngine(database);
        eventHandler = new CapturingTransactionEventHandler();
        database.registerTransactionEventHandler(eventHandler);
    }
View Full Code Here

    private ResultConverter resultConverter;
    private final QueryParameterConverter queryParameterConverter = new QueryParameterConverter();

    public CypherQueryEngineImpl(GraphDatabaseService graphDatabaseService, ResultConverter resultConverter) {
        this.resultConverter = resultConverter != null ? resultConverter : new DefaultConverter();
        this.executionEngine = new ExecutionEngine(graphDatabaseService);
    }
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.