DEV Community

Jawad Ali Abbasi
Jawad Ali Abbasi

Posted on

Using Cypher Queries For Manipulating Graphs | Apache AGE

Greetings!

As you all know, cypher queries are on the stage. So let's see how we can use them to create and fetch data.

Now cypher queries follow a particular syntax, so make you do not make any mistakes. Or even you do, no problem, that's the way to learn!

First, suppose we have to create a connection between two nodes using of course an edge, we would have to write the following query:

SELECT * FROM cypher('demo', $$ CREATE (:node)-[:edge] ->(:node) $$) AS (a agtype);

The above command will create two nodes and an edge between them and return the result an an 'agtype'.

Now, let's see how to retrieve these connections based on some criteria to match.

SELECT * FROM cypher('demo', $$ MATCH (n) RETURN n $$) AS (a agtype);

This command will return all the relations that match our criteria as an agtype.

https://age.apache.org/
https://github.com/apache/age

That's all for now guys!

Good Bye!

Top comments (0)