-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathadmin.cypher
More file actions
48 lines (36 loc) · 951 Bytes
/
admin.cypher
File metadata and controls
48 lines (36 loc) · 951 Bytes
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
44
45
46
47
// Useful admin commands
MATCH (n:Reference)
WITH collect(DISTINCT n) AS nodes
MATCH (:Reference)-[r]->(:Reference)
WITH nodes, collect(DISTINCT r) AS rels
CALL apoc.export.json.data(nodes, rels, null, {stream: true})
YIELD data
RETURN data;
// Delete all propositions
MATCH (p:Proposition)
DETACH DELETE p;
// Delete all user data (Users and their Propositions)
MATCH (u:User)
DETACH DELETE u;
MATCH (p:Proposition)
DETACH DELETE p;
// Delete Entity nodes that don't have the Reference label
MATCH (e:__Entity__)
WHERE NOT e:Reference
DETACH DELETE e;
// Delete open opus data
MATCH (n)
WHERE n.primarySource = 'openopus'
DETACH DELETE n;
// DANGER ZONE
// Clear the database. You were WARNED!!
MATCH (n)
DETACH DELETE n;
MATCH (w:Work)
WITH count(w) AS total
MATCH (w2:Work)
WHERE (w2)-[:SCORED_FOR]->(:Instrument)
WITH total, count(DISTINCT w2) AS tagged
RETURN total,
tagged,
round(100.0 * tagged / total, 1) AS pct;