Skip to content

Commit

Permalink
Update 6.cheatsheet-for-ngql.md (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
abby-cyber authored Nov 26, 2021
1 parent a3370e0 commit fe500e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs-2.0/2.quick-start/6.cheatsheet-for-ngql.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@
| Match edge type properties | ` MATCH (v:player{name:"Tim Duncan"})-[e:follow{degree:95}]->(v2) RETURN e` | You can specify edge type properties with `{<prop_name>: <prop_value>}` in a pattern. For example: `[e:follow{likeness:95}]`. |
| Match multiple edge types | `MATCH (v:player{name:"Tim Duncan"})-[e:follow | :serve]->(v2) RETURN e` | The `|` symbol can help matching multiple edge types. For example: `[e:follow|:serve]`. The English colon (:) before the first edge type cannot be omitted, but the English colon before the subsequent edge type can be omitted, such as `[e:follow|serve]`. |
| Match multiple edges | `MATCH (v:player{name:"Tim Duncan"})-[]->(v2)<-[e:serve]-(v3) RETURN v2, v3` | You can extend a pattern to match multiple edges in a path. |
| Match fixed-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) RETURN DISTINCT v2 AS Friends` | You can use the `:<edge_type>*<hop>` pattern to match a fixed-length path. `hop` must be a non-negative integer. |
| Match variable-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2) RETURN v2 AS Friends` | `minHop`: Optional. It represents the minimum length of the path. `minHop`: must be a non-negative integer. The default value is 1.<br>`maxHop`: Required. It represents the maximum length of the path. `maxHop` must be a non-negative integer. It has no default value. |
| Match variable-length paths with multiple edge types | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow | serve*2]->(v2) RETURN DISTINCT v2` | You can specify multiple edge types in a fixed-length or variable-length pattern. In this case, `hop`, `minHop`, and `maxHop` take effect on all edge types. |
| Match fixed-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*2]->(v2) RETURN DISTINCT v2 AS Friends` | You can use the `:<edge_type>*<hop>` pattern to match a fixed-length path. `hop` must be a non-negative integer. The data type of `e` is the list.|
| Match variable-length paths | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*1..3]->(v2) RETURN v2 AS Friends` | `minHop`: Optional. It represents the minimum length of the path. `minHop`: must be a non-negative integer. The default value is 1.<br>`maxHop`: Required. It represents the maximum length of the path. `maxHop` must be a non-negative integer. It has no default value. The data type of `e` is the list.|
| Match variable-length paths with multiple edge types | `MATCH p=(v:player{name:"Tim Duncan"})-[e:follow | serve*2]->(v2) RETURN DISTINCT v2` | You can specify multiple edge types in a fixed-length or variable-length pattern. In this case, `hop`, `minHop`, and `maxHop` take effect on all edge types. The data type of `e` is the list.|
| Retrieve vertex or edge information | `MATCH (v:player{name:"Tim Duncan"}) RETURN v`<br>`MATCH (v:player{name:"Tim Duncan"})-[e]->(v2) RETURN e` | Use `RETURN {<vertex_name> | <edge_name>}` to retrieve all the information of a vertex or an edge. |
| Retrieve VIDs | `MATCH (v:player{name:"Tim Duncan"}) RETURN id(v)` | Use the `id()` function to retrieve VIDs. |
| Retrieve tags | `MATCH (v:player{name:"Tim Duncan"}) RETURN labels(v)` | Use the `labels()` function to retrieve the list of tags on a vertex.<br>To retrieve the nth element in the `labels(v)` list, use `labels(v)[n-1]`. |
Expand Down

0 comments on commit fe500e1

Please sign in to comment.