agensgraph icon indicating copy to clipboard operation
agensgraph copied to clipboard

how to append label or remove label?

Open n3xtchen opened this issue 6 years ago • 6 comments

like neo4j

match (a: x) set a:y match (a: x) remove a:x set a:y

n3xtchen avatar Jan 24 '19 07:01 n3xtchen

@n3xtchen How to rename the label: ALTER VLABEL x RENAME TO y;

How to remove the label: DROP VLABEL x CASCADE;

bylee5 avatar Jan 24 '19 08:01 bylee5

@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 avatar Jan 24 '19 17:01 n3xtchen

@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 avatar Jan 24 '19 23:01 johnberzy-bazinga

@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 avatar Jan 25 '19 01:01 n3xtchen

@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.

johnberzy-bazinga avatar Jan 25 '19 20:01 johnberzy-bazinga

@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;

gtyun avatar Jan 28 '19 01:01 gtyun