Package org.neo4j.cypher.javacompat

Examples of org.neo4j.cypher.javacompat.ExecutionEngine.execute()


                assertEquals(2, g.V().count().next().intValue());
                assertEquals(0, a.properties().count().next().intValue());
                assertEquals(2, b.properties().count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());
                assertEquals(2l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(0l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(0, StreamFactory.stream(a.getBaseVertex().getPropertyKeys()).count());
                assertEquals(2, StreamFactory.stream(b.getBaseVertex().getPropertyKeys()).count());
            });

            a.singleProperty("name", "the marko", "acl", "private");
View Full Code Here


                assertEquals(1, a.properties("name").count().next().intValue());
                assertEquals(1, b.properties("name").count().next().intValue());
                assertEquals(1, b.properties("location").count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());

                assertEquals(3l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(1l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(1l, cypher.execute("MATCH (a)-[r]->() WHERE id(a) = " + a.id() + " RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                final AtomicInteger counter = new AtomicInteger(0);
                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
View Full Code Here

                assertEquals(1, b.properties("name").count().next().intValue());
                assertEquals(1, b.properties("location").count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());

                assertEquals(3l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(1l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(1l, cypher.execute("MATCH (a)-[r]->() WHERE id(a) = " + a.id() + " RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                final AtomicInteger counter = new AtomicInteger(0);
                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
                    counter.incrementAndGet();
View Full Code Here

                assertEquals(1, b.properties("location").count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());

                assertEquals(3l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(1l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(1l, cypher.execute("MATCH (a)-[r]->() WHERE id(a) = " + a.id() + " RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                final AtomicInteger counter = new AtomicInteger(0);
                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
                    counter.incrementAndGet();
                });
View Full Code Here

                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
                    counter.incrementAndGet();
                });
                assertEquals(1, counter.getAndSet(0));
                cypher.execute("MATCH (a)-[]->(m) WHERE id(a) = " + a.id() + " RETURN labels(m)").forEach(results -> {
                    assertEquals(VertexProperty.DEFAULT_LABEL, ((List<String>) results.get("labels(m)")).get(0));
                    counter.incrementAndGet();
                });
                assertEquals(1, counter.getAndSet(0));
                StreamFactory.stream(a.getBaseVertex().getRelationships(Direction.OUTGOING)).map(Relationship::getEndNode).forEach(node -> {
View Full Code Here

                assertEquals(1, a.properties("name").count().next().intValue());
                assertEquals(1, b.properties("name").count().next().intValue());
                assertEquals(1, b.properties("location").count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());

                assertEquals(3l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(1l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(1l, cypher.execute("MATCH (a)-[r]->() WHERE id(a) = " + a.id() + " RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                final AtomicInteger counter = new AtomicInteger(0);
                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
View Full Code Here

                assertEquals(1, b.properties("name").count().next().intValue());
                assertEquals(1, b.properties("location").count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());

                assertEquals(3l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(1l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(1l, cypher.execute("MATCH (a)-[r]->() WHERE id(a) = " + a.id() + " RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                final AtomicInteger counter = new AtomicInteger(0);
                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
                    counter.incrementAndGet();
View Full Code Here

                assertEquals(1, b.properties("location").count().next().intValue());
                assertEquals(0, g.E().count().next().intValue());

                assertEquals(3l, cypher.execute("MATCH n RETURN COUNT(n)").iterator().next().get("COUNT(n)"));
                assertEquals(1l, cypher.execute("MATCH (n)-[r]->(m) RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                assertEquals(1l, cypher.execute("MATCH (a)-[r]->() WHERE id(a) = " + a.id() + " RETURN COUNT(r)").iterator().next().get("COUNT(r)"));
                final AtomicInteger counter = new AtomicInteger(0);
                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
                    counter.incrementAndGet();
                });
View Full Code Here

                a.getBaseVertex().getRelationships(Direction.OUTGOING).forEach(relationship -> {
                    assertEquals(Neo4jVertexProperty.VERTEX_PROPERTY_PREFIX.concat("name"), relationship.getType().name());
                    counter.incrementAndGet();
                });
                assertEquals(1, counter.getAndSet(0));
                cypher.execute("MATCH (a)-[]->(m) WHERE id(a) = " + a.id() + " RETURN labels(m)").forEach(results -> {
                    assertEquals(VertexProperty.DEFAULT_LABEL, ((List<String>) results.get("labels(m)")).get(0));
                    counter.incrementAndGet();
                });
                assertEquals(1, counter.getAndSet(0));
                StreamFactory.stream(a.getBaseVertex().getRelationships(Direction.OUTGOING)).map(Relationship::getEndNode).forEach(node -> {
View Full Code Here

        final Neo4jGraph graph = (Neo4jGraph) traversal.sideEffects().getGraph();
        final ExecutionEngine cypher = Neo4jHelper.getCypher(graph);
        this.setFunction(traverser -> {
            final S s = traverser.get();
            parameters.put(START, s);
            final ExecutionResult result = cypher.execute(query, parameters);
            final ResourceIterator<Map<String, Object>> itty = result.iterator();
            return itty.hasNext() ? new Neo4jCypherIterator(itty, graph) : Collections.emptyIterator();
        });
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.