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( "n.name" ).eq( "Tobias" )).
or(not(prop("n.name").eq("Tobias" )))).
returns( nodes( "n" ) )

For more, read on at Rickard’s blog.

Cheers,
Andreas




Want to learn more about graph databases? Click below to get your free copy of O’Reilly’s Graph Databases ebook and discover how to use graph technologies for your application today.

Download My Ebook