From 4f74430dcbce74b55fec4107f58b51147c08decc Mon Sep 17 00:00:00 2001 From: randomJoe211 <69501902+randomJoe211@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:04:32 +0800 Subject: [PATCH] Update 5.lookup.md (#1130) --- .../7.general-query-statements/5.lookup.md | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md index 33543712595..94d2e40f847 100644 --- a/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/5.lookup.md @@ -98,8 +98,8 @@ nebula> LOOKUP ON player \ +-------------+ | VertexID | +-------------+ -| "player144" | | "player140" | +| "player144" | +-------------+ nebula> LOOKUP ON player \ @@ -109,8 +109,8 @@ nebula> LOOKUP ON player \ +-------------+-------------------------+------------------------+ | VertexID | properties(VERTEX).name | properties(VERTEX).age | +-------------+-------------------------+------------------------+ -| "player149" | "Ben Simmons" | 22 | | "player134" | "Blake Griffin" | 30 | +| "player149" | "Ben Simmons" | 22 | +-------------+-------------------------+------------------------+ nebula> LOOKUP ON player \ @@ -118,11 +118,11 @@ nebula> LOOKUP ON player \ YIELD properties(vertex).name AS name |\ GO FROM $-.VertexID OVER serve \ YIELD $-.name, properties(edge).start_year, properties(edge).end_year, properties($$).name; -+---------------+------------------+----------------+--------------+ -| $-.name | serve.start_year | serve.end_year | $$.team.name | -+---------------+------------------+----------------+--------------+ -| "Kobe Bryant" | 1996 | 2016 | "Lakers" | -+---------------+------------------+----------------+--------------+ ++---------------+-----------------------------+---------------------------+---------------------+ +| $-.name | properties(EDGE).start_year | properties(EDGE).end_year | properties($$).name | ++---------------+-----------------------------+---------------------------+---------------------+ +| "Kobe Bryant" | 1996 | 2016 | "Lakers" | ++---------------+-----------------------------+---------------------------+---------------------+ ``` ## 检索边 @@ -144,10 +144,9 @@ nebula> LOOKUP ON follow \ +-------------+-------------+---------+ | SrcVID | DstVID | Ranking | +-------------+-------------+---------+ -| "player101" | "player102" | 0 | -| "player133" | "player114" | 0 | -| "player133" | "player144" | 0 | -+-------------+-------------+---------+ +| "player150" | "player143" | 0 | +| "player150" | "player137" | 0 | +| "player148" | "player136" | 0 | ... nebula> LOOKUP ON follow \ @@ -156,10 +155,9 @@ nebula> LOOKUP ON follow \ +-------------+-------------+---------+-------------------------+ | SrcVID | DstVID | Ranking | properties(EDGE).degree | +-------------+-------------+---------+-------------------------+ -| "player121" | "player116" | 0 | 90 | -| "player121" | "player128" | 0 | 90 | -| "player121" | "player129" | 0 | 90 | -+-------------+-------------+---------+-------------------------+ +| "player150" | "player143" | 0 | 90 | +| "player150" | "player137" | 0 | 90 | +| "player148" | "player136" | 0 | 90 | ... nebula> LOOKUP ON follow \ @@ -210,26 +208,26 @@ nebula> LOOKUP ON follow \ +-------------+ ``` -- 查找Edge type为`like`的所有边的信息。 +- 查找Edge type为`follow`的所有边的信息。 ```ngql - nebula> CREATE EDGE like(likeness int); + nebula> CREATE EDGE follow(degree int); - nebula> CREATE EDGE INDEX like_index on like(); + nebula> CREATE EDGE INDEX follow_index on follow(); - nebula> REBUILD EDGE INDEX like_index; + nebula> REBUILD EDGE INDEX follow_index; +------------+ | New Job Id | +------------+ | 88 | +------------+ - nebula> INSERT EDGE like(likeness) \ + nebula> INSERT EDGE follow(degree) \ VALUES "player100"->"player101":(95); - # 列出所有的 like 边。类似于 MATCH (s)-[e:like]->(d) RETURN id(s), rank(e), id(d) /*, type(e) */。 + # 列出所有的 follow 边。类似于 MATCH (s)-[e:follow]->(d) RETURN id(s), rank(e), id(d) /*, type(e) */。 - nebula)> LOOKUP ON like; + nebula)> LOOKUP ON follow; +-------------+-------------+---------+ | SrcVID | DstVID | Ranking | +-------------+-------------+---------+ @@ -239,7 +237,7 @@ nebula> LOOKUP ON follow \ ## 统计点或边 -统计Tag为`player`的点和Edge type为`like`的边。 +统计Tag为`player`的点和Edge type为`follow`的边。 ```ngql nebula> LOOKUP ON player |\ @@ -247,18 +245,18 @@ nebula> LOOKUP ON player |\ +---------------+ | Player_Number | +---------------+ -| 2 | +| 51 | +---------------+ -nebula> LOOKUP ON like | \ - YIELD COUNT(*) AS Like_Number; -+-------------+ -| Like_Number | -+-------------+ -| 1 | -+-------------+ +nebula> LOOKUP ON follow | \ + YIELD COUNT(*) AS Follow_Number; ++---------------+ +| Follow_Number | ++---------------+ +| 81 | ++---------------+ ``` !!! note - 使用[`show-stats`命令](./6.show/14.show-stats.md)也可以统计点和边。 + 使用[`SHOW STATS`命令](./6.show/14.show-stats.md)也可以统计点和边。