titoausten commented on issue #918:
URL: https://github.com/apache/age/issues/918#issuecomment-1546589518

   Firstly, you should have a basis for creating edges and should have an idea 
of the nodes in the graph.
   
   For instance, if you have nodes with labels `Employee`, `Company` and `Role` 
and you want to add edges between them. Each node should have a property that 
might be similar to a property in another node.
   
   Now to create edges between nodes with labels `Employee` and `Company`, you 
simply use the `MATCH` clause. This will look like:
   ```
   SELECT * FROM cypher('graph', $$ MATCH (a:Employee), (b:Company) WHERE 
a.company = b.name CREATE (a)-[r:worksAt]->(b) RETURN r $$) as (r agtype);
   ```
   To create edges between nodes with labels `Employee` and `Role`, the query 
will be:
   ```
   SELECT * FROM cypher('graph', $$ MATCH (a:Employee), (b:Role) WHERE 
a.position = b.name CREATE (a)-[r:IS]->(b) RETURN r $$) as (r agtype);
   ```
   In conclusion, creating multiple edges is dependent on matching properties 
of nodes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to