forked from Skydipper/graph-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
import.txt
96 lines (81 loc) · 2.61 KB
/
import.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// IMPORT NODES
LOAD CSV FROM 'file:///nodes.csv'
AS line
WITH line
MERGE (c:CONCEPT { id: line[0], label: line[1], synonyms: CASE line[2] WHEN null THEN '' ELSE split(line[2],'|') END })
// AFFECTS relationships
LOAD CSV FROM 'file:///affects.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:AFFECTS]->(c2)
// CAN_AFFECT relationships
LOAD CSV FROM 'file:///can_affect.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:CAN_AFFECT]->(c2)
// IS_A relationships
LOAD CSV FROM 'file:///is_a.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:IS_A]->(c2)
// IS_INVOLVED_IN relationships
LOAD CSV FROM 'file:///is_involved_in.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:IS_INVOLVED_IN]->(c2)
// LOCATED_AT relationships
LOAD CSV FROM 'file:///located_at.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:LOCATED_AT]->(c2)
// IS_SIMILAR_TO relationships
LOAD CSV FROM 'file:///is_similar_to.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:IS_SIMILAR_TO]->(c2)
// PART_OF relationships
LOAD CSV FROM 'file:///part_of.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:PART_OF]->(c2)
// QUALITY_OF relationships
LOAD CSV FROM 'file:///quality_of.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:QUALITY_OF]->(c2)
// RELATED_TO relationships
LOAD CSV FROM 'file:///related_to.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:RELATED_TO]->(c2)
// TYPE_OF relationships
LOAD CSV FROM 'file:///type_of.csv'
AS line
WITH line
MATCH (c1:CONCEPT { id: line[0]}), (c2:CONCEPT { id: line[1]})
MERGE (c1)-[:TYPE_OF]->(c2)
//===============CREATE INDICES=======================
CREATE INDEX ON :CONCEPT(id);
CREATE INDEX ON :DATASET(id);
CREATE INDEX ON :WIDGET(id);
CREATE INDEX ON :LAYER(id);
CREATE INDEX ON :USER(id);
DROP INDEX ON :CONCEPT(id);
DROP INDEX ON :DATASET(id);
DROP INDEX ON :WIDGET(id);
DROP INDEX ON :LAYER(id);
CREATE CONSTRAINT ON (dataset:DATASET) ASSERT dataset.id IS UNIQUE;
CREATE CONSTRAINT ON (widget:WIDGET) ASSERT widget.id IS UNIQUE;
CREATE CONSTRAINT ON (layer:LAYER) ASSERT layer.id IS UNIQUE;
CREATE CONSTRAINT ON (metadata:METADATA) ASSERT metadata.id IS UNIQUE;
CREATE CONSTRAINT ON (user:USER) ASSERT user.id IS UNIQUE;
CREATE CONSTRAINT ON (concept:CONCEPT) ASSERT concept.id IS UNIQUE;