Cypher Operators

Comparison Operators

OperatorDescriptionExample
=Equaln.age = 30
<>Not equaln.status <> 'deleted'
<Less thann.age < 18
>Greater thann.age > 65
<=Less than or equaln.score <= 100
>=Greater than or equaln.score >= 0

Boolean Operators

OperatorDescriptionExample
ANDLogical andn.age > 18 AND n.active = true
ORLogical orn.role = 'admin' OR n.role = 'mod'
NOTLogical notNOT n.deleted
XORExclusive ora.flag XOR b.flag

Null Operators

OperatorDescriptionExample
IS NULLCheck for nulln.email IS NULL
IS NOT NULLCheck for non-nulln.email IS NOT NULL

String Operators

OperatorDescriptionExample
STARTS WITHPrefix matchn.name STARTS WITH 'A'
ENDS WITHSuffix matchn.email ENDS WITH '.com'
CONTAINSSubstring matchn.bio CONTAINS 'developer'
=~Regex matchn.email =~ '.*@gmail\\.com'

List Operators

OperatorDescriptionExample
INList membershipn.status IN ['active', 'pending']
+List concatenation[1, 2] + [3, 4][1, 2, 3, 4]
[index]Index accesslist[0] (first element)

Arithmetic Operators

OperatorDescriptionExample
+Additionn.price + tax
-Subtractionn.total - discount
*Multiplicationn.quantity * n.price
/Divisionn.total / n.count
%Modulon.id % 10

String Concatenation

OperatorDescriptionExample
+Concatenate stringsn.first + ' ' + n.last

Property Access

OperatorDescriptionExample
.Property accessn.name

Operator Precedence

From highest to lowest:

  1. . [] - Property/index access
  2. * / % - Multiplication, division, modulo
  3. + - - Addition, subtraction
  4. = <> < > <= >= - Comparison
  5. IS NULL IS NOT NULL
  6. IN STARTS WITH ENDS WITH CONTAINS =~
  7. NOT
  8. AND
  9. XOR
  10. OR

Use parentheses to override precedence:

WHERE (n.age > 18 OR n.verified) AND n.active