-- ============================================================ -- Cypher 创建图和关系测试 -- ============================================================ -- 1. match 节点 match (:test_graph) return * /** output() **/ ; -- 2. match 特定类型节点 match (a:test_graph) where a.g_type='type_a' return a /** output() **/ ; -- 3. 创建关系(connect edge) match (a:test_graph), (b:test_graph) where a.g_name='node_a' and b.g_name='node_b' create (a) -[:connect]-> (b) ; -- 4. 创建更多关系 match (a:test_graph), (b:test_graph) where a.g_name='node_c' and b.g_name='node_d' create (a) -[:connect]-> (b) ; match (a:test_graph), (b:test_graph) where a.g_name='node_a' and b.g_name='node_c' create (a) -[:connect]-> (b) ; -- 5. 查询关系 match (a:test_graph) -[:connect]-> (b:test_graph) return a, b /** output() **/ ;