-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_items.txt
More file actions
299 lines (196 loc) · 9.61 KB
/
Copy pathdata_items.txt
File metadata and controls
299 lines (196 loc) · 9.61 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
// Insert First
Lets create a NODE with called Person person having the attributes:
id, name, email, dob
CREATE (:Person {id: 'c7f96281', name:'Jimmy Bayer', email:'dudley22@joysclick.ru', dob:'1995-12-16'})
//Similarly address
CREATE(:person_address {person_id:'c7f96281', street_address:'806 Red Dog Road', city:'Charlotte', state:'NC'})
//another person
CREATE (:Person {id: '3ae2fdf0', name:'Rosalind Senger', email:'agustin.rohan@lagooorka.ru', dob:'1991-04-28'})
//another address
CREATE(:person_address {person_id:'3ae2fdf0', street_address:'4230 Cliffside Drive', city:'Andover', state:'NY'})
// create Person node
CREATE (p:Person{id:uid,firstName:'Bob',lastName:'Jones'})
RETURN p AS person
//Create relationship LivesIn between already existed node
MATCH (p:Person {id:'c7f96281'}),(add:person_address {person_id:'c7f96281'}) CREATE (p)-[:LIVES_IN]->(add)
MATCH (p:Person {id:'3ae2fdf0'}),(add:person_address {person_id:'3ae2fdf0'}) CREATE (p)-[:LIVES_IN]->(add)
CREATE (p1:Person {id: 'c437f2b7', name:'Bobbie Anderson', email:'BobbieJAnderson@rhyta.com', dob:'1996-10-11'})
CREATE(add1:person_address {person_id:'c437f2b7', street_address:'2620 Ryder Avenue', city:'Madison', state:'WI'})
CREATE (p1)-[:LIVES_IN]->(add1)
CREATE (p2:Person {id: 'df134b31', name:'James Porter', email:'JamesPPorter@teleworm.ru', dob:'1992-03-16'})
CREATE(add2:person_address {person_id:'df134b31', street_address:'4040 Lightning Point Drive', city:'Kent', state:'TN'})
CREATE (p2)-[:LIVES_IN]->(add2)
//Friends of
MATCH (n:Person {email:'BobbieJAnderson@rhyta.com'}), (n1:Person {email:'dudley22@joysclick.ru'})
CREATE (n1)<-[:IS_FRIEND_OF]-(n)
WITH true as pass
MATCH (n:Person {email:'BobbieJAnderson@rhyta.com'}), (n2:Person {email:'JamesPPorter@teleworm.ru'})
CREATE (n2)<-[:IS_FRIEND_OF]-(n)
WITH true as pass
MATCH (n:Person {email:'BobbieJAnderson@rhyta.com'}), (n3:Person {email:'agustin.rohan@lagooorka.ru'})
CREATE (n3)<-[:IS_FRIEND_OF]-(n)
//View Relationship
MATCH (a:Person)-[r]-(b)
RETURN r, a, b
// view relationship with email
MATCH (a:Person {email: 'dudley22@joysclick.ru'})-[r:LIVES_IN]-(b)
RETURN r, a, b
//view all relationship
MATCH (a:Person)-[r]-(b)
RETURN type(r), a.name AS `Name`,a.email AS `Email`, b.street_address AS `Address`
//delete relationship LivesIn
START n=node(*)
MATCH (n)-[rel:LivesIn]->(r)
DELETE rel
//delete node
MATCH (n:Person { name: 'UNKNOWN' })
DELETE n
//UNIQUE constraint
CREATE CONSTRAINT ON (p: Person)
ASSERT p.id IS UNIQUE
//Restaurant
CREATE(:Restaurant {id:'1', name:"Italian" })
CREATE(:Restaurant {id:'2', name:"Nepali" })
CREATE(:Restaurant {id:'3', name:"Continetal" })
CREATE(:Restaurant {id:'4', name:"Thai" })
CREATE(:Restaurant {id:'5', name:"Indian" })
MATCH (n:Person {email:'BobbieJAnderson@rhyta.com'})
MATCH (n1:Person {email:'dudley22@joysclick.ru'})
MATCH (n2:Person {email:'JamesPPorter@teleworm.ru'})
MATCH (n3:Person {email:'agustin.rohan@lagooorka.ru'})
MATCH (r1:Restaurant {name:'Italian'})
MATCH (r2:Restaurant {name:'Nepali'})
MATCH (r3:Restaurant {name:"Continetal" })
MATCH (r4:Restaurant {name:"Thai" })
MATCH (r5:Restaurant {name:"Indian" })
CREATE (n)-[:LIKES]->(r1)
CREATE (n)-[:LIKES]->(r3)
CREATE (n)-[:LIKES]->(r4)
CREATE (n1)-[:LIKES]->(r5)
CREATE (n1)-[:LIKES]->(r4)
CREATE (n1)-[:LIKES]->(r2)
CREATE (n2)-[:LIKES]->(r4)
CREATE (n2)-[:LIKES]->(r5)
CREATE (n2)-[:LIKES]->(r1)
CREATE (n2)-[:LIKES]->(r2)
CREATE (n3)-[:LIKES]->(r1)
CREATE (n3)-[:LIKES]->(r3)
CREATE (n3)-[:LIKES]->(r4)
//
LOAD CSV WITH HEADERS FROM "https://a.uguu.se/HWPA1K57hALu_restaurant_location.csv" AS row
CREATE (n:restaurant_location)
SET n = row
//
LOAD CSV WITH HEADERS FROM "https://a.uguu.se/8taatoV334Lc_cusine.csv" AS row
CREATE (n:Cusine)
SET n = row
//
MATCH (rs:Restaurant),(rl:restaurant_location)
WHERE rs.id = rl.restaurant_id
CREATE (rs)-[:LOCATED_IN]->(rl)
//
MATCH (rs:Restaurant),(c:Cusine)
WHERE rs.id = c.restaurant_id
CREATE (rs)-[:SERVES]->(c)
MATCH (a:Person)-[r:LIKES]-(b), (b)-[s:SERVES]->(c)
RETURN r, a, b, c
//Friends of BobbieJAnderson who likes Indian restaurant located at Kent that serves Samosa
MATCH (person:Person)-[:IS_FRIEND_OF]->(friend:Person),
(friend)-[:LIKES]->(rest:Restaurant),
(rest)-[:LOCATED_IN]->(loc:restaurant_location),
(rest)-[:SERVES]->(type:Cusine)
where person.email= 'BobbieJAnderson@rhyta.com'
AND type.name = 'Samosa'
AND loc.location = 'Kent'
RETURN person,rest, loc.name, friend
//
MATCH (person:Person)-[fnd:IS_FRIEND_OF]->(friend:Person),
(friend)-[lik:LIKES]->(rest:Restaurant),
(rest)-[loct:LOCATED_IN]->(loc:restaurant_location),
(rest)-[serv:SERVES]->(type:Cusine)
where person.email= 'BobbieJAnderson@rhyta.com'
AND type.name = 'Samosa'
RETURN person.name,type(fnd) AS `Friend of`,friend.name,type(lik),rest.name,type(loct) AS `Located In`,loc.name,type(serv) AS `SERVES`,type.name
//
MATCH (person:Person)-[fnd:IS_FRIEND_OF]->(friend:Person),
(friend)-[:LIVES_IN]->(address:person_address),
(friend)-[lik:LIKES]->(rest:Restaurant)
where person.email= 'BobbieJAnderson@rhyta.com'
AND address.city='Kent'
AND rest.name = 'Nepali'
RETURN friend.name
//data sets
//Create node called person
CREATE (:Person {id: 'c7f96281', name:'Jimmy Bayer', email:'dudley22@joysclick.ru', dob:'1995-12-16'})
CREATE (:Person {id: '3ae2fdf0', name:'Rosalind Senger', email:'agustin.rohan@lagooorka.ru', dob:'1991-04-28'})
CREATE (:Person {id: 'c437f2b7', name:'Bobbie Anderson', email:'BobbieJAnderson@rhyta.com', dob:'1996-10-11'})
CREATE (:Person {id: 'df134b31', name:'James Porter', email:'JamesPPorter@teleworm.ru', dob:'1992-03-16'})
CREATE (:Person {id: 'd12b3080f',name:'Luis Fryer', email:'LuisMFryer@joysclick.ru', dob:'1995-03-09'})
CREATE (:Person {id: 'd4df4e59', name:'Steve Mar', email:'SteveSMar@teleworm.com', dob:'1992-12-16'})
CREATE (:Person {id: '8926fc51', name:'Frank Thomas', email:'FrankMThomas@joysclick.ru', dob:'1990-03-05'})
CREATE (:Person {id: 'c3858bde', name:'Della Cruz', email:'DellaJCruz@dayrep.com', dob:'1995-12-28'})
CREATE (:Person {id: '0bf0599d', name:'Wilson Dillon', email:'WilsonNDillon@dayrep.com', dob:'1991-12-16'})
CREATE (:Person {id: '216de5af', name:'Beulah Clinton', email:'BeulahJClinton@jourrapide.ru', dob:'1988-12-16'})
CREATE(:person_address {person_id:'216de5af', street_address:'2620 Ryder Avenue', city:'Kent', state:'WA'})
CREATE(:person_address {person_id:'0bf0599d', street_address:'936 Zulauf Squares', city:'Kent', state:'IA'})
CREATE(:person_address {person_id:'c3858bde', street_address:'4913 Central Avenue', city:'New Brunswick', state:'NJ'})
CREATE(:person_address {person_id:'8926fc51', street_address:'360 Frederick Street', city:'Kent', state:'AL'})
CREATE(:person_address {person_id:'d4df4e59', street_address:'373 Hart Street', city:'Kent', state:'CT'})
CREATE(:person_address {person_id:'df134b31', street_address:'4040 Lightning Point Drive', city:'Kent', state:'TN'})
CREATE(:person_address {person_id:'c437f2b7', street_address:'2620 Ryder Avenue', city:'Madison', state:'WI'})
CREATE(:person_address {person_id:'3ae2fdf0', street_address:'4230 Cliffside Drive', city:'Andover', state:'NY'})
CREATE(:person_address {person_id:'c7f96281', street_address:'806 Red Dog Road', city:'Charlotte', state:'NC'})
CREATE(:person_address {person_id:'d12b3080f', street_address:'2167 Lady Bug Drive', city:'Whitestone', state:'NY'})
CREATE(:restaruant_location {location:"Kent", restaturant_id:'1' })
CREATE(:restaruant_location {location:"Richmond", restaturant_id:'2' })
CREATE(:restaruant_location {location:"Richmond", restaturant_id:'2' })
CREATE(:restaruant_location {location:"Texas", restaturant_id:'3' })
CREATE(:restaruant_location {location:"Philadelphia", restaturant_id:'2' })
CREATE(:restaruant_location {location:"Philadelphia", restaturant_id:'1' })
CREATE(:restaruant_location {location:"Texas", restaturant_id:'3' })
CREATE(:restaruant_location {location:"Madison", restaturant_id:'2' })
CREATE(:restaruant_location {location:"Philadelphia", restaturant_id:'3' })
CREATE(:restaruant_location {location:"Texas", restaturant_id:'2' })
CREATE(:restaruant_location {location:"Whitestone", restaturant_id:'5' })
CREATE(:restaruant_location {location:"Whitestone", restaturant_id:'3' })
CREATE(:restaruant_location {location:"Whitestone", restaturant_id:'1' })
CREATE(:restaruant_location {location:"Texas", restaturant_id:'5' })
CREATE(:restaruant_location {location:"Madison", restaturant_id:'4' })
CREATE(:restaruant_location {location:"Kent", restaturant_id:'5' })
CREATE(:cusine {name:"batter Fish"}) //continental
CREATE(:cusine {name:"chicken & Cheese Salad"})
CREATE(:cusine {name:"paneer Steak"})
CREATE(:cusine {name:"Baked Mushrooms & Spinach"})
CREATE(:cusine {name:"Barbequed Chicken"})
CREATE(:cusine {name:"Broccoli Bake"})
CREATE(:cusine {name:"Buttered Potatoes"})
CREATE(:cusine {name:"Cheese Fondue"})
CREATE(:cusine {name:"Daal Bhat Tarkari"})
CREATE(:cusine {name:"Momo"})
CREATE(:cusine {name:"Chatamari"})
CREATE(:cusine {name:"Dheedo"})
CREATE(:cusine {name:"Aloo Tama"})
CREATE(:cusine {name:"Yomari"})
CREATE(:cusine {name:"Pizza"})
CREATE(:cusine {name:"Bottarga"})
CREATE(:cusine {name:"Lasagna"})
CREATE(:cusine {name:"Fiorentina Steak"})
CREATE(:cusine {name:"Ribollita"})
CREATE(:cusine {name:"Polenta"})
CREATE(:cusine {name:"Ossobuco"})
CREATE(:cusine {name:"Spicy Shrimp Soup"})
CREATE(:cusine {name:"Som Tum"})
CREATE(:cusine {name:"Tom Kha Kai"})
CREATE(:cusine {name:"Pad Thai"})
CREATE(:cusine {name:"Vada pav"})
CREATE(:cusine {name:"Samosa"})
CREATE(:cusine {name:"Paav Bhaji"})
CREATE(:cusine {name:"Pakora"})
CREATE(:cusine {name:"Aloo Tikki Chole"})
CREATE(:cusine {name:"Bhelpuri"})
CREATE(:cusine {name:"Fafda"})
CREATE(:cusine {name:"Upma"})
CREATE(:cusine {name:"Jalebi"})
//
MATCH (n)
DETACH DELETE n