You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
insert into e2_3 values (1000, 2, 2002, 'e231', 10005);
310
+
insert into e2_1 values (1000, 1, 2, 'e211', 10006);
299
311
-- empty element path pattern, counts number of edges in the graph
300
312
SELECT count(*) FROM GRAPH_TABLE (g1 MATCH ()-[]->() COLUMNS (1 as one));
301
313
count
302
314
-------
303
-
5
315
+
6
304
316
(1 row)
305
317
306
318
SELECT count(*) FROM GRAPH_TABLE (g1 MATCH ()->() COLUMNS (1 as one));
307
319
count
308
320
-------
309
-
5
321
+
6
310
322
(1 row)
311
323
312
324
-- Vertex element v2 has label vl3 which exposes property vprop1. But vl3 is
@@ -337,6 +349,14 @@ select src, conn, dest, lprop1, vprop2, vprop1 from graph_table (g1 match (a is
337
349
v11 | e132 | v31 | vl3_prop | | 2010
338
350
(4 rows)
339
351
352
+
-- WHERE clause in graph pattern
353
+
SELECT self, through FROM GRAPH_TABLE (g1 MATCH (a)->(b)->(c) WHERE a.vname = c.vname and a.vname <> b.vname COLUMNS (a.vname as self, b.vname as through));
354
+
self | through
355
+
------+---------
356
+
v12 | v21
357
+
v21 | v12
358
+
(2 rows)
359
+
340
360
-- Errors
341
361
-- vl1 is not associated with property vprop2
342
362
select src, src_vprop2, conn, dest from graph_table (g1 match (a is vl1)-[b is el1]->(c is vl2 | vl3) columns (a.vname as src, a.vprop2 as src_vprop2, b.ename as conn, c.vname as dest));
@@ -362,8 +382,9 @@ select * from graph_table (g1 match (src)-[conn]->(dest) columns (src.vname as s
select * from graph_table (g1 match (src IS vl1 | vl2 | vl3)-[conn]->(dest) columns (src.vname as svname, conn.ename as cename, dest.vname as dvname));
@@ -373,8 +394,9 @@ select * from graph_table (g1 match (src IS vl1 | vl2 | vl3)-[conn]->(dest) colu
373
394
v11 | e121 | v22
374
395
v11 | e131 | v33
375
396
v11 | e132 | v31
397
+
v21 | e211 | v12
376
398
v22 | e231 | v32
377
-
(5 rows)
399
+
(6 rows)
378
400
379
401
-- graph'ical query: find a vertex which is not connected to any other vertex as a source or a destination.
380
402
with all_connected_vertices as (select svn, dvn from graph_table (g1 match (src)-[conn]->(dest) columns (src.vname as svn, dest.vname as dvn))),
@@ -394,8 +416,9 @@ select sn, cn, dn from graph_table (g1 match (src : l1)-[conn : l1]->(dest : l1)
394
416
v11 | e121 | v22
395
417
v11 | e131 | v33
396
418
v11 | e132 | v31
419
+
v21 | e211 | v12
397
420
v22 | e231 | v32
398
-
(5 rows)
421
+
(6 rows)
399
422
400
423
-- property graph with some of the elements, labels and properties same as the
401
424
-- previous one. Test whether components from the specified property graph are
insert into e2_3 values (1000, 2, 2002, 'e231', 10005);
250
+
insert into e2_1 values (1000, 1, 2, 'e211', 10006);
239
251
240
252
-- empty element path pattern, counts number of edges in the graph
241
253
SELECTcount(*) FROM GRAPH_TABLE (g1 MATCH ()-[]->() COLUMNS (1as one));
@@ -250,6 +262,8 @@ SELECT * FROM GRAPH_TABLE (g1 MATCH (a IS vl1 | vl2) COLUMNS (a.vname,
250
262
a.vprop1));
251
263
-- vprop2 is associated with vl2 but not vl3
252
264
select src, conn, dest, lprop1, vprop2, vprop1 from graph_table (g1 match (a is vl1)-[b is el1]->(c is vl2 | vl3) columns (a.vnameas src, b.enameas conn, c.vnameas dest, c.lprop1, c.vprop2, c.vprop1));
265
+
-- WHERE clause in graph pattern
266
+
SELECT self, through FROM GRAPH_TABLE (g1 MATCH (a)->(b)->(c) WHEREa.vname=c.vnameanda.vname<>b.vname COLUMNS (a.vnameas self, b.vnameas through));
0 commit comments