-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuseful_cypher.txt
38 lines (30 loc) · 1.08 KB
/
useful_cypher.txt
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
Useful Cypher:
Find and kill the open debug port: (in terminal)
lsof -i :5005
kill -9 <pid>
Kill all apoc.periodic.list functions:
CALL apoc.cypher.doIt("CALL apoc.periodic.list",{}) YIELD value
WITH value.name AS names
UNWIND names AS name
CALL apoc.cypher.doIt("CALL apoc.periodic.cancel({name}) YIELD delay RETURN delay", {name: name}) YIELD value
RETURN value
Get generated ES docs:
CALL apoc.es.query('localhost','_all','doc', "_all", null) YIELD value
WITH value
RETURN value
Using Maps so you don’t have to string together withs:
MATCH (n:Person)
WITH n LIMIT 1
WITH n, apoc.map.fromValues([]) AS map
MATCH p=shortestPath( (k:Person {name:'Kevin Bacon'})-[*0..]-(n))
WITH length(p)/2 AS baconNumber, n, map
WITH apoc.map.setKey(map,'baconNumber', baconNumber) AS map, n
MATCH (n)-[:ACTED_IN]-(m:Movie)
WITH collect(m) AS wasIn, n, map
WITH apoc.map.setKey(map,'wasInn', wasIn) AS map, n
RETURN map
!!!!Getting the label with the number of nodes it has!!!!!:
MATCH (a) WITH DISTINCT LABELS(a) AS temp, COUNT(a) AS tempCnt
UNWIND temp AS label
RETURN label, SUM(tempCnt) AS cnt
ORDER BY label