From 203f030235d5c232be66833e72e5908d596c13bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Aur=C3=A9lio=20Silva=20de=20Souza=20J=C3=BAnior?= <57829631+markgomer@users.noreply.github.com> Date: Fri, 5 Apr 2024 16:05:25 -0300 Subject: [PATCH] Update README.md - Review the Quick Start section in order to make it more concise and less redundant. - The commands weren't working if issued in the written order. - I kept only the commands that create entities with labels and properties, rather than separate commands for each step. --- README.md | 58 +++++++++---------------------------------------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 6f1aab93a..bbe72c313 100644 --- a/README.md +++ b/README.md @@ -229,58 +229,23 @@ To create a graph, use the create_graph function located in the ag_catalog names SELECT create_graph('graph_name'); ``` -To create a single vertex, use the CREATE clause. - -```bash -SELECT * -FROM cypher('graph_name', $$ - CREATE (n) -$$) as (v agtype); -``` - - -To create a single vertex with the label, use the CREATE clause. - -```bash -SELECT * -FROM cypher('graph_name', $$ - CREATE (:label) -$$) as (v agtype); -``` - To create a single vertex with label and properties, use the CREATE clause. ```bash SELECT * FROM cypher('graph_name', $$ - CREATE (:label {property:value}) + CREATE (:label {property:"Node A"}) $$) as (v agtype); ``` -To query the graph, you can use the MATCH clause. - ```bash SELECT * FROM cypher('graph_name', $$ - MATCH (v) - RETURN v + CREATE (:label {property:"Node B"}) $$) as (v agtype); ``` -You can use the following to create an edge, for example, between two nodes. - -```bash -SELECT * -FROM cypher('graph_name', $$ - MATCH (a:label), (b:label) - WHERE a.property = 'Node A' AND b.property = 'Node B' - CREATE (a)-[e:RELTYPE]->(b) - RETURN e -$$) as (e agtype); -``` - - -To create an edge and set properties. +To create an edge between two nodes and set its properties: ```bash SELECT * @@ -292,19 +257,14 @@ FROM cypher('graph_name', $$ $$) as (e agtype); ``` -Example +And to query the connected nodes: -```bash -SELECT * -FROM cypher('graph_name', $$ - MATCH (a:Person), (b:Person) - WHERE a.name = 'Node A' AND b.name = 'Node B' - CREATE (a)-[e:RELTYPE {name:a.name + '<->' + b.name}]->(b) - RETURN e -$$) as (e agtype); ``` - - +SELECT * from cypher('graph_name', $$ + MATCH (V)-[R]-(V2) + RETURN V,R,V2 +$$) as (V agtype, R agtype, V2 agtype); +```

  Language Specific Drivers