-
Notifications
You must be signed in to change notification settings - Fork 36
/
cypher.cql
43 lines (35 loc) · 931 Bytes
/
cypher.cql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Test Comment
CREATE CONSTRAINT ON (p:Person)
ASSERT p.name IS UNIQUE
DROP CONSTRAINT ON ()-[k:KNOWS]-()
ASSERT exists(k.startDate)
MATCH (p1:Person)-[k:KNOWS]->(p2:Person)
WHERE p1.name =~ 'n$'
RETURN toUpper(p2.Name)
MATCH (person)-[*1..3]-(friend)
WHERE person.name = 'Steven'
AND person.age >= 18
RETURN DISTINCT friend
UNION
MATCH (person)-[k:KNOWS]-(friend)
WHERE person.name = 'Steven'
WITH person, count(friend) AS friendCount
WHERE friendCount > 10 OR friendCount = 0
ORDER BY friendCount DESC
SKIP 1
LIMIT 3
RETURN person
size((p1:Person)-->()-->(p2:Person))
MATCH (p:Person)
CASE
WHEN p.age < 18 THEN 'MINOR'
WHEN n.age >= 65 THEN 'SENIOR'
ELSE 'ADULT'
END
USING PERIODIC COMMIT 50
LOAD CSV WITH HEADERS FROM
'https://www.fakeURL.com/fake-file.csv' AS csvPerson
CREATE (:Person {name: csvPerson.Name, age: toInteger(csvPerson.Age)})
UNWIND $names AS name
MATCH (n {name: name})
RETURN avg(n.age)