A Java DSL (Builder) for the Cypher Query Language
APACHE-2.0 License
Bot releases are hidden (Show)
Wait what, another minor?
Yes, we added new methods to some builders for #753 and a new method in #756 that takes in the direction of a relationship.
While these are not interfaces for you to implemented and the methods are defaulted, semver requires a minor bump nevertheless.
Thanks to @israelstmz and ss with almost every release this year, to @ikwattro, for your input!
REMOVE
being used after MERGE
. (#753)2023.4.0 comes with a whole list of new features. As we deprecated two things (the DEFAULT
dialect and org.neo4j.cypherdsl.core.Cypher.use(org.neo4j.cypherdsl.core.SymbolicName, org.neo4j.cypherdsl.core.Statement)
), your project might break depending on your warning settings. The DEFAULT
dialect is now org.neo4j.cypherdsl.core.renderer.Dialect.NEO4J_4
(which keeps on being the default) and the use
method has a new overload taking in an expression. You might need to explicitly cast here until we remove the deprecated method for good. This change was necessary to be able to put all functions in the graph.*
namespace to use.
Thanks to our reporters, contributors and supporters @xdelox, @ikwattro, @nmervaillie and Rohan Kharwar.
FOREACH
. (#740)graph.*
namespaces. (#734)DEFAULT
dialect with explicit NEO4J_4
dialect. (#736)LabelExpression
's into the catalog, too. (#676)Functions.id()
in favor of elementId()
. (#678)Duration
and Period
literals.StringBuilder
with Matcher#appendReplacement
.Thanks to @Andy2003 for his input on the 2023.2.0 release. The main topic of this release is adding support for semantic comparison. The Cypher-DSLs builder method creates an AST, so that is in theory an excellent and doable request. The AST has originally been created as good enough means of rendering Cypher proper when we invented the Cypher-DSL for Spring Data Neo4j 6 back in 2019. Good enough here means that it has optimizing potential and a full-blown analysis is - at least at the moment - out of scope.
Instead, we went with another approach: We added ways of normalizing
into generated names and optionally make the parsing of literal Cypher maps constant (maps sorted alphabetically and not by order of key appearance).
This allows now for a "poor man's" semantic comparison. Imagine 2 Cypher-DSL Statement
objects that you either created using the builder or parsed through our parser module. You can compare them like this:
static boolean areSemanticallyEquivalent(Statement statement1, Map<String, Object> args1, Statement statement2, Map<String, Object> args2) {
if (!areSemanticallyEquivalent(statement1, statement2)) {
return false;
}
var mapping1 = statement1.getCatalog().getRenamedParameters();
var mapping2 = statement2.getCatalog().getRenamedParameters();
for (Map.Entry<String, String> entry : mapping1.entrySet()) {
String key1 = entry.getKey();
String mapped = entry.getValue();
String key2 = mapping2.entrySet().stream().filter(e -> e.getValue().equals(mapped))
.map(Map.Entry::getKey).findFirst().orElseThrow();
if (!args1.get(key1).equals(args2.get(key2))) {
return false;
}
}
return true;
}
The catalog featured added in 2023.1.0 has been enhanced so that it can return now the mapping of the renamed parameters as well, allowing for inspection of parameters from different sources.
Also thanks to @hindog for contributing map literals in #642 and to @sathishkumar294 for inspiring the new dedicated overloads for type
and labels
that now work with symbolic names, too.
Asterisk
proper identifiable. (#641)Cypher.withAll
to create a with clause importing all (*
) variables. (#639)Functions.type
and Functions.labels
taking in a symbolic name. (#633)UNWIND
.2023.1.0 is the first feat release after 2023.0.0 and contains several ideas and improvements that stem from sql2cypher and from input by @lukaseder. Thank you!
Additionally, we worked again with @ikwattro from Graph Aware on building the catalog feature. Each statement - regardless of being built or parsed with the Cypher-DSL - can be analyzed via it's catalog now. The catalog will contain labels, types and properties used in a statement and the filters created based on those tokens. You can access the catalog like this:
var input = """
MATCH (m:`Movie` {title: 'The Matrix'})<-[a:`ACTED_IN`]-(p:`Person`)
WHERE p.born >= $born
RETURN p
""";
var statement = CypherParser.parse(input);
var catalog = statement.getCatalog();
Also: All AST elements will now render themselves to Cypher-Fragments when used in toString()
scenarios. Apart from that, all bug fixes and dependency upgrades from 2022.8.5 and 2023.0.4 are included:
count
and exists
taking in a statement and optional imports. (#623)MATCH
clause after parsing. (#580)length()
function. (#569)Visitable
objects. (#554)UNION
clause. (#590)StatementContext
. (#586)requires static transitive
with requires static
.PatternElement
and Expression
where sensible. (#566)module-info.java
somewhere out of IDEAs reach.2023.0.4 is a bug fix release and fully compatible with 2023.0.3.
Thanks to @Andy2003 for their input on several bugs!
UNION
clause. (#590)StatementContext
. (#588)Thanks to @ikwattro, @lukaseder and @bonelli for their input!
MATCH
clause after parsing. (#580)module-info.java
somewhere out of IDEAs reach.This patch releases adds a build-in length
function for paths (thanks @Lukasmp3 for the request) and fixes issues when running Cypher-DSL on the module path (see c7747ca35 on main for more information).
length()
function. (#569)requires static transitive
with requires static
.Welcome to 2023, welcome Java 17, welcome Neo4j 5 clauses. This is the first release of the Cypher-DSL requiring Java 17. This is in line with Neo4j itself, Spring Data Neo4j 7 and several other frameworks out there. This allows for more concise code (which is nice for us) as well as using the Neo4j 5 parser in neo4j-cypher-dsl-parser
module. Bumping the JDK warrants a major upgrade already.
Apart from that we have been very reluctant on breaking changes. As a matter of fact, close to none has been necessary. One of the few improvements that might need changes on your side is #551 (Commit 10080df) in which we improved the WITH
clause: You might see ambiguous method errors and the fix can be seen here for example: Either use JDK 17 reserved name var
for local variable type-inference or use explicit IdentifiableElement
.
There's a lot of new stuff as well: You can now use Expressions.count
to build new Neo4j 5 COUNT
expressions and we do support the USE
clause for composite database queries as well.
Please fear not if you are still on JDK 8: We will maintain the 2022.8.x branch at least as long as Spring Data Neo4j 6.3 is maintained, as the latter is build on top of the Cypher-DSL and is JDK 8, too.
Thanks a lot to our friend @ikwattro from @graphaware for his continuous and well appreciated feedback and input to this project.
COUNT {}
sub-query expressions. (#546)USE
clause proper. (#543, thanks to @ikwattro for contributing this)USE
clause in the DSL. (#542)match
after unwind as defined by OpenCypher. (#531)returning
and with
. (#551)yield *
for standalone calls with arguments, too. (#545, thanks to @zakjan taking the time and report this)REMOVE
item inside SET
clause (during RT). (#506)README.adoc
.license-maven-plugin
for checking Apache 2 compatible license and header formatting.yield *
for standalone calls with arguments, too. (#545, thanks to @zakjan taking the time and report this)Thanks to @ikwattro from @graphaware for investing his time and creating valuable tickets for this release.
match
after unwind as defined by OpenCypher. (#531)REMOVE
item inside SET
clause (during RT). (#506)