From d2252ab5c6e6c48e39a9515d5043ade63900b586 Mon Sep 17 00:00:00 2001 From: "abby.huang" <78209557+abby-cyber@users.noreply.github.com> Date: Mon, 30 Jan 2023 15:30:31 +0800 Subject: [PATCH] Optional match does not support where clauses (#2515) * Optional match does not support where clauses * Update 6.cheatsheet-for-ngql-command.md * desc updates --- .../6.cheatsheet-for-ngql-command.md | 2 +- .../optional-match.md | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs-2.0/2.quick-start/6.cheatsheet-for-ngql-command.md b/docs-2.0/2.quick-start/6.cheatsheet-for-ngql-command.md index f88544a6598..5b48a2c7c2a 100644 --- a/docs-2.0/2.quick-start/6.cheatsheet-for-ngql-command.md +++ b/docs-2.0/2.quick-start/6.cheatsheet-for-ngql-command.md @@ -214,7 +214,7 @@ | 模式 | 示例 | 说明 | | ------------------- | ------------------------------------------------------------ | ---------------------------------------------- | - |作为MATCH语句的可选项去匹配图数据库中的模式 | `MATCH (m)-[]->(n) WHERE id(m)=="player100" OPTIONAL MATCH (n)-[]->(l) WHERE id(n)=="player125" RETURN id(m),id(n),id(l)` | 如果图数据库中没有对应的模式,对应的列返回NULL。| + |作为`MATCH`语句的可选项去匹配图数据库中的模式 | `MATCH (m)-[]->(n) WHERE id(m)=="player100" OPTIONAL MATCH (n)-[]->(l) RETURN id(m),id(n),id(l)` | 如果图数据库中没有对应的模式,对应的列返回`NULL`。| * [LOOKUP](../3.ngql-guide/7.general-query-statements/5.lookup.md) diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/optional-match.md b/docs-2.0/3.ngql-guide/7.general-query-statements/optional-match.md index e25925621e4..48d03858b83 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/optional-match.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/optional-match.md @@ -10,19 +10,27 @@ 本文操作仅适用于 nGQL 中的 openCypher 方式。 +## 使用限制 + +`OPTIONAL MATCH`子句中暂不支持使用`WHERE`子句。 + ## 示例 `MATCH`语句中使用`OPTIONAL MATCH`的示例如下: ```ngql nebula> MATCH (m)-[]->(n) WHERE id(m)=="player100" \ - OPTIONAL MATCH (n)-[]->(l) WHERE id(n)=="player125" \ + OPTIONAL MATCH (n)-[]->(l) \ RETURN id(m),id(n),id(l); +-------------+-------------+-------------+ | id(m) | id(n) | id(l) | +-------------+-------------+-------------+ | "player100" | "team204" | __NULL__ | -| "player100" | "player101" | __NULL__ | +| "player100" | "player101" | "team204" | +| "player100" | "player101" | "team215" | +| "player100" | "player101" | "player100" | +| "player100" | "player101" | "player102" | +| "player100" | "player101" | "player125" | | "player100" | "player125" | "team204" | | "player100" | "player125" | "player100" | +-------------+-------------+-------------+ @@ -32,11 +40,16 @@ nebula> MATCH (m)-[]->(n) WHERE id(m)=="player100" \ ```ngql nebula> MATCH (m)-[]->(n) WHERE id(m)=="player100" \ - MATCH (n)-[]->(l) WHERE id(n)=="player125" \ + MATCH (n)-[]->(l) \ RETURN id(m),id(n),id(l); +-------------+-------------+-------------+ | id(m) | id(n) | id(l) | +-------------+-------------+-------------+ +| "player100" | "player101" | "team204" | +| "player100" | "player101" | "team215" | +| "player100" | "player101" | "player100" | +| "player100" | "player101" | "player102" | +| "player100" | "player101" | "player125" | | "player100" | "player125" | "team204" | | "player100" | "player125" | "player100" | +-------------+-------------+-------------+