From 9e1e0591b361c9ef14aa4a24f486b3c3ec227545 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:05:03 +0800 Subject: [PATCH] Modify the description of graph pattern (#119) (#2385) * Modify the description of graph pattern The upper and lower bounds of the graph pattern can be set. * Update 2.match.md * update * update * Update 3.graph-patterns.md --- .../1.nGQL-overview/3.graph-patterns.md | 15 ++++----------- .../7.general-query-statements/2.match.md | 14 ++++++++------ .../1.nGQL-overview/3.graph-patterns.md | 10 ++++------ 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/docs-2.0-en/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md b/docs-2.0-en/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md index dffa6db24aa..52162b61699 100644 --- a/docs-2.0-en/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md +++ b/docs-2.0-en/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md @@ -130,21 +130,14 @@ The preceding example defines a path with a minimum length of 3 and a maximum le It describes a graph of either 4 vertices and 3 edges, 5 vertices and 4 edges, or 6 vertices and 5 edges, all connected in a single path. -The lower bound can be omitted. For example, to describe paths of length 5 or less, use: +You may specify either the upper limit or lower limit of the length range, or neither of them, for example: ```ngql -(a)-[*..5]->(b) +(a)-[*..5]->(b) // The minimum length is 1 and the maximum length is 5. +(a)-[*3..]->(b) // The minimum length is 3 and the maximum length is infinity. +(a)-[*]->(b) // The minimum length is 1 and the maximum length is infinity. ``` -!!! note - - The upper bound must be specified. The following are **NOT** accepted. - - ```ngql - (a)-[*3..]->(b) - (a)-[*]->(b) - ``` - ## Assigning to path variables As described above, a series of connected vertices and edges is called a `path`. nGQL allows diff --git a/docs-2.0-en/3.ngql-guide/7.general-query-statements/2.match.md b/docs-2.0-en/3.ngql-guide/7.general-query-statements/2.match.md index 616eb1d10db..3c15f9b4a8d 100644 --- a/docs-2.0-en/3.ngql-guide/7.general-query-statements/2.match.md +++ b/docs-2.0-en/3.ngql-guide/7.general-query-statements/2.match.md @@ -469,16 +469,18 @@ nebula> MATCH (v:player{name:"Tim Duncan"}) -[*0]-> (v2) \ ### Match variable-length paths -You can use the `:*[minHop..maxHop]` pattern to match variable-length paths.`minHop` and `maxHop` are optional and default to 1 -and infinity respectively. +You can use the `:*[minHop..maxHop]` pattern to match variable-length paths.`minHop` and `maxHop` are optional and default to 1 and infinity respectively. -!!! note +!!! caution - When setting bounds, at least one of `minHop` and `maxHop` exists. + If `maxHop` is not set, it may cause the Graph service to OOM. Execute this command with caution. -!!! caution +| Parameter | Description | +| :------- | :----------------------------------------------------------------------- | +| `minHop` | Optional. `minHop` indicates the minimum length of the path, which must be a non-negative integer. The default value is 1. | +| `maxHop` | Optional. `maxHop` indicates the maximum length of the path, which must be a non-negative integer. The default value is infinity. | - If `maxHop` is not set, it may cause the Graph service to OOM, execute this command with caution. +If neither `minHop` nor `maxHop` is specified, and only `:*` is set, the default values are applied to both, i.e., `minHop` is 1 and `maxHop` is infinity. ```ngql nebula> MATCH p=(v:player{name:"Tim Duncan"})-[e:follow*]->(v2) \ diff --git a/docs-2.0-zh/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md b/docs-2.0-zh/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md index e51d403d6ad..81ee91931a9 100644 --- a/docs-2.0-zh/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md +++ b/docs-2.0-zh/3.ngql-guide/1.nGQL-overview/3.graph-patterns.md @@ -130,16 +130,14 @@ 该模式描述了 4 点 3 边、5 点 4 边或 6 点 5 边组成的图。 -也可以忽略最小长度,只指定最大长度,例如: +也可以指定长度范围的上限或下限,也可以两个都不指定,例如: ```ngql -(a)-[*..5]->(b) +(a)-[*..5]->(b) // 最小长度为 1,最大长度为 5。 +(a)-[*3..]->(b) // 最小长度为 3,最大长度为无穷大。 +(a)-[*]->(b) // 最小长度为 1,最大长度为无穷大。 ``` -!!! note - - 必须指定最大长度,**不支持**仅指定最小长度(`(a)-[*3..]->(b)`)或都不指定(`(a)-[*]->(b)`)。 - ## 路径变量 一系列连接的点和边称为`路径`。nGQL 允许使用变量来命名路径,例如: