From c6b2b4025206c7fc4cf9376302305d7c56cd2068 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Mon, 13 Sep 2021 14:07:47 +0800 Subject: [PATCH 1/2] add cn doc (#708) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add cn doc * concat and show meta leader * Update 13.concat.md Co-authored-by: 朱晓青 <86282370+izhuxiaoqing@users.noreply.github.com> --- .../6.functions-and-expressions/13.concat.md | 109 ++++++++++++++++++ .../6.show/19.show-meta-leader.md | 27 +++++ .../1.authentication/4.ldap.md | 103 +++++++++++++++++ .../improve-query-by-tag-index.md | 53 +++++++++ mkdocs.yml | 6 +- 5 files changed, 297 insertions(+), 1 deletion(-) create mode 100644 docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md create mode 100644 docs-2.0/3.ngql-guide/7.general-query-statements/6.show/19.show-meta-leader.md create mode 100644 docs-2.0/7.data-security/1.authentication/4.ldap.md create mode 100644 docs-2.0/8.service-tuning/improve-query-by-tag-index.md diff --git a/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md new file mode 100644 index 00000000000..7be8e392f96 --- /dev/null +++ b/docs-2.0/3.ngql-guide/6.functions-and-expressions/13.concat.md @@ -0,0 +1,109 @@ +# concat function + +The `concat()` and `concat_ws()` functions return strings concatenated by one or more strings. + +## concat() function + +The `concat()` function requires at least two or more strings. All the parameters are concatenated into one string. + +- If there is only one string, the string itself is returned. + +- If any one of the strings is `NULL`, `NULL` is returned. + +### Syntax + +```bash +concat(string1,string2,...) +``` + +### Examples + +```bash +//This example concatenates 1, 2, and 3. +nebula> RETURN concat("1","2","3") AS r; ++-------+ +| r | ++-------+ +| "123" | ++-------+ + +//In this example, one of the string is NULL. +nebula> RETURN concat("1","2",NULL) AS r; ++----------+ +| r | ++----------+ +| __NULL__ | ++----------+ + +nebula> GO FROM "player100" over follow \ + YIELD concat(follow._src, $^.player.age, $$.player.name, follow.degree) AS A; ++------------------------------+ +| A | ++------------------------------+ +| "player10042Tony Parker95" | ++------------------------------+ +| "player10042Manu Ginobili95" | ++------------------------------+ +``` + +## concat_ws() function + +The `concat_ws()` function connects two or more strings with a predefined separator. + +- If the separator is `NULL`, the `concat_ws()` function returns `NULL`. + +- If the separator is not `NULL` and there is only one string, the string itself is returned. + +- If the separator is not `NULL` and there is a `NULL` in the strings, `NULL` is ignored during the concatenation. + +### Syntax + +```bash +concat_ws(separator,string1,string2,... ) +``` + +### Examples + +```bash +//This example concatenates a, b, and c with the separator +. +nebula> RETURN concat_ws("+","a","b","c") AS r; ++---------+ +| r | ++---------+ +| "a+b+c" | ++---------+ + +//In this example, the separator is NULL. +neubla> RETURN concat_ws(NULL,"a","b","c") AS r; ++----------+ +| r | ++----------+ +| __NULL__ | ++----------+ + +//In this example, the separator is + and there is a NULL in the strings. +nebula> RETURN concat_ws("+","a",NULL,"b","c") AS r; ++---------+ +| r | ++---------+ +| "a+b+c" | ++---------+ + +//In this example, the separator is + and there is only one string. +nebula> RETURN concat_ws("+","a") AS r; ++-----+ +| r | ++-----+ +| "a" | ++-----+ + +nebula> GO FROM "player100" over follow \ + YIELD concat_ws(" ",follow._src, $^.player.age, $$.player.name, follow.degree) AS A; ++---------------------------------+ +| A | ++---------------------------------+ +| "player100 42 Tony Parker 95" | ++---------------------------------+ +| "player100 42 Manu Ginobili 95" | ++---------------------------------+ +``` diff --git a/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/19.show-meta-leader.md b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/19.show-meta-leader.md new file mode 100644 index 00000000000..60f9afaad56 --- /dev/null +++ b/docs-2.0/3.ngql-guide/7.general-query-statements/6.show/19.show-meta-leader.md @@ -0,0 +1,27 @@ +# SHOW META LEADER + +The `SHOW META LEADER` statement shows the information of the leader in the current Meta cluster. + +For more information about the Meta service, see [Meta service](../../../1.introduction/3.nebula-graph-architecture/2.meta-service.md). + +## Syntax + +```ngql +SHOW META LEADER; +``` + +## Example + +```ngql +nebula> SHOW META LEADER; ++------------------+---------------------------+ +| Meta Leader | secs from last heart beat | ++------------------+---------------------------+ +| "127.0.0.1:9559" | 3 | ++------------------+---------------------------+ +``` + +|Parameter|Description| +|:---|:---| +|`Meta Leader`|Shows the information of the leader in the Meta cluster, including the IP address and port of the server where the leader is located.| +|`secs from last heart beat`|Indicates the time interval since the last heartbeat. This parameter is measured in seconds.| diff --git a/docs-2.0/7.data-security/1.authentication/4.ldap.md b/docs-2.0/7.data-security/1.authentication/4.ldap.md new file mode 100644 index 00000000000..05dcd06cf9d --- /dev/null +++ b/docs-2.0/7.data-security/1.authentication/4.ldap.md @@ -0,0 +1,103 @@ + \ No newline at end of file diff --git a/docs-2.0/8.service-tuning/improve-query-by-tag-index.md b/docs-2.0/8.service-tuning/improve-query-by-tag-index.md new file mode 100644 index 00000000000..2fdfab05049 --- /dev/null +++ b/docs-2.0/8.service-tuning/improve-query-by-tag-index.md @@ -0,0 +1,53 @@ + +# 增加和删除标签 + +在openCypher中,有增加标签(`SET label`)和移除标签(`REMOVE label`)的功能,可以用于加速查询或者标记过程。 + +在Nebula Graph中,可以通过Tag变相实现相同操作,创建Tag并将Tag插入到已有的点上,就可以根据Tag名称快速查找点,也可以通过`DELETE TAG`删除某些点上不再需要的Tag。 + +!!! caution + + 请确保点上已经有另一个Tag,否则删除点上最后一个Tag时,会导致点也被删除。 + +## 示例 + +例如在basketballplayer数据集中,部分篮球运动员同时也是球队股东,可以为股东Tag`shareholder`创建索引,方便快速查找。如果不再是股东,可以通过`DELETE TAG`语句删除相应运动员的股东Tag。 + +```ngql +//创建股东Tag和索引 +nebula> CREATE TAG shareholder(); +nebula> CREATE TAG INDEX shareholder_tag on shareholder(); +//为点添加Tag +nebula> INSERT VERTEX shareholder() VALUES "player100":(); +nebula> INSERT VERTEX shareholder() VALUES "player101":(); +//快速查询所有股东 +nebula> MATCH (v:shareholder) RETURN v; ++---------------------------------------------------------------------+ +| v | ++---------------------------------------------------------------------+ +| ("player100" :player{age: 42, name: "Tim Duncan"} :shareholder{}) | ++---------------------------------------------------------------------+ +| ("player101" :player{age: 36, name: "Tony Parker"} :shareholder{}) | ++---------------------------------------------------------------------+ +nebula> LOOKUP ON shareholder; ++-------------+ +| VertexID | ++-------------+ +| "player100" | ++-------------+ +| "player101" | ++-------------+ +//如果player100不再是股东 +nebula> DELETE TAG shareholder FROM "player100"; +nebula> LOOKUP ON shareholder; ++-------------+ +| VertexID | ++-------------+ +| "player101" | ++-------------+ +``` + +!!! note + + 如果插入测试数据后才创建索引,请用`REBUILD TAG INDEX ;`语句重建索引。 +--> \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 1304afeafa6..0de87b5f4db 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -162,6 +162,7 @@ nav: - collect(): 3.ngql-guide/6.functions-and-expressions/10.collect.md - reduce(): 3.ngql-guide/6.functions-and-expressions/11.reduce.md - hash(): 3.ngql-guide/6.functions-and-expressions/12.hash.md + - concat(): 3.ngql-guide/6.functions-and-expressions/13.concat.md - Predicate functions: 3.ngql-guide/6.functions-and-expressions/8.predicate.md - User-defined functions: 3.ngql-guide/6.functions-and-expressions/9.user-defined-functions.md @@ -189,6 +190,7 @@ nav: - SHOW USERS: 3.ngql-guide/7.general-query-statements/6.show/16.show-users.md - SHOW SESSIONS: 3.ngql-guide/7.general-query-statements/6.show/17.show-sessions.md - SHOW QUERIES: 3.ngql-guide/7.general-query-statements/6.show/18.show-queries.md + - SHOW META LEADER: 3.ngql-guide/7.general-query-statements/6.show/19.show-meta-leader.md - Clauses and options: - GROUP BY: 3.ngql-guide/8.clauses-and-options/group-by.md @@ -214,7 +216,7 @@ nav: - SHOW TAGS: 3.ngql-guide/10.tag-statements/4.show-tags.md - DESCRIBE TAG: 3.ngql-guide/10.tag-statements/5.describe-tag.md - DELETE TAG: 3.ngql-guide/10.tag-statements/6.delete-tag.md - + - Edge type statements: - CREATE EDGE: 3.ngql-guide/11.edge-type-statements/1.create-edge.md - DROP EDGE: 3.ngql-guide/11.edge-type-statements/2.drop-edge.md @@ -296,6 +298,7 @@ nav: - Authentication: 7.data-security/1.authentication/1.authentication.md - User management: 7.data-security/1.authentication/2.management-user.md - Roles and privileges: 7.data-security/1.authentication/3.role-list.md + - OpenLDAP authentication: 7.data-security/1.authentication/4.ldap.md # - Backup & Restore: # - What is Backup & Restore: 7.data-security/2.backup-restore/1.what-is-br.md # - Compile BR: 7.data-security/2.backup-restore/2.compile-br.md @@ -310,6 +313,7 @@ nav: - System design suggestions: 8.service-tuning/3.system-design.md - Execution plan: 8.service-tuning/4.plan.md - Processing super vertices: 8.service-tuning/super-node.md + - Add or delete tag: 8.service-tuning/improve-query-by-tag-index.md - Client: - Clients overview: 14.client/1.nebula-client.md From f6b28fa16cfc9afaf088b26f1d6233c1f2df8331 Mon Sep 17 00:00:00 2001 From: "max.zhu@vesoft.com" <86282370+izhuxiaoqing@users.noreply.github.com> Date: Tue, 14 Sep 2021 15:49:04 +0800 Subject: [PATCH 2/2] ldap and improve query by tag index (#711) * ldap and improve query by tag index * Update improve-query-by-tag-index.md * Update 4.ldap.md --- .../1.authentication/4.ldap.md | 80 +++++++++---------- .../improve-query-by-tag-index.md | 27 ++++--- 2 files changed, 53 insertions(+), 54 deletions(-) diff --git a/docs-2.0/7.data-security/1.authentication/4.ldap.md b/docs-2.0/7.data-security/1.authentication/4.ldap.md index 05dcd06cf9d..bdf721d3007 100644 --- a/docs-2.0/7.data-security/1.authentication/4.ldap.md +++ b/docs-2.0/7.data-security/1.authentication/4.ldap.md @@ -1,39 +1,38 @@ - \ No newline at end of file + After using OpenLDAP for authentication, local users (including `root`) cannot log in normally. diff --git a/docs-2.0/8.service-tuning/improve-query-by-tag-index.md b/docs-2.0/8.service-tuning/improve-query-by-tag-index.md index 2fdfab05049..e63ca267e59 100644 --- a/docs-2.0/8.service-tuning/improve-query-by-tag-index.md +++ b/docs-2.0/8.service-tuning/improve-query-by-tag-index.md @@ -1,26 +1,27 @@ - -# 增加和删除标签 +# Add and delete tags -在openCypher中,有增加标签(`SET label`)和移除标签(`REMOVE label`)的功能,可以用于加速查询或者标记过程。 +OpenCypher has the features of `SET label` and `REMOVE label` to speed up the process of querying or labeling. -在Nebula Graph中,可以通过Tag变相实现相同操作,创建Tag并将Tag插入到已有的点上,就可以根据Tag名称快速查找点,也可以通过`DELETE TAG`删除某些点上不再需要的Tag。 +Nebula Graph achieves the same operations by creating and inserting tags to an existing vertex, which can quickly query vertices based on the tag name. Users can also run `DELETE TAG` to delete some vertices that are no longer needed. !!! caution - 请确保点上已经有另一个Tag,否则删除点上最后一个Tag时,会导致点也被删除。 + Make sure that there is another tag on the vertex. Otherwise, the vertex will be deleted when the last tag is deleted. -## 示例 +## Examples -例如在basketballplayer数据集中,部分篮球运动员同时也是球队股东,可以为股东Tag`shareholder`创建索引,方便快速查找。如果不再是股东,可以通过`DELETE TAG`语句删除相应运动员的股东Tag。 +For example, in the `basketballplayer` data set, some basketball players are also team shareholders. Users can create an index for the shareholder tag `shareholder` for quick search. If the player is no longer a shareholder, users can delete the shareholder tag of the corresponding player by `DELETE TAG`. ```ngql -//创建股东Tag和索引 +//This example creates the shareholder tag and index. nebula> CREATE TAG shareholder(); nebula> CREATE TAG INDEX shareholder_tag on shareholder(); -//为点添加Tag + +//This example adds a tag on the vertex. nebula> INSERT VERTEX shareholder() VALUES "player100":(); nebula> INSERT VERTEX shareholder() VALUES "player101":(); -//快速查询所有股东 + +//This example queries all the shareholders. nebula> MATCH (v:shareholder) RETURN v; +---------------------------------------------------------------------+ | v | @@ -37,7 +38,8 @@ nebula> LOOKUP ON shareholder; +-------------+ | "player101" | +-------------+ -//如果player100不再是股东 + +//In this example, the "player100" is no longer a shareholder. nebula> DELETE TAG shareholder FROM "player100"; nebula> LOOKUP ON shareholder; +-------------+ @@ -49,5 +51,4 @@ nebula> LOOKUP ON shareholder; !!! note - 如果插入测试数据后才创建索引,请用`REBUILD TAG INDEX ;`语句重建索引。 ---> \ No newline at end of file + If the index is created after inserting the test data, use the `REBUILD TAG INDEX ;` statement to rebuild the index.