Monday, November 14, 2011

Creating a DSL for Cypher

With Cypher, querying data is like creating Ascii Art to navigate through information. While fun and powerful, sometimes the pesky execution engine doesn’t appreciate the beauty of what you’ve typed. In this blog post, Rickard Öberg presents his implementation of a DSL to safely construct Cypher queries in Java.

For example:
start( node( "n", 3, 1 ) ).
where( prop( "n.age" ).lt( 30 ).and( prop( "" ).eq( "Tobias" )).
       or(not(prop("").eq("Tobias" )))).
returns( nodes( "n" ) )

For more, read on at Rickard's blog.


1 comment:

Anonymous said...

The really interesting thing is how to build native Java "queries" for Neo4J, without any cypher usage at all.