@neo4j/cypher-builder
Advanced tools
Changelog
1.17.2
#355 acddbc3
Thanks @angrykoala! - Add the following procedures:
db.nameFromElementId
db.info
db.createLabel
db.createProperty
db.createRelationshipType
db.schema.nodeTypeProperties
db.schema.relTypeProperties
db.schema.visualization
#351 ef73177
Thanks @angrykoala! - Exports type ROUND_PRECISION_MODE
Changelog
1.17.0
#340 b1b7acf
Thanks @angrykoala! - Add vector similarity functions:
Cypher.vector.similarity.euclidean(param1, param2);
Cypher.vector.similarity.cosine(param1, param2);
#342 5bba4b5
Thanks @angrykoala! - Add support for FINISH clauses:
new Cypher.Finish()
new Cypher.Match(...).finish()
new Cypher.Create(...).finish()
new Cypher.Merge(...).finish()
Changelog
1.16.0
#333 2593296
Thanks @mjfwebb! - Adds support for genai function genai.vector.encode()
and procedure genai.vector.encodeBatch()
#328 628ec62
Thanks @mjfwebb! - Adds support for vector index functions db.index.vector.queryNodes()
and db.index.vector.queryRelationships()
#310 13fd317
Thanks @angrykoala! - Add support for arbitrary variables in Patterns instead of only Node and Relationship:
#310 13fd317
Thanks @angrykoala! - The following methods in Pattern
class and chains are deprecated:
withoutLabels
withoutVariable
withProperties
getVariables
withoutType
withDirection
withLength
Instead, these properties should be passed as an object, for example:
const a = new Cypher.Variable();
const rel = new Cypher.Variable();
const b = new Cypher.Variable();
const pattern = new Cypher.Pattern(a, { labels: ["Movie"] }).related(rel, { type: "ACTED_IN" }).to(b);
#310 98a8b2f
Thanks @angrykoala! - Deprecate using Node directly on Match, Create and Merge clauses. Use a Pattern instead
#310 7574aee
Thanks @angrykoala! - Deprecate setting up labels and types in Node and Relationship. The following examples are now deprecated:
new Cypher.Node({ labels: ["Movie"] });
new Cypher.Relationship({ type: "ACTED_IN" });
Instead, Nodes and Relationships should be created without parameters. Labels and types should be set in a Pattern:
const n = new Cypher.Node();
const r = new Cypher.Relationship();
const pattern = new Cypher.Pattern(n, { labels: ["Movie"] }).related(r, { type: "ACTED_IN" }).to();
Changelog
1.15.0
0acf69b
Thanks @angrykoala! - Add support for IN TRANSACTIONS
in CALL statements using the method inTransactions()
Changelog
1.14.0
#312 3060a56
Thanks @angrykoala! - Add support for normalize
function:
Cypher.normalize(new Cypher.Param("my string"), "NFC");
#314 dbb6a4a
Thanks @angrykoala! - Add isNormalized
and isNotNormalized
operators:
const stringLiteral = new Cypher.Literal("the \\u212B char");
const query = new Cypher.Return([Cypher.isNormalized(stringLiteral, "NFC"), "normalized"]);
const { cypher } = query.build();
RETURN "the \u212B char" IS NFC NORMALIZED AS normalized
#315 e3a7505
Thanks @angrykoala! - Deprecate Cypher.cdc
Procedures in favor of Cypher.db.cdc
:
Cypher.cdc.current
in favor of Cypher.db.cdc.current
Cypher.cdc.earliest
in favor of Cypher.db.cdc.earliest
Cypher.cdc.query
in favor of Cypher.db.cdc.query
This new procedures also update the generated Cypher namespace to db.cdc
Changelog
1.13.0
#301 f2f679b
Thanks @angrykoala! - Add support for Collect subqueries:
const dog = new Cypher.Node({ labels: ["Dog"] });
const person = new Cypher.Node({ labels: ["Person"] });
const subquery = new Cypher.Match(
new Cypher.Pattern(person).related(new Cypher.Relationship({ type: "HAS_DOG" })).to(dog)
).return(dog.property("name"));
const match = new Cypher.Match(person)
.where(Cypher.in(new Cypher.Literal("Ozzy"), new Cypher.Collect(subquery)))
.return(person);
MATCH (this0:Person)
WHERE "Ozzy" IN COLLECT {
MATCH (this0:Person)-[this1:HAS_DOG]->(this2:Dog)
RETURN this2.name
}
RETURN this0
Changelog
1.12.0
#294 07280b6
Thanks @angrykoala! - Support for WHERE predicates in patters:
const movie = new Cypher.Node({ labels: ["Movie"] });
new Cypher.Pattern(movie).where(Cypher.eq(movie.property("title"), new Cypher.Literal("The Matrix")));
(this0:Movie WHERE this0.title = "The Matrix")
Changelog
1.11.0
#277 f97c229
Thanks @angrykoala! - Add support for type predicate expressions with the functions Cypher.isType
and Cypher.isNotType
:
const variable = new Cypher.Variable();
const unwindClause = new Cypher.Unwind([new Cypher.Literal([42, true, "abc", null]), variable]).return(
variable,
Cypher.isType(variable, Cypher.TYPE.INTEGER)
);
UNWIND [42, true, \\"abc\\", NULL] AS var0
RETURN var0, var0 IS :: INTEGER
#283 566e1d4
Thanks @angrykoala! - Prepends WITH on each UNION subquery when .importWith
is set in parent CALL:
const returnVar = new Cypher.Variable();
const n1 = new Cypher.Node({ labels: ["Movie"] });
const query1 = new Cypher.Match(n1).return([n1, returnVar]);
const n2 = new Cypher.Node({ labels: ["Movie"] });
const query2 = new Cypher.Match(n2).return([n2, returnVar]);
const unionQuery = new Cypher.Union(query1, query2);
const callQuery = new Cypher.Call(unionQuery).importWith(new Cypher.Variable());
The statement WITH var0
will be added to each UNION subquery
CALL {
WITH var0
MATCH (this1:Movie)
RETURN this1 AS var2
UNION
WITH var0
MATCH (this3:Movie)
RETURN this3 AS var2
}
#283 566e1d4
Thanks @angrykoala! - Deprecate Call.innerWith
in favor of Call.importWith
#289 b9a2ad6
Thanks @angrykoala! - Deprecates the second parameter of patternComprehensions in favor of new .map
method:
old
new Cypher.PatternComprehension(pattern, expr);
new
new Cypher.PatternComprehension(pattern).map(expr);
Changelog
1.10.3
#279 4620a2e
Thanks @angrykoala! - Add support for "*" parameter in MapProjection:
new Cypher.MapProjection(new Cypher.Variable(), "*");
var0 { .* }