Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #1728

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 9 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand All @@ -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);
```

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

Expand Down
Loading