Is there any possible way to change the current label of a vertex or an edge? For example, if I create a graph to store movies and series and then create the following vertex:
SELECT * FROM cypher ('visual_arts', $$
CREATE (v:Movie {title: "The Last of Us", episodes: 4, seasons: 1, main_actors: ["Pedro Pascal", "Bella Ramsey"]})
RETURN v $$) as (v agtype);
And then I want to correct this vertex by changing the label to "Series" instead of "Movie". How can I do that?
3
Answers
In current version of AGE, we cannot update label of any vertex or edge.
To do so, the best way is to introduce a new property UpdatedLabel and set it to Series.
You can do so by:
Now you can retrieve the Series by using:
Unfortunately, we don’t have update label functionality in Apache-age but sooner we will be having that functionality.
It will most prolly be on the same pattern as it works in cypher queries in Neo4j like
Note: node here refers to vertex or edge
For example: if we have a node with label "Engine" and want to update it to "EnginePower" then in the following way we can do that in cypher Neo4j
For the same if we want to add functionality in apache-age then it can be something in the following manner
It is not possible to directly change the label of a vertex or an edge in AGE. Alternatively, you can create a new vertex or edge with the desired label and properties and delete the old vertex or edge.
Here’s an example of how you can achieve this in AGE for the vertex you created: