如何在AgensGraph上更改ELABEL?

时间:2019-06-28 04:50:41

标签: agens-graph

我想更改edge的elabel。

agens=# create (:v1{id:1})-[:e1{id:3}]->(:v1{id:2});
GRAPH WRITE (INSERT VERTEX 2, INSERT EDGE 1)
agens=# match ()-[r1:e1{id:3}]->() set r1:v2 remove r1:v1;
ERROR:  syntax error at or near ":"
LINE 1: match ()-[r1:e1{id:3}]->() set r1:v2 remove r1:v1;
                                         ^

但是,有一个错误。

如何在AgensGraph上更改ELABEL?

1 个答案:

答案 0 :(得分:0)

无法更改AgensGraph边缘上的标签。

但是,您可以尝试添加具有相同属性的新边并删除旧边。

agens=# create (:v1{id:1})-[:e1{id:3}]->(:v1{id:2});
GRAPH WRITE (INSERT VERTEX 2, INSERT EDGE 1)
agens=# match p = ( (n1)-[r1]->(n2) ) return p;
                               p                               
---------------------------------------------------------------
 [v1[3.1]{"id": 1},e1[4.1][3.1,3.2]{"id": 3},v1[3.2]{"id": 2}]
(1 row)

agens=# match  (n1)-[r1:e1{id:3}]->(n2)
        create (n1)-[r2:e2]->(n2)
        set    r2 = properties(r1)
        delete r1;
GRAPH WRITE (INSERT VERTEX 0, INSERT EDGE 1, DELETE VERTEX 0, DELETE EDGE 1, UPDATE PROPERTY 1)
agens=# match p = ( (n1)-[r1]->(n2) ) return p;
                               p                               
---------------------------------------------------------------
 [v1[3.1]{"id": 1},e2[5.1][3.1,3.2]{"id": 3},v1[3.2]{"id": 2}]
(1 row)