apache-age

Apache AGE- Get all Edges


I'm using the Apache AGE extension, I have a graph named Family with a vertex named PERSON. And many edges such as CHILD_OF, GRANDCHILD_OF, UNCLE_OF, AUNT_OF.
Now what I want is to display all the edges present in the graph.
I can get the Vertices using the query:

SELECT * FROM cypher('Family', $$
MATCH (a)
RETURN a

This would list down all the vertices and their properties.
I want to do the same with edges, how would I do that?


Solution

  • To display all the edges you can use the MATCH clause as

    SELECT * FROM cypher('Family', $$
    MATCH (a)-[e]->(b)
    RETURN e
    

    Now if you want to put a filter on which edge to display based on label, you can do as

    SELECT * FROM cypher('Family', $$
    MATCH (a)-[e: CHILD_OF]->(b)
    RETURN e
    

    Read about MATCH clause in the doc