Skip to content

Commit

Permalink
Update README.md (#1728)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
markgomer authored Apr 10, 2024
1 parent 80d847a commit cee1d96
Showing 1 changed file with 9 additions and 49 deletions.
58 changes: 9 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,58 +225,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 *
Expand All @@ -288,19 +253,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);
```

<h2><img height="20" src="/img/gettingstarted.svg">&nbsp;&nbsp;Language Specific Drivers</h2>

Expand Down

0 comments on commit cee1d96

Please sign in to comment.