Re: [Neo4j] Cypher DSL and QueryDSL
I like, very cool Rickard! Is this in a doc-able state so we could add a test for the manual in the Cypher section? Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Thu, Nov 3, 2011 at 10:05 PM, Rickard Öberg rickard.ob...@neotechnology.com wrote: Hi, I have made a first stab at integrating the new Cypher DSL with QueryDSL(.com). The first feature is simply being able to use QueryDSL expressions in the WHERE clause. Example: QPerson person = QPerson.person; Assert.assertEquals( START person=node(1,2,3) WHERE person.firstName=\P\ and person.age25 RETURN person, CypherQueryDSL.start( node( person, 1, 2, 3 ) ) .where( person.firstName.eq( P ).and( person.age.gt( 25 ) ) ) .returns( nodes( person ) ) .toString() ); --- QPerson is a generated class from QueryDSL, and comes from a simple Java class Person that has two fields. With that I can then construct the WHERE expression quite easily, as is shown above. And that's about it! Very straightforward. Look at the Cypher DSL in GitHub for example on how to set it up, and what Maven dependencies you need to use it. /Rickard -- Rickard Öberg Developer Neo Technology Twitter: @rickardoberg, Skype: rickardoberg ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Cypher DSL and QueryDSL
On 11/4/11 15:18 , Peter Neubauer wrote: I like, very cool Rickard! Is this in a doc-able state so we could add a test for the manual in the Cypher section? Well, the whole thing is very much subject to change, but it could still be doc'ed to some extent. /Rickard -- Rickard Öberg Developer Neo Technology Twitter: @rickardoberg, Skype: rickardoberg ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Cypher DSL - updates, QueryDSL, mapping
Hi guys, I have continued to work on the Cypher DSL. For reference, have a look here: https://github.com/neo4j/cypher-dsl/blob/master/src/test/java/org/neo4j/cypherdsl/CypherReferenceTest.java The main DSL is starting to stabilize, and it should now be reasonably easy to use. For the design decisions that I posted before, the results are: 1) Statics vs initialization block: both are supported! Examples: assertEquals( START john=node(0) RETURN john, new CypherQuery() {{ starts( node( john, 0 ) ).returns( nodes( john ) ); }}.toString() ); is the same as: starts(node(john, 0)).returns(nodes(john)); In first version there are no static imports, so it's very tab-completion friendly. Second is more compact, but requires static imports for alot. 2) Path syntax. To declare a path for the MATCH clause, it looks like so: .match(path(p).from(x).as(r).optional().out(KNOWS).hops(1,3).to(y) - MATCH p=(x)-[r?:KNOWS*1..3]-(y) So that's that! Have a look at the GitHub class above for more details. I have also started integrating with QueryDSL for expressions and object mapping. I'll post separately about that to make it easier to follow any discussions. /Rickard -- Rickard Öberg Developer Neo Technology Twitter: @rickardoberg, Skype: rickardoberg ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Cypher DSL and QueryDSL
Hi, I have made a first stab at integrating the new Cypher DSL with QueryDSL(.com). The first feature is simply being able to use QueryDSL expressions in the WHERE clause. Example: QPerson person = QPerson.person; Assert.assertEquals( START person=node(1,2,3) WHERE person.firstName=\P\ and person.age25 RETURN person, CypherQueryDSL.start( node( person, 1, 2, 3 ) ) .where( person.firstName.eq( P ).and( person.age.gt( 25 ) ) ) .returns( nodes( person ) ) .toString() ); --- QPerson is a generated class from QueryDSL, and comes from a simple Java class Person that has two fields. With that I can then construct the WHERE expression quite easily, as is shown above. And that's about it! Very straightforward. Look at the Cypher DSL in GitHub for example on how to set it up, and what Maven dependencies you need to use it. /Rickard -- Rickard Öberg Developer Neo Technology Twitter: @rickardoberg, Skype: rickardoberg ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user