Package org.neo4j.cypherdsl

Examples of org.neo4j.cypherdsl.CypherQuery


public class CypherQueryTest2 extends AbstractCypherTest
{
    @Test
    public void testDSL()
    {
        assertQueryEquals( CYPHER + "START john=node(0) RETURN john", new CypherQuery()
        {{
                starts( nodesById( "john", 0 ) ).returns( identifier( "john" ) );
            }}.toString() );

        assertQueryEquals( CYPHER + "START john=node(0) MATCH r=(john)-[:KNOWS*1..3]->(x) RETURN x", new CypherQuery()
        {{
                starts( nodesById( "john", 0 ) ).
                        match( path( "r", node( "john" )
                                .out( "KNOWS" )
                                .hops( 1, 3 )
                                .node( "x" ) ) ).
                        returns( identifier( "x" ) );
            }}.toString() );

        assertQueryEquals( CYPHER + "START n=node(3,1) WHERE (n.age<30 and n.name=\"Tobias\") or not(n" +
                ".name=\"Tobias\") RETURN n", new CypherQuery()
        {{
                starts( nodesById( "n", 3, 1 ) ).
                        where( identifier( "n" ).property( "age" ).lt( 30 ).and( identifier( "n" ).string( "name" )
                                .eq( "Tobias" ) )
                                .or( not( identifier( "n" ).string( "name" ).eq( "Tobias" ) ) ) ).
View Full Code Here


    @Test
    public void testAndOrPrecedence()
    {
        assertQueryEquals( CYPHER + "START n=node(1) WHERE n.value=0 and (n.title=\"ololo\" or n.value=1) RETURN n",
                new CypherQuery()
                {{
                        starts( nodesById( "n", 1 ) ).
                                where( identifier( "n" ).number( "value" ).eq( 0 )
                                        .and( identifier( "n" ).string( "title" ).eq( "ololo" ).or( identifier( "n" )
                                                .number( "value" ).eq( 1 ) ) ) ).
View Full Code Here

    @Test
    public void testLabel()
    {
        assertQueryEquals( CYPHER + "CREATE (n:Person:Swedish)",
                new CypherQuery()
                {{
                        creates( node("n").labels( label("Person"), label("Swedish") ) );
                    }}.toString() );
    }
View Full Code Here

TOP

Related Classes of org.neo4j.cypherdsl.CypherQuery

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.