= The Neo4j Cypher-DSL :sectanchors:
// tag::properties[] :groupId: org.neo4j :artifactId: neo4j-cypher-dsl
// This will be next version and also the one that will be put into the manual for the main branch :neo4j-cypher-dsl-version: 2024.2.1-SNAPSHOT // This is the latest released version, used only in the readme :neo4j-cypher-dsl-version-latest: 2024.2.0
// end::properties[]
image:https://github.com/neo4j-contrib/cypher-dsl/workflows/build/badge.svg[link=https://github.com/neo4j-contrib/cypher-dsl/actions] image:https://sonarcloud.io/api/project_badges/measure?project=org.neo4j%3Aneo4j-cypher-dsl-parent&metric=coverage[link=https://sonarcloud.io/summary/new_code?id=org.neo4j%3Aneo4j-cypher-dsl-parent] image:https://sonarcloud.io/api/project_badges/measure?project=org.neo4j%3Aneo4j-cypher-dsl-parent&metric=alert_status[link=https://sonarcloud.io/dashboard?id=org.neo4j%3Aneo4j-cypher-dsl-parent] image:https://maven-badges.herokuapp.com/maven-central/org.neo4j/neo4j-cypher-dsl/badge.svg[Maven Central,link=http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.neo4j%22%20AND%20a%3A%22neo4j-cypher-dsl%22]
The primary goal of this project is to have a type safe way of creating Cypher queries targeted at https://neo4j.com[Neo4j 4.0+]. Most of the constructs used here are modelled after https://www.opencypher.org[openCypher], but we include several constructs specific to Neo4j.
The core module of the Neo4j Cypher-DSL has no required runtime dependencies.
== Versioning
This rebooted version of the Neo4j Cypher-DSL uses https://calver.org[CalVer] in the same way Spring does since early 2020 (see https://spring.io/blog/2020/04/30/updates-to-spring-versions[Updates to Spring Versions]), starting at 2020.0.0.
The year digit is treated in a semver fashion for the core module. That means that you won't experience any breaking changes when staying in a release line. However, the first or the latest release in a given year does not necessarily reflect the current calendar year. It's kind of a trade-off, but one that we think is valuable, otherwise we would need to postpone the first release in a year until we need todo some breaking changes.
== Manual
For a gentle introduction and some getting started guides, please use our https://neo4j.github.io/cypher-dsl[Manual].
== Getting Started
=== Adding the necessary dependencies
First, include the dependency to the Neo4j Cypher-DSL under the following coordinates: {groupId}:{artifactId}
:
==== Maven configuration
==== Gradle configuration
=== A simple example
With the Cypher-DSL, you can build your queries starting with the static methods provided through org.neo4j.cypherdsl.core.Cypher
.
Static imports for those packages should be allowed:
import static org.neo4j.cypherdsl.core.Cypher.*;
import org.neo4j.cypherdsl.core.Cypher;
class SimpleExample {
public static void main(String... a) {
var m = node("Movie").named("m");
var statement = Cypher.match(m)
.returning(m)
.build();
System.out.println(statement.getCypher());
// Prints MATCH (m:`Movie`) RETURN m
}
=== Required Java Version
From version 2023.0.0 onwards, the minimal required Java version to use and build the Cypher-DSL is Java 17. If you need a version that is compatible with Java 8, please use 2022.9.x.
== Licensing
The Cypher-DSL itself is licenced under the https://www.apache.org/licenses/LICENSE-2.0[Apache License 2.0].