agensgraph
agensgraph copied to clipboard
how to append label or remove label?
like neo4j
match (a: x) set a:y match (a: x) remove a:x set a:y
@n3xtchen
How to rename the label:
ALTER VLABEL x RENAME TO y;
How to remove the label:
DROP VLABEL x CASCADE;
@bylee5
I'm not mean rename label or drop label, I wanna change some vertex's label
ex.
the label of (a, b, c, d) is "label_x",
now I want to change the label of a to "label_y"?
@n3xtchen If I'm not mistaken, multiple labels aren't supported in Agens since vertices and edges are stored in a table per label. What they do support is table inheritance, which probably won't work if what you want is to "tag" individual vertices or edges. Another possibility is to just have a labels
array as a property and use a property index.
@johnberzy-bazinga can I move a vertex from a tabel(label A) to another table(label B)using syntactic sugar if it exists since there is many edges on it
@n3xtchen you can probably clone the vertex and all the edges associated with it. It is probably pretty easy if your edges don't have self-loops. I'm not sure of one way to do that with one command at present with cypher. You'll likely need two or more. I'd say do it with a plpgsql function but I believe you'd need to wait for #449 to be merged.
@n3xtchen
It can be solved this way.
MATCH (oldv:label_x)-[oldr]->(target) CREATE (newv:label_y)-[newr]->(target) SET newv=oldv, newr=oldr DELETE oldr, oldv;