JCypher: Focus on Your Domain Model, Not How to Map It to the Database [Community Post]

JCypher Allows You to Focus on Your Domain Model Instead of Mapping It to the Database

[As community content, this post reflects the views and opinions of the particular author and does not necessarily reflect the official stance of Neo4j.]

Software developers around the world spend a significant amount of their time struggling with database related problems instead of concentrating on the implementation of domain models and business logic.

The idea of orthogonal persistence together with approaches of modern ORMs (Object Relational Mappers) have eased this pain to some degree, but when it comes to performing queries on connected data, there is still no way around hand-crafted design of database structures, almost on a per query basis.

Introducing JCypher

JCypher, utilizing the power of Neo4j graph databases, aims to bring that long-given promise one big step closer to reality.

This Java open source project (hosted on GitHub) allows you to concentrate on your domain model instead of how to map it to a database, at the same time enabling you to execute powerful queries upon your model with high performance.

JCypher provides seamlessly integrated Java access to graph databases (like Neo4j) at different levels of abstraction. Let’s look at those layers from the top down:

Business Domains

At the topmost level of abstraction, JCypher allows you to map complex business domains to graph databases.

You can take an arbitrarily complex graph of domain objects or POJOs (plain old Java objects) and store it in a straightforward way into a graph database for later retrieval. You do not need to modify your domain object classes in any way. You do not even need to add annotations.

Moreover, JCypher provides a default mapping so you don’t have to write a single line of mapping code or mapping configuration.

Domain Queries

At the same level of abstraction, “Domain Queries” provide the power and expressiveness of queries on a graph database, while being formulated on domain objects or on types of domain objects, respectively.

The true power of Domain Queries comes from the fact, that the graph of domain objects is backed by a graph database.

Generic Graph Model

At the next lower level of abstraction – access to graph databases – is provided based on a generic graph model.

While simple, the model allows you to easily navigate and manipulate graphs. The model consists of nodes, relations and paths, together with properties, labels and types.

Native Java Domain-Specific Language

At the bottom level of abstraction, a “native Java DSL” in the form of a fluent Java API allows you to intuitively and comfortably formulate queries against graph databases. The DSL (or Domain Specific Language) is based on the Cypher query language. (The Cypher query language is developed as part of the Neo4j graph database developed by Neo Technology).

The DSL provides all the power and expressiveness of the Cypher language. Hence the name, JCypher.

Additionally, JCypher provides database access in a uniform way to remote as well as to embedded databases (including in-memory databases).

For more information on JCypher, visit the project homepage and GitHub page.

UPCOMING WEBINAR: Converting Tough SQL Queries into Easy Cypher Queries

Register for this week’s webinar on 9 July 2015 at 9:00 a.m. Pacific (18:00 CEST) to learn how to transform non-performing relational queries into efficient Cypher statements or Neo4j extensions and achieve your required response times.