Skip to content

Commit

Permalink
[doc]keywords migrate (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
amber-moe authored Apr 8, 2020
1 parent 9507e36 commit 6c35827
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 6 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# 关键字和保留字

关键字是在 nGQL 中具有重要意义的单词。保留关键字需引用方可使用。

非保留关键字无需引用可直接使用,且所有非保留字都会自动转换成小写,所以非保留字是不区分大小写。保留关键字需使用反引号标注方可使用,例如 \`AND\`

```ngql
nebula> CREATE TAG TAG(name string);
[ERROR (-7)]: SyntaxError: syntax error near `TAG'
nebula> CREATE TAG SPACE(name string); -- SPACE 为非保留关键字
Execution succeeded
nebula> SHOW TAGS; -- 所有非保留字都会自动转换成小写
=============
| ID | Name |
=============
| 25 | space|
-------------
```

`TAG` 为保留字使用时必须使用反引号。 `SPACE` 为非保留字使用时无需加反引号。

```ngql
nebula> CREATE TAG `TAG` (name string); -- 此处 TAG 为保留字
Execution succeeded
```

## 保留字

以下列表为 nGQL 中的保留字。

```ngql
ADD
ALTER
AND
AS
ASC
BALANCE
BIGINT
BOOL
BY
CHANGE
COMPACT
CREATE
DELETE
DESC
DESCRIBE
DISTINCT
DOUBLE
DOWNLOAD
DROP
EDGE
EDGES
EXISTS
FETCH
FIND
FLUSH
FROM
GET
GO
GRANT
IF
IN
INDEX
INDEXES
INGEST
INSERT
INT
INTERSECT
IS
LIMIT
LOOKUP
MATCH
MINUS
NO
NOT
NULL
OF
OFFSET
ON
OR
ORDER
OVER
OVERWRITE
PROP
REBUILD
RECOVER
REMOVE
RETURN
REVERSELY
REVOKE
SET
SHOW
STEPS
STOP
STRING
SUBMIT
TAG
TAGS
TIMESTAMP
TO
UNION
UPDATE
UPSERT
UPTO
USE
VERTEX
WHEN
WHERE
WITH
XOR
YIELD
```

## 非保留关键字

```ngql
ACCOUNT
ADMIN
ALL
AVG
BIDIRECT
BIT_AND
BIT_OR
BIT_XOR
CHARSET
COLLATE
COLLATION
CONFIGS
COUNT
COUNT_DISTINCT
DATA
DBA
DEFAULT
FORCE
GOD
GRAPH
GROUP
GUEST
HDFS
HOSTS
JOB
JOBS
LEADER
MAX
META
MIN
OFFLINE
PART
PARTITION_NUM
PARTS
PASSWORD
PATH
REPLICA_FACTOR
ROLE
ROLES
SHORTEST
SNAPSHOT
SNAPSHOTS
SPACE
SPACES
STATUS
STD
STORAGE
SUM
TTL_COL
TTL_DURATION
USER
USERS
UUID
VALUES
```
6 changes: 3 additions & 3 deletions docs/manual-CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* [位运算](2.query-language/2.functions-and-operators/bitwise-operators.md)
* [内置函数](2.query-language/2.functions-and-operators/built-in-functions.md)
* [比较运算](2.query-language/2.functions-and-operators/comparison-functions-and-operators.md)
* [聚合运算 (Group by)](2.query-language/2.functions-and-operators/group-by-function.md)
* [聚合运算](2.query-language/2.functions-and-operators/group-by-function.md)
* [分页 (Limit)](2.query-language/2.functions-and-operators/limit-syntax.md)
* [逻辑运算](2.query-language/2.functions-and-operators/logical-operators.md)
* [排序 (Order By)](2.query-language/2.functions-and-operators/order-by-function.md)
Expand All @@ -51,6 +51,7 @@
* [字符串类型](2.query-language/3.language-structure/literal-values/string-literals.md)
* [注释语法](2.query-language/3.language-structure/comment-syntax.md)
* [标识符大小写](2.query-language/3.language-structure/identifier-case-sensitivity.md)
* [关键字和保留字](2.query-language/3.language-structure/keywords-and-reserved-words.md)
* [管道](2.query-language/3.language-structure/pipe-syntax.md)
* [属性引用](2.query-language/3.language-structure/property-reference.md)
* [标识符命名规则](2.query-language/3.language-structure/schema-object-names.md)
Expand Down Expand Up @@ -152,11 +153,10 @@
* [C++ 编程风格](4.contributions/cpp-coding-style.md)
* [开发者文档风格](4.contributions/developer-documentation-style-guide.md)
* [如何贡献](4.contributions/how-to-contribute.md)
* [PR 和 Commit 信息指南](4.contributions/pull-request-commit-message-guidelines.md)

## 附录

* [Gremlin VS nGQL](5.appendix/gremlin-ngql.md)
* [Gremlin V.S. nGQL](5.appendix/gremlin-ngql.md)
* [Cypher V.S. nGQL](5.appendix/cypher-ngql.md)
* [升级 Nebula Graph](5.appendix/upgrade-guide.md)

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Keywords and Reserved Words

Keywords are words that have significance in nGQL. Certain keywords are reserved and require special treatment for use as identifiers.

Non-reserved keywords are permitted as identifiers without quoting. All the non-reserved keywords are automatically converted to lower case. Non-reserved keywords are non case-sensitive. Reserved words are permitted as identifiers if you quote them with single or double quotes such as \`AND\`.

```ngql
nebula> CREATE TAG TAG(name string);
[ERROR (-7)]: SyntaxError: syntax error near `TAG'
nebula> CREATE TAG SPACE(name string); -- SPACE is an unreserved KEY WORD
Execution succeeded
nebula> SHOW TAGS; -- All the non-reserved keywords are automatically converted to lower case.
=============
| ID | Name |
=============
| 25 | space|
-------------
```

`TAG` is a reserved keyword and must be quoted with backtick to be used as an identifier. `SPACE` is keyword but not reserved, so its use as identifiers does not require quoting.

```ngql
nebula> CREATE TAG `TAG` (name string); -- TAG is a reserved word here
Execution succeeded
```

## Reserved Words

The following list shows reserved words in nGQL.

```ngql
ADD
ALTER
AND
AS
ASC
BALANCE
BIGINT
BOOL
BY
CHANGE
COMPACT
CREATE
DELETE
DESC
DESCRIBE
DISTINCT
DOUBLE
DOWNLOAD
DROP
EDGE
EDGES
EXISTS
FETCH
FIND
FLUSH
FROM
GET
GO
GRANT
IF
IN
INDEX
INDEXES
INGEST
INSERT
INT
INTERSECT
IS
LIMIT
LOOKUP
MATCH
MINUS
NO
NOT
NULL
OF
OFFSET
ON
OR
ORDER
OVER
OVERWRITE
PROP
REBUILD
RECOVER
REMOVE
RETURN
REVERSELY
REVOKE
SET
SHOW
STEPS
STOP
STRING
SUBMIT
TAG
TAGS
TIMESTAMP
TO
UNION
UPDATE
UPSERT
UPTO
USE
VERTEX
WHEN
WHERE
WITH
XOR
YIELD
```

## Non-Reserved Keywords

```ngql
ACCOUNT
ADMIN
ALL
AVG
BIDIRECT
BIT_AND
BIT_OR
BIT_XOR
CHARSET
COLLATE
COLLATION
CONFIGS
COUNT
COUNT_DISTINCT
DATA
DBA
DEFAULT
FORCE
GOD
GRAPH
GROUP
GUEST
HDFS
HOSTS
JOB
JOBS
LEADER
MAX
META
MIN
OFFLINE
PART
PARTITION_NUM
PARTS
PASSWORD
PATH
REPLICA_FACTOR
ROLE
ROLES
SHORTEST
SNAPSHOT
SNAPSHOTS
SPACE
SPACES
STATUS
STD
STORAGE
SUM
TTL_COL
TTL_DURATION
USER
USERS
UUID
VALUES
```
2 changes: 1 addition & 1 deletion docs/manual-EN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ It is the optimal solution in the world capable of hosting graphs with dozens of
* [String Literals](2.query-language/3.language-structure/literal-values/string-literals.md)
* [Comment Syntax](2.query-language/3.language-structure/comment-syntax.md)
* [Identifier Case Sensitivity](2.query-language/3.language-structure/identifier-case-sensitivity.md)
* [Keywords and Reserved Words](2.query-language/3.language-structure/keywords-and-reserved-words.md)
* [Pipe Syntax](2.query-language/3.language-structure/pipe-syntax.md)
* [Property Reference](2.query-language/3.language-structure/property-reference.md)
* [Schema Object Names](2.query-language/3.language-structure/schema-object-names.md)
Expand Down Expand Up @@ -153,7 +154,6 @@ It is the optimal solution in the world capable of hosting graphs with dozens of
* [Cpp Coding Style](4.contributions/cpp-coding-style.md)
* [Developer Documentation Style Guide](4.contributions/developer-documentation-style-guide.md)
* [How to Contribute](4.contributions/how-to-contribute.md)
* [Pull Request Commit Message Guidelines](4.contributions/pull-request-commit-message-guidelines.md)

## Appendix

Expand Down

0 comments on commit 6c35827

Please sign in to comment.