DEV Community

Muhammad Muneeb Ur Rehman
Muhammad Muneeb Ur Rehman

Posted on

Set or Update Vertex Properties in Apache AGE

In Apache AGE, data is stored in edges and vertices. In this blog, I will tell you how you can set or update the properties of a vertex. The property of a vertex contains the data that is related to that vertex. The data is stored in key value pair.

Gerneral Form
Here is the general form of the query to add new Data in the Property of the Vertex.
SELECT * FROM cypher('graph_name', $$
MATCH (v{propertyName:'Anything'})
SET v.newDetail = 'New Details'
$$) as (v agtype);

Explanation
We get the vertex for which we want to add data by MATCH (v{propertyName:'Anything'}) and then we add the data by using SET v.newDetail = 'New Details'.

Gerneral Form
Here is the general form of the query to update Data in the Property of the Vertex.
SELECT * FROM cypher('graph_name', $$
MATCH (v{propertyName:'Anything'})
SET v.propertyName = 'Updated Details'
$$) as (v agtype);

Explanation
We get the vertex for which we want to update data by MATCH (v{propertyName:'Anything'}) and then we update the data by using SET v.propertyName = 'Updated Details'.

For more details visit: https://age.apache.org/overview/

AGE Github Link: https://github.com/apache/age

AGE Viewer Github Link: https://github.com/apache/age-viewer

Top comments (0)