Skip to content

Commit cee1d96

Browse files
authored
Update README.md (#1728)
- 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.
1 parent 80d847a commit cee1d96

File tree

1 file changed

+9
-49
lines changed

1 file changed

+9
-49
lines changed

README.md

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -225,58 +225,23 @@ To create a graph, use the create_graph function located in the ag_catalog names
225225
SELECT create_graph('graph_name');
226226
```
227227

228-
To create a single vertex, use the CREATE clause.
229-
230-
```bash
231-
SELECT *
232-
FROM cypher('graph_name', $$
233-
CREATE (n)
234-
$$) as (v agtype);
235-
```
236-
237-
238-
To create a single vertex with the label, use the CREATE clause.
239-
240-
```bash
241-
SELECT *
242-
FROM cypher('graph_name', $$
243-
CREATE (:label)
244-
$$) as (v agtype);
245-
```
246-
247228
To create a single vertex with label and properties, use the CREATE clause.
248229

249230
```bash
250231
SELECT *
251232
FROM cypher('graph_name', $$
252-
CREATE (:label {property:value})
233+
CREATE (:label {property:"Node A"})
253234
$$) as (v agtype);
254235
```
255236

256-
To query the graph, you can use the MATCH clause.
257-
258237
```bash
259238
SELECT *
260239
FROM cypher('graph_name', $$
261-
MATCH (v)
262-
RETURN v
240+
CREATE (:label {property:"Node B"})
263241
$$) as (v agtype);
264242
```
265243

266-
You can use the following to create an edge, for example, between two nodes.
267-
268-
```bash
269-
SELECT *
270-
FROM cypher('graph_name', $$
271-
MATCH (a:label), (b:label)
272-
WHERE a.property = 'Node A' AND b.property = 'Node B'
273-
CREATE (a)-[e:RELTYPE]->(b)
274-
RETURN e
275-
$$) as (e agtype);
276-
```
277-
278-
279-
To create an edge and set properties.
244+
To create an edge between two nodes and set its properties:
280245

281246
```bash
282247
SELECT *
@@ -288,19 +253,14 @@ FROM cypher('graph_name', $$
288253
$$) as (e agtype);
289254
```
290255

291-
Example
256+
And to query the connected nodes:
292257

293-
```bash
294-
SELECT *
295-
FROM cypher('graph_name', $$
296-
MATCH (a:Person), (b:Person)
297-
WHERE a.name = 'Node A' AND b.name = 'Node B'
298-
CREATE (a)-[e:RELTYPE {name:a.name + '<->' + b.name}]->(b)
299-
RETURN e
300-
$$) as (e agtype);
301258
```
302-
303-
259+
SELECT * from cypher('graph_name', $$
260+
MATCH (V)-[R]-(V2)
261+
RETURN V,R,V2
262+
$$) as (V agtype, R agtype, V2 agtype);
263+
```
304264

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

0 commit comments

Comments
 (0)