From ed56ccd5c00316d75e25b5bc92b8f3117f7dfdb8 Mon Sep 17 00:00:00 2001 From: dutor <440396+dutor@users.noreply.github.com> Date: Thu, 15 Aug 2019 20:39:25 +0800 Subject: [PATCH 01/18] Improved nebula.service (#772) --- scripts/nebula.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/nebula.service b/scripts/nebula.service index cac51948be9..eef028a9e08 100755 --- a/scripts/nebula.service +++ b/scripts/nebula.service @@ -119,7 +119,8 @@ function start_daemon { pid_file=$(get_pid_file_from_config ${config}) if [[ -f ${pid_file} ]]; then if is_process_running ${pid_file}; then - ERROR_AND_EXIT "Process already running: $(cat ${pid_file})" + ERROR "${daemon_name} already running: $(cat ${pid_file})" + return 1 fi fi From a0f35164250d5a3e6ee908d65573c21877247774 Mon Sep 17 00:00:00 2001 From: jude-zhu <51590253+jude-zhu@users.noreply.github.com> Date: Fri, 16 Aug 2019 14:51:50 +0800 Subject: [PATCH 02/18] Added logo in README.md (#787) * add log * update * change graph * change graph * update log * update log * update log * upload log * update log * update badge * add create space syntax * update link * update --- README.md | 8 +++- docs/logo.png | Bin 0 -> 17279 bytes .../Identifier_Case_Sensitivity.md | 2 +- .../Create_Space_Syntax.md | 39 ++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 docs/logo.png diff --git a/README.md b/README.md index c2cc45c295f..b041040e050 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +![](docs/logo.png) + +[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-green)](#licensing) +[![GitHub release](https://img.shields.io/badge/release-v1.0.0--beta-blue)](https://github.com/vesoft-inc/nebula/releases) + ## Nebula **Nebula** is a distributed, scalable, lighting-fast graph database. It is the only solution in the world capable to host graphs with dozens of billions of vertices (nodes) and trillions of edges, while still provides millisecond latency. @@ -12,8 +17,7 @@ As a graph database, **Nebula** has these features * SQL-like query language ## How can I get Nebula ## -**Nebula** source code is available here on [`GitHub`](https://github.com/vesoft-inc/nebula). The currently release is version 0.1. Please refer the `Release Notes` here for details. You can also download [`docker` ](https://www.docker.com/get-started)image to try it. -More details on how to get Nebula image click [`Get Started`](https://github.com/vesoft-inc/nebula/blob/master/docs/get-started.md). +Apart from installing **Nebula Graph** from source code, you can use the [official Nebula Graph image](https://hub.docker.com/r/vesoft/nebula-graph/tags). For more details on how to install Nebula Graph, see [Get Started](docs/get-started.md). ## How can I contribute ## As the team behind **Nebula**, we fully commit to the community and all-in to the open source project. All the core features are and will be implemented in the open source repository. diff --git a/docs/logo.png b/docs/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..604f158f696d7640ec5daa3b3d63f3a4b2bf9af0 GIT binary patch literal 17279 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 literal 0 HcmV?d00001 diff --git a/docs/manual_doc/Language_Structure/Identifier_Case_Sensitivity.md b/docs/manual_doc/Language_Structure/Identifier_Case_Sensitivity.md index b28c125cac0..27cc280a748 100644 --- a/docs/manual_doc/Language_Structure/Identifier_Case_Sensitivity.md +++ b/docs/manual_doc/Language_Structure/Identifier_Case_Sensitivity.md @@ -3,7 +3,7 @@ In Nebula Graph, Identifiers are case-sensitive. The following statement would not work because it refers to a space both as 'my_space' and as 'MY_SPACE': ``` -nebula> CREATE SPACE my_space(); +nebula> CREATE SPACE my_space; nebula> use MY_SPACE; ``` diff --git a/docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Create_Space_Syntax.md b/docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Create_Space_Syntax.md index e69de29bb2d..5c01dabd4a6 100644 --- a/docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Create_Space_Syntax.md +++ b/docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Create_Space_Syntax.md @@ -0,0 +1,39 @@ + +``` +CREATE SPACE space_name + (space_option,...) + +space_option: + option_name = value +``` + +This statement creates a new space. SPACE is a region that provides physically isolation of graphs in Nebula. + +### Space Name + +* **space_name** + + The name uniquely identifies the space in a cluster. The rules for the naming are given in [Schena_Object_Names.md](../../Language_Structure/Schema_Object_Names.md) + +### Space Options + +When creating a space, options can be given. An _option_name_ can be any of the following: +* _partition_num_ + + _partition_num_ specifies the number of partitions in one replica. The default value is 1024. + +* _replica_factor_ + + _replica_factor_ specifies the number of replicas in the cluster. The default replica factor is 1. + +However, if no option is given, Nebula Graph will create the space with default patition number and replica factor. + +### Example + +``` +CREATE SPACE my_space_1; -- create space with default partion number and replica factor +CREATE SPACE my_space_2(partition_num=10); -- create space with default replica factor +CREATE SPACE my_space_3(replica_factor=1); -- create space with default partion number +CREATE SPACE my_space_4(partition_num=10, replica_factor=1); +``` + From e052dff49150076eea727014b6d8983157f177ef Mon Sep 17 00:00:00 2001 From: yaphet Date: Fri, 16 Aug 2019 15:22:43 +0800 Subject: [PATCH 03/18] fix code style (#773) --- src/kvstore/NebulaStore.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/kvstore/NebulaStore.cpp b/src/kvstore/NebulaStore.cpp index 2dbcb227d7a..ce014088df3 100644 --- a/src/kvstore/NebulaStore.cpp +++ b/src/kvstore/NebulaStore.cpp @@ -161,7 +161,6 @@ void NebulaStore::addSpace(GraphSpaceID spaceId) { for (auto& path : options_.dataPaths_) { this->spaces_[spaceId]->engines_.emplace_back(newEngine(spaceId, path)); } - return; } @@ -194,7 +193,6 @@ void NebulaStore::addPart(GraphSpaceID spaceId, PartitionID partId) { partId, newPart(spaceId, partId, targetEngine.get())); LOG(INFO) << "Space " << spaceId << ", part " << partId << " has been added!"; - return; } std::shared_ptr NebulaStore::newPart(GraphSpaceID spaceId, @@ -320,7 +318,7 @@ void NebulaStore::asyncMultiPut(GraphSpaceID spaceId, return; } auto part = nebula::value(ret); - return part->asyncMultiPut(std::move(keyValues), std::move(cb)); + part->asyncMultiPut(std::move(keyValues), std::move(cb)); } @@ -334,7 +332,7 @@ void NebulaStore::asyncRemove(GraphSpaceID spaceId, return; } auto part = nebula::value(ret); - return part->asyncRemove(key, std::move(cb)); + part->asyncRemove(key, std::move(cb)); } @@ -348,7 +346,7 @@ void NebulaStore::asyncMultiRemove(GraphSpaceID spaceId, return; } auto part = nebula::value(ret); - return part->asyncMultiRemove(std::move(keys), std::move(cb)); + part->asyncMultiRemove(std::move(keys), std::move(cb)); } @@ -363,7 +361,7 @@ void NebulaStore::asyncRemoveRange(GraphSpaceID spaceId, return; } auto part = nebula::value(ret); - return part->asyncRemoveRange(start, end, std::move(cb)); + part->asyncRemoveRange(start, end, std::move(cb)); } @@ -377,7 +375,7 @@ void NebulaStore::asyncRemovePrefix(GraphSpaceID spaceId, return; } auto part = nebula::value(ret); - return part->asyncRemovePrefix(prefix, std::move(cb)); + part->asyncRemovePrefix(prefix, std::move(cb)); } ErrorOr> NebulaStore::part(GraphSpaceID spaceId, From 10bedc7e5dcbe526334487d27098469a5206d02e Mon Sep 17 00:00:00 2001 From: whitewum <50101159+whitewum@users.noreply.github.com> Date: Sat, 17 Aug 2019 13:54:29 +0800 Subject: [PATCH 04/18] [manual] add set op & fix many typos (#759) * add op set * rename from _ to - * fix minor bugs * add some explain for PIPE * fix latex issue * aligment * address comments of Judy * fix Judy's comment * fix judy comment 2 * rebase 1` --- .../data-types/numeric-types.md} | 2 +- .../data-types/string-types.md} | 0 .../comparison-functions-and-operators.md} | 0 .../functions-and-operator-reference.md} | 0 .../group-by-function.md} | 2 +- .../logical-operators.md} | 0 .../operator-precedence.md} | 0 .../order-by-function.md} | 2 +- .../functions-and-operators/set-operations.md | 172 ++++++++++++++++++ .../type-conversion.md | 12 ++ .../language-structure/comment-syntax.md} | 0 .../language-structure/expression.md} | 0 .../identifier-case-sensitivity.md} | 0 .../keywords-and-reserved-words.md} | 0 .../literal-values/NULL-values.md} | 0 .../literal-values/boolean-literals.md} | 4 +- .../literal-values/numeric-literals.md} | 0 .../literal-values/string-literals.md} | 0 .../language-structure/property-reference.md} | 8 +- .../schema-object-names.md} | 0 .../statement-composition.md} | 0 .../user-defined_variable.md} | 4 +- .../drop-user-syntax.md} | 0 .../variables-syntax.md} | 2 +- .../alter-tag-edge-syntax.md} | 0 .../create-space-syntax.md} | 1 + .../create-tag-edge-syntax.md} | 0 .../drop-edge-syntax.md} | 0 .../drop-space-syntax.md} | 0 .../drop-tag-syntax.md} | 0 .../show-syntax.md} | 0 .../fetch-syntax.md} | 0 .../go-syntax.md} | 0 .../insert-edge-syntax.md} | 2 +- .../insert-vertex-syntax.md} | 0 .../pipe-syntax.md | 22 +++ .../where-syntax.md} | 0 .../yield-syntax.md} | 2 +- .../utility-statements/describe-syntax.md} | 0 .../utility-statements/use-syntax.md | 19 ++ .../Type_Conversion.md | 3 - .../PIPE_Syntax.md | 13 -- .../Data_Definition_Statements/Show_Syntax.md | 0 .../Utility_Statements/USE_syntax.md | 20 -- 44 files changed, 241 insertions(+), 49 deletions(-) rename docs/{manual_doc/Data_Types/Nemeric_Types.md => manual-doc/data-types/numeric-types.md} (72%) rename docs/{manual_doc/Data_Types/String_Types.md => manual-doc/data-types/string-types.md} (100%) rename docs/{manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md => manual-doc/functions-and-operators/comparison-functions-and-operators.md} (100%) rename docs/{manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md => manual-doc/functions-and-operators/functions-and-operator-reference.md} (100%) rename docs/{manual_doc/Functions_and_Operators/Group_By_Function.md => manual-doc/functions-and-operators/group-by-function.md} (98%) rename docs/{manual_doc/Functions_and_Operators/Logical_Operators.md => manual-doc/functions-and-operators/logical-operators.md} (100%) rename docs/{manual_doc/Functions_and_Operators/Operator_Precedence.md => manual-doc/functions-and-operators/operator-precedence.md} (100%) rename docs/{manual_doc/Functions_and_Operators/Order_By_Function.md => manual-doc/functions-and-operators/order-by-function.md} (90%) create mode 100644 docs/manual-doc/functions-and-operators/set-operations.md create mode 100644 docs/manual-doc/functions-and-operators/type-conversion.md rename docs/{manual_doc/Language_Structure/Comment_Syntax.md => manual-doc/language-structure/comment-syntax.md} (100%) rename docs/{manual_doc/Language_Structure/Expression.md => manual-doc/language-structure/expression.md} (100%) rename docs/{manual_doc/Language_Structure/Identifier_Case_Sensitivity.md => manual-doc/language-structure/identifier-case-sensitivity.md} (100%) rename docs/{manual_doc/Functions_and_Operators/Set_Operation.md => manual-doc/language-structure/keywords-and-reserved-words.md} (100%) rename docs/{manual_doc/Language_Structure/Literal_Values/NULL_Values.md => manual-doc/language-structure/literal-values/NULL-values.md} (100%) rename docs/{manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md => manual-doc/language-structure/literal-values/boolean-literals.md} (89%) rename docs/{manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md => manual-doc/language-structure/literal-values/numeric-literals.md} (100%) rename docs/{manual_doc/Language_Structure/Literal_Values/String_Literals.md => manual-doc/language-structure/literal-values/string-literals.md} (100%) rename docs/{manual_doc/Language_Structure/Property_Reference.md => manual-doc/language-structure/property-reference.md} (84%) rename docs/{manual_doc/Language_Structure/Schema_Object_Names.md => manual-doc/language-structure/schema-object-names.md} (100%) rename docs/{manual_doc/Language_Structure/Statement_Composition.md => manual-doc/language-structure/statement-composition.md} (100%) rename docs/{manual_doc/Language_Structure/User-Defined_Variables.md => manual-doc/language-structure/user-defined_variable.md} (73%) rename docs/{manual_doc/Statement_Syntax/Data_Administration_Statements/Account_Management_Statements/Drop_User_Syntax.md => manual-doc/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/Data_Administration_Statements/Configuration_Statements/Variables_Syntax.md => manual-doc/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md} (98%) rename docs/{manual_doc/Statement_Syntax/Data_Definition_Statements/Alter_Tag_Edge_Syntax.md => manual-doc/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/Data_Definition_Statements/Create_Space_Syntax.md => manual-doc/statement-syntax/data-definition-statements/create-space-syntax.md} (98%) rename docs/{manual_doc/Language_Structure/Keywords_and_Reserved_Words.md => manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/Data_Definition_Statements/Drop_Edge_Syntax.md => manual-doc/statement-syntax/data-definition-statements/drop-edge-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/Data_Definition_Statements/Drop_Space_Syntax.md => manual-doc/statement-syntax/data-definition-statements/drop-space-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/Data_Definition_Statements/Drop_Tag_Syntax.md => manual-doc/statement-syntax/data-definition-statements/drop-tag-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/Data_Definition_Statements/Create_Tag_Edge_Syntax.md => manual-doc/statement-syntax/data-definition-statements/show-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md => manual-doc/statement-syntax/data-manipulation-statements/fetch-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md => manual-doc/statement-syntax/data-manipulation-statements/go-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md => manual-doc/statement-syntax/data-manipulation-statements/insert-edge-syntax.md} (96%) rename docs/{manual_doc/Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md => manual-doc/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md} (100%) create mode 100644 docs/manual-doc/statement-syntax/data-manipulation-statements/pipe-syntax.md rename docs/{manual_doc/Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md => manual-doc/statement-syntax/data-manipulation-statements/where-syntax.md} (100%) rename docs/{manual_doc/Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md => manual-doc/statement-syntax/data-manipulation-statements/yield-syntax.md} (87%) rename docs/{manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md => manual-doc/statement-syntax/utility-statements/describe-syntax.md} (100%) create mode 100644 docs/manual-doc/statement-syntax/utility-statements/use-syntax.md delete mode 100644 docs/manual_doc/Functions_and_Operators/Type_Conversion.md delete mode 100644 docs/manual_doc/Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md delete mode 100644 docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Show_Syntax.md delete mode 100644 docs/manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md diff --git a/docs/manual_doc/Data_Types/Nemeric_Types.md b/docs/manual-doc/data-types/numeric-types.md similarity index 72% rename from docs/manual_doc/Data_Types/Nemeric_Types.md rename to docs/manual-doc/data-types/numeric-types.md index 284a36daa48..a1dcc1dde33 100644 --- a/docs/manual_doc/Data_Types/Nemeric_Types.md +++ b/docs/manual-doc/data-types/numeric-types.md @@ -1,4 +1,4 @@ -Two basic data types are supported by Nebula -- int64 & double. +Two basic data types are supported by `Nebula` -- int64 & double. The range for int64 is [-9223372036854775808, 9223372036854775807]. There are no upper and lower bound for double. diff --git a/docs/manual_doc/Data_Types/String_Types.md b/docs/manual-doc/data-types/string-types.md similarity index 100% rename from docs/manual_doc/Data_Types/String_Types.md rename to docs/manual-doc/data-types/string-types.md diff --git a/docs/manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md b/docs/manual-doc/functions-and-operators/comparison-functions-and-operators.md similarity index 100% rename from docs/manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md rename to docs/manual-doc/functions-and-operators/comparison-functions-and-operators.md diff --git a/docs/manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md b/docs/manual-doc/functions-and-operators/functions-and-operator-reference.md similarity index 100% rename from docs/manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md rename to docs/manual-doc/functions-and-operators/functions-and-operator-reference.md diff --git a/docs/manual_doc/Functions_and_Operators/Group_By_Function.md b/docs/manual-doc/functions-and-operators/group-by-function.md similarity index 98% rename from docs/manual_doc/Functions_and_Operators/Group_By_Function.md rename to docs/manual-doc/functions-and-operators/group-by-function.md index 70bd84f52ff..5c6e4b25551 100644 --- a/docs/manual_doc/Functions_and_Operators/Group_By_Function.md +++ b/docs/manual-doc/functions-and-operators/group-by-function.md @@ -15,7 +15,7 @@ The `GROUP BY` functions are similar with SQL. It can only be applied in the `Y All the functions above can only applies for int64 and double. -### example +### Example ``` nebula> GO FROM 1 OVER e1 | YIELD $-.id AS fid, COUNT(*) AS cnt GROUP BY fid diff --git a/docs/manual_doc/Functions_and_Operators/Logical_Operators.md b/docs/manual-doc/functions-and-operators/logical-operators.md similarity index 100% rename from docs/manual_doc/Functions_and_Operators/Logical_Operators.md rename to docs/manual-doc/functions-and-operators/logical-operators.md diff --git a/docs/manual_doc/Functions_and_Operators/Operator_Precedence.md b/docs/manual-doc/functions-and-operators/operator-precedence.md similarity index 100% rename from docs/manual_doc/Functions_and_Operators/Operator_Precedence.md rename to docs/manual-doc/functions-and-operators/operator-precedence.md diff --git a/docs/manual_doc/Functions_and_Operators/Order_By_Function.md b/docs/manual-doc/functions-and-operators/order-by-function.md similarity index 90% rename from docs/manual_doc/Functions_and_Operators/Order_By_Function.md rename to docs/manual-doc/functions-and-operators/order-by-function.md index 30c6c7eb61c..be2e8f2059c 100644 --- a/docs/manual_doc/Functions_and_Operators/Order_By_Function.md +++ b/docs/manual-doc/functions-and-operators/order-by-function.md @@ -6,7 +6,7 @@ And it can only be used in the `PIEP`-syntax ("|") ``` | ORDER BY ASC | DESC [, ASC | DESC ...] ``` -By default, `ORDER BY` sorts in ascending order if no ASC or DESC is given. +By default, `ORDER BY` sorts the records in ascending order if no `ASC` or `DESC` is given. ### Example diff --git a/docs/manual-doc/functions-and-operators/set-operations.md b/docs/manual-doc/functions-and-operators/set-operations.md new file mode 100644 index 00000000000..87161e244b3 --- /dev/null +++ b/docs/manual-doc/functions-and-operators/set-operations.md @@ -0,0 +1,172 @@ +# Set Operations (`UNION`, `INTERSECT`, and `MINUS`) + +## `UNION`, `UNION DISTINCT`, and `UNION ALL` + +Operator `UNION DISTINCT` (or by short `UNION`) returns the union of two sets A and B (denoted by `A ⋃ B` in mathematics), with the distinct element belongs to set A or set B, or both. + +Meanwhile, operation `UNION ALL` returns the union set with duplicated elements. The `UNION`-syntax is + +``` + UNION [DISTINCT | ALL] +``` + +where `` and `` must have the same number of columns and pair-wise data types. + +### Example + +The following statement + +``` +GO FROM 1 OVER e1 \ +UNION \ +GO FROM 2 OVER e1 +``` + +return the neighbors' id of vertex `1` and `2` (along with edge `e1`) without duplication. + +While + +``` +GO FROM 1 OVER e1 \ +UNION ALL\ +GO FROM 2 OVER e1 +``` + +returns all the neighbors of vertex `1` and `2`, with all possible duplications. + +`UNION` can also work with the `YIELD`-syntax-returned properties. For example, let's suppose the results of the following two queries + +``` +nebula> GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 -- query 1 +========================== +| id | left.1 | left.2 | +========================== +| 104 | 1 | 2 | -- line 1 +-------------------------- +| 215 | 4 | 3 | -- line 3 +-------------------------- + +nebula> GO FROM 2,3 OVER e1 YIELD e1._dst AS id, e1.prop1 AS right.1, $$.tag.prop2 AS right.2 -- query 2 +=========================== +| id | right.1 | right.2 | +=========================== +| 104 | 1 | 2 | -- line 1 +--------------------------- +| 104 | 2 | 2 | -- line 2 +--------------------------- +``` + +And the following statement + +``` +GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 +UNION /* DISTINCT */ +GO FROM 2,3 OVER e1 YIELD e1._dst AS id, e1.prop1 AS right.1, $$.tag.prop2 AS right.2 +``` + +will return as follows: +``` +========================= +| id | left.1 | left.2 | -- UNION or UNION DISTINCT. The column names come from query 1 +========================= +| 104 | 1 | 2 | -- line 1 +------------------------- +| 104 | 2 | 2 | -- line 2 +------------------------- +| 215 | 4 | 3 | -- line 3 +------------------------- +``` + +Notice that line 1 and line 2 return the same id (104) with different column values. The `DISTINCT` check duplication by all the columns for every line. So line 1 and line 2 are different. + +You can expect for the `UNION ALL` result + +``` +GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 +UNION ALL +GO FROM 2,3 OVER e1 YIELD e1._dst AS id, e1.prop1 AS right.1, $$.tag.prop2 AS right.2 + +========================= +| id | left.1 | left.2 | -- UNION ALL +========================= +| 104 | 1 | 2 | -- line 1 +------------------------- +| 104 | 1 | 2 | -- line 1 +------------------------- +| 104 | 2 | 2 | -- line 2 +------------------------- +| 215 | 4 | 3 | -- line 3 +------------------------- +``` + +## INTERSECT + +Operator `INTERSECT` returns the intersection of two sets A and B (denoted by A ⋂ B), if the elements belong both to set A and set B. + +``` + INTERSECT +``` +Alike `UNION`, `` and `` must have the same number of columns and data types. +Besides, only the same line of `` and `` will be returned. + +### Example + +You can imagine + +``` +GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 +INTERSECT +GO FROM 2,3 OVER e1 YIELD e1._dst AS id, e1.prop1 AS right.1, $$.tag.prop2 AS right.2 +``` + +will return + +``` +========================= +| id | left.1 | left.2 | +========================= +| 104 | 1 | 2 | -- line 1 +------------------------- +``` + +## MINUS + +The set subtraction (or difference), A - B, consists of elements that are in A but not in B. So the operation order matters. + +### Example + + +``` +GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 +MINUS +GO FROM 2,3 OVER e1 YIELD e1._dst AS id, e1.prop1 AS right.1, $$.tag.prop2 AS right.2 +``` + +comes out + +``` +========================== +| id | left.1 | left.2 | +========================== +| 215 | 4 | 3 | -- line 3 +-------------------------- +``` + +And if we reverse the `MINUS` order + +``` +GO FROM 2,3 OVER e1 YIELD e1._dst AS id, e1.prop1 AS right.1, $$.tag.prop2 AS right.2 +MINUS +GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 +``` + +results in + +``` +=========================== +| id | right.1 | right.2 | -- column named from query 2 +=========================== +| 104 | 2 | 2 | -- line 2 +--------------------------- +``` + diff --git a/docs/manual-doc/functions-and-operators/type-conversion.md b/docs/manual-doc/functions-and-operators/type-conversion.md new file mode 100644 index 00000000000..58bc3567ab2 --- /dev/null +++ b/docs/manual-doc/functions-and-operators/type-conversion.md @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/docs/manual_doc/Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md b/docs/manual_doc/Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md deleted file mode 100644 index 69561281fe8..00000000000 --- a/docs/manual_doc/Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md +++ /dev/null @@ -1,13 +0,0 @@ - -One major difference between nGQL and SQL is how subqueries are composed. - -In SQL, sub-queries are nested (embedded) to form a statement. -MeanWhile, nGQL uses shell style `PIPE (|)`. - -### Examples - -``` -GO FROM 201 OVER edge_serve | GO FROM $-.id OVER edge_fans | GO FROM $-.id ... - -GO FROM 100 OVER like YIELD like._dst AS Id, $$.player.name AS Name | GO FROM $-.Id OVER like YIELD like._dst, like.likeness, $-.Name -``` \ No newline at end of file diff --git a/docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Show_Syntax.md b/docs/manual_doc/Statement_Syntax/Data_Definition_Statements/Show_Syntax.md deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/docs/manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md b/docs/manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md deleted file mode 100644 index b04efc50b6e..00000000000 --- a/docs/manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md +++ /dev/null @@ -1,20 +0,0 @@ -``` -USE graph_space_name -``` - -The USE statement tells Nebula to use the named (graph) space as the current working space. This statement requires some privileges. - -The named space remains the default until the end of the session or another USE statement is issued: - -``` -USE space1 -GO FROM 1 OVER edge1 -- Traverse in graph space1 -USE space2 -GO FROM 1 OVER edge1 -- Traverse in graph space2. These nodes and edges have no relevance with space1. -USE space1; -- Now you are back to space1. Hereafter, you can not read any data from space2. -``` - -Different from SQL, making a space as the working space prevent you to access the other space. The only way to traverse in a new graph space is to switch by the `USE` statement. - -> SPACES are FULLY ISOLATED from each other. Unlike SQL, which allows you to select two tables from different databases in one statement, in Nebula, you can only touch one space at a time. - From 76c40a5abe7e4e9b17a14d60e4b432660a5192eb Mon Sep 17 00:00:00 2001 From: jude-zhu <51590253+jude-zhu@users.noreply.github.com> Date: Mon, 19 Aug 2019 11:05:17 +0800 Subject: [PATCH 05/18] [docs] add 'create tag/edgetype' statement and 'show syntax' docs (#797) --- docs/get-started.md | 2 +- .../create-tag-edge-syntax.md | 87 +++++++++++++++++++ .../data-definition-statements/show-syntax.md | 29 +++++++ 3 files changed, 117 insertions(+), 1 deletion(-) diff --git a/docs/get-started.md b/docs/get-started.md index 47bdea5abda..acb69deb3ae 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -235,7 +235,7 @@ Make sure all the services are working - -u is to set user name, `user` is the default Nebula user account - -p is to set password, `password` is the default password for account `user` -Add host to make console connect to the Nebula service: +`Add HOSTS` to register the storage hosts: ``` > ADD HOSTS $storage_ip:$storage_port diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md b/docs/manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md index e69de29bb2d..d4b3b988d8b 100644 --- a/docs/manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md +++ b/docs/manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md @@ -0,0 +1,87 @@ +### Create TAG / EDGE Syntax + +``` +CREATE {TAG | EDGE} tag_name|edge_name + (create_definition, ...) + [tag_edge_options] + +create_definition: + prop_name data_type + +tag_edge_options: + option [, option ...] + +option: + TTL_DURATION [=] ttl_duration + | TTL_COL [=] prop_name +``` + +Nebula's graph schema is composed of tags and edges, either of which may have properties. `CREATE TAG` statement defines a tag with the given name. `CREATE EDGE` statement is to define an edge type. + +There are several aspects to this syntax, described under the following topics in this section: + +* [Tag Name and Edge Type Name](#tag-name-and-edgetype-name) + +* [Property Name and Data Type](#property-name-and-data-type) + +### Tag Name and EdgeType Name + +* **tag_name and edge_name** + + The name of tags and edgeTypes should be **unique** within the space. Once the name is defined, it can not be altered. The rules of tag and edgeType names are the same as those for names of spaces. See [Schema Object Name](../../language-structure/schema-object-names.md) + +### Property Name and Data Type + +* **prop_name** + + prop_name indicates the name of properties. It must be unique for each tag or edgeType. + +* **data_type** + + data_type represents the data type of each property. For more information about data types that Nebula Graph supports, see data types section. + + > NULL and NOT NULL constrain are not supported yet when creating tags/edges (comparing with relational databases). + +### Time-to-Live (TTL) syntax + +* TTL_DURATION + + ttl_duration specifies the life cycle of vertices (or edges). TTL expires the vertexes or edges after the specified number of seconds has passed since the TTL_COL configured value; i.e. the expiration threshold is TTL_COL configured property's value plus the specified number of seconds. + + > If the value for ttl_duration is zero or negative, the vertices or edges will not expire. + +* TTL_COL + + The data type of prop_name must be either int64 or timestamp. + +* multiple TTL definition + + If TTL_COL is a list of prop_name, and there are multiple ttl_duration, **Nebula Graph** uses the lowest(i.e. earliest) expiration threshold to expire data. + +### Examples + +``` +CREATE TAG course(name string, credits int) +CREATE TAG notag()  -- empty properties + +CREATE EDGE follow(start_time timestamp, likeness double) +CREATE EDGE noedge()  -- empty properties + +CREATE TAG woman(name string, age int, + married bool, salary double, create_time timestamp) + TTL_DRUATION = 100, TTL_COL = create_time -- expired when now is later than create_time + 100 + +CREATE EDGE marriage(location string, since timestamp) + TTL_DURATION = 0, TTL_COL = since -- negative or zero, not expire + +CREATE TAG icecream(made timestamp, temprature int) + TTL_DURATION = 100, TTL_COL = made, + TTL_DRUATION = 10, TTL_COL = temprature + -- no matter which comes first: made + 100 or temprature + 10 + +CREATE EDGE garbge (thrown timestamp, temprature int) + TTL_DURATION = -2, TTL_COL = thrown, + TTL_DRUATION = 10, TTL_COL = thrown + -- legal, but not recommended. expired at thrown + 10 +``` + diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/show-syntax.md b/docs/manual-doc/statement-syntax/data-definition-statements/show-syntax.md index e69de29bb2d..cf7e99ee280 100644 --- a/docs/manual-doc/statement-syntax/data-definition-statements/show-syntax.md +++ b/docs/manual-doc/statement-syntax/data-definition-statements/show-syntax.md @@ -0,0 +1,29 @@ +``` +SHOW {SPACES | TAGS | EDGES | HOSTS} +SHOW VARIABLES [graph|meta|storage] +``` + +`SHOW SPACES` lists the SPACES on the Nebula Graph cluster. + +`SHOW TAGS` and `SHOW EDGES` return the defined tags and edge types in the space, respectively. + +`SHOW HOSTS` is to list storage hosts registered by the meta server. + +For more information about `SHOW VARIABLES [graph|meta|storage]`, please refer to [variable syntax](../data-administration-statements/configuration-statements/variables-syntax.md). + +### Example + +``` +nebula> SHOW SPACES; +======== +| Name | +======== +| test | +-------- + +nebula> USE test; + +nebula> SHOW TAGS; + +nebula> SHOW EDGES; +``` \ No newline at end of file From aa126ede5a65d53451c7dab777fe7a02e91417cc Mon Sep 17 00:00:00 2001 From: laura-ding <48548375+laura-ding@users.noreply.github.com> Date: Mon, 19 Aug 2019 11:42:23 +0800 Subject: [PATCH 06/18] Return error msg for find and match sentence (#794) --- src/graph/CMakeLists.txt | 2 ++ src/graph/Executor.cpp | 8 +++++++ src/graph/FindExecutor.cpp | 24 ++++++++++++++++++++ src/graph/FindExecutor.h | 40 ++++++++++++++++++++++++++++++++++ src/graph/MatchExecutor.cpp | 24 ++++++++++++++++++++ src/graph/MatchExecutor.h | 40 ++++++++++++++++++++++++++++++++++ src/graph/TraverseExecutor.cpp | 8 +++++++ src/graph/test/DataTest.cpp | 19 +++++++++++++++- 8 files changed, 164 insertions(+), 1 deletion(-) create mode 100644 src/graph/FindExecutor.cpp create mode 100644 src/graph/FindExecutor.h create mode 100644 src/graph/MatchExecutor.cpp create mode 100644 src/graph/MatchExecutor.h diff --git a/src/graph/CMakeLists.txt b/src/graph/CMakeLists.txt index 6304ef9d6da..7df169c38e5 100644 --- a/src/graph/CMakeLists.txt +++ b/src/graph/CMakeLists.txt @@ -42,6 +42,8 @@ add_library( FetchEdgesExecutor.cpp FetchExecutor.cpp SetExecutor.cpp + FindExecutor.cpp + MatchExecutor.cpp ) add_dependencies( graph_obj diff --git a/src/graph/Executor.cpp b/src/graph/Executor.cpp index a30006f24c2..683d0633c4d 100644 --- a/src/graph/Executor.cpp +++ b/src/graph/Executor.cpp @@ -39,6 +39,8 @@ #include "graph/FetchEdgesExecutor.h" #include "graph/ConfigExecutor.h" #include "graph/SetExecutor.h" +#include "graph/FindExecutor.h" +#include "graph/MatchExecutor.h" namespace nebula { namespace graph { @@ -131,6 +133,12 @@ std::unique_ptr Executor::makeExecutor(Sentence *sentence) { case Sentence::Kind::kSet: executor = std::make_unique(sentence, ectx()); break; + case Sentence::Kind::kMatch: + executor = std::make_unique(sentence, ectx()); + break; + case Sentence::Kind::kFind: + executor = std::make_unique(sentence, ectx()); + break; case Sentence::Kind::kUnknown: LOG(FATAL) << "Sentence kind unknown"; break; diff --git a/src/graph/FindExecutor.cpp b/src/graph/FindExecutor.cpp new file mode 100644 index 00000000000..ea4cc86541e --- /dev/null +++ b/src/graph/FindExecutor.cpp @@ -0,0 +1,24 @@ +/* Copyright (c) 2019 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License, + * attached with Common Clause Condition 1.0, found in the LICENSES directory. + */ + +#include "base/Base.h" +#include "graph/FindExecutor.h" + +namespace nebula { +namespace graph { + +FindExecutor::FindExecutor(Sentence *sentence, ExecutionContext *ectx) + : TraverseExecutor(ectx) { + sentence_ = static_cast(sentence); +} + + +Status FindExecutor::prepare() { + return Status::Error("Does not support"); +} + +} // namespace graph +} // namespace nebula diff --git a/src/graph/FindExecutor.h b/src/graph/FindExecutor.h new file mode 100644 index 00000000000..4064b9b6deb --- /dev/null +++ b/src/graph/FindExecutor.h @@ -0,0 +1,40 @@ +/* Copyright (c) 2019 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License, + * attached with Common Clause Condition 1.0, found in the LICENSES directory. + */ + +#ifndef GRAPH_FINDEXECUTOR_H_ +#define GRAPH_FINDEXECUTOR_H_ + +#include "base/Base.h" +#include "graph/TraverseExecutor.h" + +namespace nebula { +namespace graph { + +class FindExecutor final : public TraverseExecutor { +public: + FindExecutor(Sentence *sentence, ExecutionContext *ectx); + + const char* name() const override { + return "FindExecutor"; + } + + Status MUST_USE_RESULT prepare() override; + + void feedResult(std::unique_ptr result) override { + UNUSED(result); + } + + void execute() override {} + +private: + FindSentence *sentence_{nullptr}; +}; + +} // namespace graph +} // namespace nebula + + +#endif // GRAPH_FINDEXECUTOR_H_ diff --git a/src/graph/MatchExecutor.cpp b/src/graph/MatchExecutor.cpp new file mode 100644 index 00000000000..e058f4fb5fc --- /dev/null +++ b/src/graph/MatchExecutor.cpp @@ -0,0 +1,24 @@ +/* Copyright (c) 2019 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License, + * attached with Common Clause Condition 1.0, found in the LICENSES directory. + */ + +#include "base/Base.h" +#include "graph/MatchExecutor.h" + +namespace nebula { +namespace graph { + +MatchExecutor::MatchExecutor(Sentence *sentence, ExecutionContext *ectx) + : TraverseExecutor(ectx) { + sentence_ = static_cast(sentence); +} + + +Status MatchExecutor::prepare() { + return Status::Error("Does not support"); +} + +} // namespace graph +} // namespace nebula diff --git a/src/graph/MatchExecutor.h b/src/graph/MatchExecutor.h new file mode 100644 index 00000000000..53d88964b02 --- /dev/null +++ b/src/graph/MatchExecutor.h @@ -0,0 +1,40 @@ +/* Copyright (c) 2019 vesoft inc. All rights reserved. + * + * This source code is licensed under Apache 2.0 License, + * attached with Common Clause Condition 1.0, found in the LICENSES directory. + */ + +#ifndef GRAPH_MATCHEXECUTOR_H_ +#define GRAPH_MATCHEXECUTOR_H_ + +#include "base/Base.h" +#include "graph/TraverseExecutor.h" + +namespace nebula { +namespace graph { + +class MatchExecutor final : public TraverseExecutor { +public: + MatchExecutor(Sentence *sentence, ExecutionContext *ectx); + + const char* name() const override { + return "UseExecutor"; + } + + Status MUST_USE_RESULT prepare() override; + + void feedResult(std::unique_ptr result) override { + UNUSED(result); + } + + void execute() override {} + +private: + MatchSentence *sentence_{nullptr}; +}; + +} // namespace graph +} // namespace nebula + + +#endif // GRAPH_MATCHEXECUTOR_H_ diff --git a/src/graph/TraverseExecutor.cpp b/src/graph/TraverseExecutor.cpp index d9f214f8ad8..7ad71fe2e31 100644 --- a/src/graph/TraverseExecutor.cpp +++ b/src/graph/TraverseExecutor.cpp @@ -15,6 +15,8 @@ #include "dataman/RowReader.h" #include "dataman/RowWriter.h" #include "graph/SetExecutor.h" +#include "graph/FindExecutor.h" +#include "graph/MatchExecutor.h" namespace nebula { namespace graph { @@ -48,6 +50,12 @@ TraverseExecutor::makeTraverseExecutor(Sentence *sentence, ExecutionContext *ect case Sentence::Kind::kSet: executor = std::make_unique(sentence, ectx); break; + case Sentence::Kind::kMatch: + executor = std::make_unique(sentence, ectx); + break; + case Sentence::Kind::kFind: + executor = std::make_unique(sentence, ectx); + break; case Sentence::Kind::kUnknown: LOG(FATAL) << "Sentence kind unknown"; break; diff --git a/src/graph/test/DataTest.cpp b/src/graph/test/DataTest.cpp index b52c49f147b..581a27988f7 100644 --- a/src/graph/test/DataTest.cpp +++ b/src/graph/test/DataTest.cpp @@ -359,6 +359,23 @@ TEST_F(DataTest, InsertVertex) { // TODO: Test insert multi tags, and delete one of them then check other existent } +TEST_F(DataTest, FindTest) { + { + cpp2::ExecutionResponse resp; + std::string cmd = "FIND name FROM person"; + auto code = client_->execute(cmd, resp); + ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); + } +} + +TEST_F(DataTest, MatchTest) { + { + cpp2::ExecutionResponse resp; + std::string cmd = "MATCH"; + auto code = client_->execute(cmd, resp); + ASSERT_EQ(cpp2::ErrorCode::E_EXECUTION_ERROR, code); + } +} + } // namespace graph } // namespace nebula - From 22eceb25c833a2974054631cb50cb3b6b165fece Mon Sep 17 00:00:00 2001 From: Amber Zhang <42762957+Amber1990Zhang@users.noreply.github.com> Date: Mon, 19 Aug 2019 12:27:22 +0800 Subject: [PATCH 07/18] add Chinese docs (#785) --- docs/cn_doc/cn-README.md | 36 ++ docs/cn_doc/cn-contribute-to-documentation.md | 15 + docs/cn_doc/cn-get-started.md | 447 ++++++++++++++++++ docs/cn_doc/cn-how-to-contribute.md | 152 ++++++ docs/cn_doc/cn-nGQL-tutorial.md | 263 +++++++++++ docs/how-to-contribute.md | 2 +- 6 files changed, 914 insertions(+), 1 deletion(-) create mode 100644 docs/cn_doc/cn-README.md create mode 100644 docs/cn_doc/cn-contribute-to-documentation.md create mode 100644 docs/cn_doc/cn-get-started.md create mode 100644 docs/cn_doc/cn-how-to-contribute.md create mode 100644 docs/cn_doc/cn-nGQL-tutorial.md diff --git a/docs/cn_doc/cn-README.md b/docs/cn_doc/cn-README.md new file mode 100644 index 00000000000..fcbd4b9388e --- /dev/null +++ b/docs/cn_doc/cn-README.md @@ -0,0 +1,36 @@ +# 欢迎使用Nebula Graph官方文档 +--- + +**Nebula Graph** 是世界上唯一能够容纳千亿个顶点(节点)和万亿条边,并提供毫秒级查询延时的图数据库解决方案。 + +**Nebula Graph** 的目标是为超大规模图数据提供高并发,低延时的读、写及计算。Nebula是一个开源项目,我们期待与社区合作共同推广图数据库。 + +**Nebula Graph** 的主要特点: + + * 无共享分布式(shared-nothing distributed) + * 可扩展 + * 高容错 + * 类似SQL的查询语言 + +## 获取 `Nebula` ## + +**Nebula Graph** 源码参见[GitHub](https://github.com/vesoft-inc/nebula)。 +也可下载Nebula [Docker](https://hub.docker.com/r/vesoft/nebula-graph/tags)镜像进行试用。 +更多详情参见[Get Started](cn-get-started.md). + +## 参与 `Nebula` ## + +**Nebula Graph** 是一个完全开源的项目,其所有核心功能都将在开源repository中实现。Nebula鼓励社区参与该项目,目前有以下贡献方式: + +* 直接下载试用 **Nebula Graph** 并给出反馈 +* 提交功能要求和错误报告 +* 帮助我们完善文档,详情参见[Contribute to Nebula Graph Docs](cn-contribute-to-documentation.md) + +## 许可 ### +**Nebula Graph** 使用[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)许可,您可以免费下载,修改,部署源代码以满足您的需求。您还可以将 **Nebula Graph** 作为后端服务部署以支持您的SAAS部署。 + +为防止云供应商从项目赢利而不回馈,Nebula在项目中添加了[Common Clause 1.0](https://commonsclause.com/)条款。如上所述,Nebula是一个完全开源的项目,欢迎您就许可模式提议,帮助Nebula更适合社区发展。 +## 联系方式 +- 使用[GitHub issue tracker](https://github.com/vesoft-inc/nebula/issues) 提交错误报告和功能要求。 +- 加入 [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200)。 +- **Nebula Graph** 详情访问[Home Page](http://nebula-graph.io/)。 diff --git a/docs/cn_doc/cn-contribute-to-documentation.md b/docs/cn_doc/cn-contribute-to-documentation.md new file mode 100644 index 00000000000..fd90708db27 --- /dev/null +++ b/docs/cn_doc/cn-contribute-to-documentation.md @@ -0,0 +1,15 @@ + +--- +## 贡献文档 + +Nebula文档完全开源,我们欢迎更多贡献者帮助改进文档。Nebula文档使用Markdown语言,并参考了[Google开发者文档风格指南](https://developers.google.com/style/)进行编写。 + +## 如何贡献 + +贡献文档有多种方式: + + - 使用每页右侧的铅笔标记直接在网站编辑或提交问题。 + + - 在GitHub上提[issue](https://github.com/vesoft-inc/nebula/issues)。 + + - Fork仓库,在本地分支上做更改,然后提交PR。 diff --git a/docs/cn_doc/cn-get-started.md b/docs/cn_doc/cn-get-started.md new file mode 100644 index 00000000000..bb0fb230eff --- /dev/null +++ b/docs/cn_doc/cn-get-started.md @@ -0,0 +1,447 @@ + +--- +本教程旨在对 **Nebula Graph** 的使用做简要介绍。 + +## 安装Nebula Graph + +### 通过Docker + +启动 **Nebula Graph** 最快捷的方式是使用`docker`。首先,查看电脑是否已安装Docker: + +``` +> docker --version +Docker version 18.09.2, build 6247962 +``` + +如果未安装,参看[这里](https://docs.docker.com/install/)。 +安装之后,运行: + +``` +> docker pull vesoft/nebula-graph:latest +ac9208207ada: Pulling fs layer +cdcb67189ff7: Pulling fs layer +80407c3cb6b4: Pulling fs layer +latest: Pulling from vesoft/nebula-graph +ac9208207ada: Pull complete +cdcb67189ff7: Pull complete +80407c3cb6b4: Pull complete +Digest: sha256:72a73c801685595776779291969b57ab758f53ebd9bda8bab56421e50bfee161 +Status: Downloaded newer image for vesoft/nebula-graph:latest +``` +下载Nebula镜像。 + +国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置国内地址。例如: + +* Azure 中国镜像 https://dockerhub.azk8s.cn +* 七牛云 https://reg-mirror.qiniu.com + +linux用户请在/etc/docker/daemon.json 中写入如下内容(如果文件不存在请新建该文件 + +``` +{ + "registry-mirrors": [ + "https://dockerhub.azk8s.cn", + "https://reg-mirror.qiniu.com" + ] +} +``` + +macOS 用户请点击任务栏中Docker Desktop图标 -> Preferences -> Daemon -> Registry mirrors。 在列表中添加 https://dockerhub.azk8s.cn 和 https://reg-mirror.qiniu.com。修改完成后,点击 Apply & Restart 按钮, 重启Docker。 + +镜像下载完成后,键入命令`docker images`查看下载完成的镜像。 + +``` +> docker images +REPOSITORY TAG IMAGE ID CREATED SIZE +vesoft/nebula-graph latest 1afd60e223ca 4 weeks ago 401MB +``` + + + + +--- + +**运行 Nebula Graph** + +`nebula` 镜像下载完成后,运行 + +``` +> docker run -it vesoft/nebula-graph:latest /bin/bash +``` + +启动docker容器。 + +进入容器后,默认在`root`目录下,使用`/usr/local/nebula/script/`切换到`neula`主目录。 + +运行 + +``` +> ./start-all.sh +Starting MetaService StorageService and GraphService ... +``` + +启动测试服务,存储服务和图服务。 + +运行 + +``` +> ps -ef | grep nebula +``` + +查看服务进程,,如果看到nebula-metad, nebula-storaged, nebula-graphd ,则表明服务已成功连接。 + + + +运行以下命令连接nebula + +``` +> ./start-console.sh + +Welcome to Nebula Graph (Version 0.1) + +nebula> +``` + +如果对部署过程有任何问题,欢迎在[GitHub](https://github.com/vesoft-inc/nebula/issues)上提issue。 + +### 编译源码(Linux) + +**依赖** + +nebula遵循c++14标准,依赖第三方库: + +- autoconf +- automake +- libtool +- cmake +- bison +- unzip +- boost +- gperf +- krb5 +- openssl +- libunwind +- ncurses +- readline + +建议安装g++ 5以上linux系统, 比如Fedora 29。目前,nebula使用`git-lfs`存储第三方库,请确保获取源代码之前您已安装`git-lfs`。 + +**从GitHub获取源码** + +``` +> git clone https://github.com/vesoft-inc/nebula.git +``` + +**编译** + +``` +> cmake ./ +``` + +默认安装到 /usr/local路径,如需指定安装路径,请使用: + +``` +> cmake -DCMAKE_INSTALL_PREFIX=$your_nebula_install_dir +``` + +替换此处的 `$your_nebula_install_dir`。 + +然后运行以下命令: + +``` +> make && make install +``` + +**运行nebula(单机)** + +配置nebula-metad.conf + +在nebula安装目录下,运行以下命令: + +``` +> cp etc/nebula-metad.conf.default etc/nebula-metad.conf +``` + +根据实际修改nebula-metad.conf中的配置: + +- local_ip ip地址 +- port 端口号 +- ws_http_port metaservice HTTP HTTP服务端口号 +- ws_h2_port metaservice HTTP2服务端口号 + + +配置nebula-storaged.conf + +``` +> cp etc/nebula-storaged.conf.default etc/nebula-storaged.conf +``` + +根据实际修改nebula-storaged.conf中的配置: + +- local_ip ip地址 +- port 端口号 +- ws_http_port storageservice HTTP服务端口号 +- ws_h2_port storageservice HTTP2服务端口号 + +根据实际修改nebula-graphd.conf中的配置: + +``` +> cp etc/nebula-graphd.conf.default etc/nebula-graphd.conf +``` + +- local_ip ip地址 +- port 端口号 +- ws_http_port graphservice HTTP服务端口号 +- ws_h2_port graphservice HTTP2服务端口号 + +**启动服务** + +``` +> scripts/nebula.service start all +``` + +查看服务状态 + +``` +> scripts/nebula.service status all +``` + +**连接nebula** + +``` +> bin/nebula -u=user -p=password +``` + +- -u为用户名,默认值为`user` +- -p为密码,用户`user`的默认密码为`password` + +`ADD HOSTS`将存储节点注册到元数据服务中 + +``` +> ADD HOSTS $storage_ip:$storage_port +``` + +根据nebula-storaged.conf中的`local_ip`, `port` 替换此处的`$storage_ip`,`$storage_port`。 + +--- + +## 创建图数据 + +本节介绍如何构建图数据并进行查询。本示例基于下图构建: + + +![Untitled Diagram (1)](https://user-images.githubusercontent.com/51590253/60649144-0774c980-9e74-11e9-86d6-bad1653e70ba.png) + +示例数据有三种类型的标签(_course_, _building_,_student_),两种类型的边(_select_ 和 _like_),其schema为: + +```json +{ + "tags":{ + "course":[ + "name: string", + "credits: integer" + ], + "building":[ + "name: string" + ], + "student":[ + "name: string", + "age: integer", + "gender: string" + ] + }, + "edges":{ + "select":[ + "grade: integer" + ], + "like":[ + "likeness: double" + ] + } +} +``` + + +### 创建图空间 + +nebula中的图存储于 **SPACE** 中,每个space是一个物理隔离的空间。首先,需要创建一个space,然后指定使用该space以完成之后的操作。 + +列出已有的space: + +``` +nebula> SHOW SPACES; +``` + +创建一个名为myspace_test2的新space: + +``` +nebula> CREATE SPACE myspace_test2(partition_num=1, replica_factor=1); + +-- 使用这个space +nebula> USE myspace_test2; +``` + +`replica_factor` 用来指定集群复本数。 + +`partition_num` 用来指定一个复本中的分区数量。 +### 定义图数据Schema + +使用`CREATE TAG`语句定义带有标签类型和属性列表的标签。 + +``` +nebula> CREATE TAG course(name string, credits int); +nebula> CREATE TAG building(name string); +nebula> CREATE TAG student(name string, age int, gender string); +``` + +使用`CREATE EDGE`语句定义边类型。 + +``` +nebula> CREATE EDGE like(likeness double); +nebula> CREATE EDGE select(grade int); +``` + +查看上述创建的标签和边: + +``` +-- 查看标签列表 +nebula> SHOW TAGS; + +-- 查看边列表 +nebula> SHOW EDGES; +``` + +查看标签或边的属性 + +``` +-- 查看标签属性 +nebula> DESCRIBE TAG student; + +-- 查看边属性 +nebula> DESCRIBE EDGE like; +``` + + +### 插入数据 + +为上述图数据插入点和边。 + +``` + +-- 插入点 +nebula> INSERT VERTEX student(name, age, gender) VALUES 200:("Monica", 16, "female"); +nebula> INSERT VERTEX student(name, age, gender) VALUES 201:("Mike", 18, "male"); +nebula> INSERT VERTEX student(name, age, gender) VALUES 202:("Jane", 17, "female"); +nebula> INSERT VERTEX course(name, credits),building(name) VALUES 101:("Math", 3, "No5"); +nebula> INSERT VERTEX course(name, credits),building(name) VALUES 102:("English", 6, "No11"); + +``` + +``` +-- 插入边 +nebula> INSERT EDGE select(grade) VALUES 200 -> 101:(5); +nebula> INSERT EDGE select(grade) VALUES 200 -> 102:(3); +nebula> INSERT EDGE select(grade) VALUES 201 -> 102:(3); +nebula> INSERT EDGE select(grade) VALUES 202 -> 102:(3); +nebula> INSERT EDGE like(likeness) VALUES 200 -> 201:(92.5); +nebula> INSERT EDGE like(likeness) VALUES 201 -> 200:(85.6); +nebula> INSERT EDGE like(likeness) VALUES 201 -> 202:(93.2); +``` + +## 示例查询 + +Q1. 查询点201喜欢的点: + +``` +nebula> GO FROM 201 OVER like; + +======= +| id | +======= +| 200 | +------- +| 202 | +------- +``` + +Q2. 查询点201喜欢的点,并筛选出年龄大于17岁的点,并返回其姓名,年龄,性别,将其重全名为Friend,Age,Gender。 + +``` +nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name AS Friend, $$.student.age AS Age, $$.student.gender AS Gender; + +========================= +| Friend | Age | Gender | +========================= +| Jane | 17 | female | +------------------------- +``` + +`YIELD`用来指定目标返回值。 + +`$^`为起始点。 + +`$$` 为目标点。 + +Q3. 查询点201喜欢的点选择了哪些课程和其对应年级。 +``` + +-- 使用管道 +nebula> GO FROM 201 OVER like | GO FROM $-.id OVER select YIELD $^.student.name AS Student, $$.course.name AS Course, select.grade AS Grade; + +============================= +| Student | Course | Grade | +============================= +| Monica | Math | 5 | +----------------------------- +| Monica | English | 3 | +----------------------------- +| Jane | English | 3 | +----------------------------- + +-- 使用临时变量 +nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.name AS Student, $$.course.name AS Course, select.grade AS Grade; + +============================= +| Student | Course | Grade | +============================= +| Monica | Math | 5 | +----------------------------- +| Monica | English | 3 | +----------------------------- +| Jane | English | 3 | +----------------------------- + +``` + +`|` 表示管道,上一个查询的输出可作为下一个管道的输入。 + +`$-` 表示输入流。 + +第二种方法使用了用户定义变量`$a`,此变量仅适用于复合语句。 + + diff --git a/docs/cn_doc/cn-how-to-contribute.md b/docs/cn_doc/cn-how-to-contribute.md new file mode 100644 index 00000000000..e9d3338b073 --- /dev/null +++ b/docs/cn_doc/cn-how-to-contribute.md @@ -0,0 +1,152 @@ + +--- +### Step 1: 通过GitHub Fork + +1. 访问 https://github.com/vesoft-inc/nebula +2. 点击右上角`Fork` 按钮创建远程分支 + +### Step 2: 将分支克隆到本地 + +定义本地工作目录: + +```sh +# 定义工作目录 +working_dir=$HOME/Workspace +``` + +将`user` 设置为GitHub账户名: + +```sh +user={GitHub账户名} +``` + +克隆: + +```sh +mkdir -p $working_dir +cd $working_dir +git clone https://github.com/$user/nebula.git +# 推荐如下方式 +# 或: git clone git@github.com:$user/nebula.git + +cd $working_dir/nebula +git remote add upstream https://github.com/vesoft-inc/nebula.git +# 或: git remote add upstream git@github.com:vesoft-inc/nebula.git + +# 由于没有写访问权限,请勿推送至上游主分支 +git remote set-url --push upstream no_push + +# 确认远程分支有效: +# 正确的格式为: +# origin git@github.com:$(user)/nebula.git (fetch) +# origin git@github.com:$(user)/nebula.git (push) +# upstream https://github.com/vesoft-inc/nebula (fetch) +# upstream no_push (push) +git remote -v +``` + +#### 定义预提交hook + +请将Nebula Graph预提交挂钩链接到`.git`目录。 + +此挂钩检查提交格式,构建,文档生成等。 + +```sh +cd $working_dir/nebula/.git/hooks +ln -s ../../cpplint/bin/pre-commit.sh . +``` + +有时,预提交挂钩不能执行,在这种情况下,需要手动执行。 + +```sh +cd $working_dir/nebula/.git/hooks +chmod +x pre-commit +``` + +### Step 3: 分支 + +更新本地主分支: + +```sh +cd $working_dir/nebula +git fetch upstream +git checkout master +git rebase upstream/master +``` + +从主分支创建并切换分支: + +```sh +git checkout -b myfeature +``` +!!! 注意 + 由于一个PR通常包含多个commit,在合并至主分支时容易被挤压,因此建议您创建独立的分支进行更改。合并后的分支已无用处,因此可以使用上述rebase命令将本地主分支与上游同步。此外,如果直接将commit提交至主分支,则需要hard reset主分支。 + +```sh +git fetch upstream +git checkout master +git reset --hard upstream/master +git push --force origin master +``` + +### Step 4: 开发 + +#### 编辑代码 + +此时可在 `myfeature` 分支编辑代码, 编辑时请遵循[编码风格指南](/cpp-coding-style/)。 + +#### 运行独立模式 + +如需重现并检查问题,则需在独立模式下运行nebula。 + +```sh +# 构建二进制文件 +make server + +# 在独立模式下运行 +nebula-graphd +``` + +将Nebula Graph与本地服务器相连 + +```sh +nebula +``` + +#### 运行测试 + +```sh +# 运行单元测试,确保所有测试顺利通过。 +``` + +### Step 5: 保持分支同步 + +```sh +# 当处于myfeature分支时: +git fetch upstream +git rebase upstream/master +``` + +### Step 6: Commit + +提交代码更改 + +```sh +git commit +``` + +### Step 7: Push + +代码更改完成或需要备份代码时,将本地仓库创建的分支push到GitHub端的远程仓库: +```sh +git push -f origin myfeature +``` + +### Step 8: 创建pull request + +1. 点击此处访问fork仓库https://github.com/$user/nebula (替换此处的 `$user` 用户名)。 +2. 点击`myfeature`分支旁的 `Compare & pull request` 按钮。 + +### Step 9: 代码审查 + +公开的pull request至少需要一人审查,代码审查包括查找bug,审查代码风格等。 diff --git a/docs/cn_doc/cn-nGQL-tutorial.md b/docs/cn_doc/cn-nGQL-tutorial.md new file mode 100644 index 00000000000..a90e7607ed9 --- /dev/null +++ b/docs/cn_doc/cn-nGQL-tutorial.md @@ -0,0 +1,263 @@ +# 查询语言nGQL + +nGQL是Nebula Graph的查询语言,可供用户存储和检索图数据。nGQL为类SQL式语言,易学易用,且可满足复杂业务需求。 + +## nGQL的关键属性 + +Nebula Graph致力于打造专为图数据使用的查询语言——nGQL。与其他图数据库查询语言相比,nGQL具有以下特点: + +- 声明式:与命令式语言不同,nGQL是声明式语言,只需直接声明查询模式而无需告知如何查询。 + +- 表现力强:nGQL采用ASCII语法风格,其查询语言所表达的真实含义易于理解。 + +## nGQL语法 + +nGQL关键字不区分大小写,但是建议将其全部大写,以便于阅读。为帮助您快速了解nGQL,我们创建了一个名为`myspace_test`的简单的图数据,其中包含4个节点和3条边。 + +### 集群管理 + +* 添加hosts + +添加一个host + +``` +ADD HOSTS $storage_ip:$storage_port +``` + +添加多个hosts + +``` +ADD HOSTS $storage_ip1:$storage_port1, +$storage_ip2:$storage_port2,... +``` + +**注意:** + +将此处的$storage_ip和$storage_port替换为nebula-storaged.conf文件中的local_ip和port端口号,hosts之间需用逗号隔开,例如: + +``` +ADD HOSTS 192.168.8.5:65500 +``` + + +- 显示hosts + +``` +SHOW HOSTS +============================= +| Ip | Port | Status | +============================= +| 192.168.8.5 | 65500 | online | +----------------------- +| 192.168.8.1 | 65500 | offline | +----------------------- +``` + +- 移除hosts + +移除一个host + +``` +REMOVE HOSTS $storage_ip:$storage_port +``` + +移除多个hosts + +``` +REMOVE HOSTS $storage_ip1:$storage_port1, $storage_ip2:$storage_port2,... +``` + +**注意:** 使用逗号将hosts隔开。 + +### 图管理 + +SPACE是物理隔离的空间,作用类似于MySQL中的数据库。 + +| | CREATE | DROP | USE | DESCRIBE | SHOW | +|---| --- | --- | ----- | -------- | ---- | +| SPACE | √ | √ | √ | v0.2 | √ | + +增加CREATE、删除DROP、使用USE、列举SHOW,描述DESCRIBE。 +举例如下: + +* 列举出当前所有的space: + +``` +SHOW SPACES +================ +| Name | +================ +| myspace_test | +---------------- +``` + +* 删除space + +``` +DROP SPACE myspace_test +``` +**注意:** 当前版本DROP SPACE后,其中的所有数据会同时删除,且尚未支持恢复功能 + +* 创建space + +``` +CREATE SPACE myspace_test(partition_num=10, replica_factor=1) +``` + +**注意:** partition_num用于控制数据分片数;replica_factor用于控制raft副本数量,单机设为1 + +* 指定使用space + +``` +USE myspace_test +``` + +### Schema管理 + +Schema用于管理节点和边的属性(每个字段的命名和类型),nebula中一个节点可被打卡多个标签。 + +| | CREATE | DROP | ALTER | DESCRIBE | SHOW | TTL | LOAD | DUMP | +|:-: | :-: | :-: |:-: | :-: | :-: | :-: |:-: | :-: | +|TAG | √ | v0.2 | v0.2 | √ | √ | v0.3 | v0.2 | v0.3 | +|EDGE| √ |v0.2 | v0.2 | √ | √ |v0.3 | v0.2 | v0.3 | + +CREATE,DROP,ALTER,DESCRIBE分别对应一个SCHEMA的新建、删除、修改和查看 +举例如下: + +``` +CREATE TAG player(name string, age int); +``` + +``` +DESCRIBE TAG player; +``` + +``` +CREATE TAG team(name string); +``` + +``` +DESCRIBE TAG team; +``` + +``` +CREATE EDGE serve (start_year int, end_year int); +``` + +``` +DESCRIBE EDGE serve; +``` + +``` +CREATE EDGE like (likeness double); +``` + +``` +SHOW TAGS; +``` + +``` +SHOW EDGES +``` + +### 数据操作 + +INSERT 用于插入新的节点或边,更新和删除操作会在v0.2一起发布。 + +| | INSERT | UPDATE | REMOVE | +|:-: | :-: | :-: |:-: | +|TAG | √ | v0.2 | v0.2 | +|EDGE | √ | v0.2 | v0.2| + +插入节点时,需要指定节点的标签类型,以及节点id(也可通过hash自动生成)。 + +举例如下: + +``` +INSERT VERTEX player(name, age) VALUES 100:("Stoudemire", 36); -- 手动指定节点ID +``` + +``` +INSERT VERTEX player(name, age) VALUES hash("Jummy"):("Jummy", 0); -- hash生成节点ID +``` + +``` +INSERT VERTEX player(name, age) VALUES 101:("Vicenta", 0); +``` + +``` +INSERT VERTEX team(name) VALUES 201:("Magic"); +``` + +``` +INSERT EDGE like (likeness) VALUES 100 -> 101:(90.02); +``` + +``` +INSERT EDGE like (likeness) VALUES 101 -> 102:(10.00); +``` + +``` +INSERT EDGE serve (start_year, end_year) VALUES 101 -> 201:(2002, 2010); +``` + +### 图查询 + +当前最常用的图查询/遍历算子是GO,语义是从某个点开始,查询1度近邻。通过结合管道`|`,过滤WHERE、YIELD等条件,实现多跳复杂查询。举例如下: + +``` +GO FROM 100 OVER like; -- 从点100开始,沿like类型的边查询1跳 +``` + +``` +GO 2 STEPS FROM 100 OVER like; -- 从点100开始,沿like类型的边查询2跳 +``` + +``` +GO FROM 100 OVER like WHERE likeness >= 0; -- 从点100开始,沿like类型的边,过滤边上属性likeness +``` + +``` +GO FROM 100 OVER like WHERE $$.player.name=="Vicenta"; -- 过滤要求:终点节点name字段为“Vicenta” +``` + +``` +GO FROM 101 OVER serve YIELD serve._src AS src_id, $^.player.age AS src_propAge, serve._dst AS dst_id, $$.team.name AS dst_propName; -- 返回起点id(重命名为srcid),起点属性age,终点id,终点属性name +``` + +``` +GO FROM 100 OVER like | GO FROM $-.id OVER serve; -- 从点100开始1跳,其输出作为下个query的输入(管道) +``` + + + + diff --git a/docs/how-to-contribute.md b/docs/how-to-contribute.md index 2af9251f16d..a5453d06c41 100644 --- a/docs/how-to-contribute.md +++ b/docs/how-to-contribute.md @@ -55,7 +55,7 @@ This hook checks your commits for formatting, building, doc generation, etc. cd $working_dir/nebula/.git/hooks ln -s ../../cpplint/bin/pre-commit.sh . ``` -Sometime, pre-commit hook can not be executable. In such case, you have to make it executable manually. +Sometimes, pre-commit hook can not be executable. In such case, you have to make it executable manually. ```sh cd $working_dir/nebula/.git/hooks From beaf19020b9356f18f9831159dbb449ed64c66d9 Mon Sep 17 00:00:00 2001 From: Amber Zhang <42762957+Amber1990Zhang@users.noreply.github.com> Date: Mon, 19 Aug 2019 14:18:57 +0800 Subject: [PATCH 08/18] add Chinese docs 2 (#793) --- docs/{cn_doc => cn-doc}/cn-README.md | 3 +- .../cn-contribute-to-documentation.md | 0 docs/{cn_doc => cn-doc}/cn-get-started.md | 2 +- .../cn-how-to-contribute.md | 0 docs/{cn_doc => cn-doc}/cn-nGQL-tutorial.md | 0 .../Language_Structure/Comment_Syntax.md | 21 +++++ .../Language_Structure/Expression.md | 19 +++++ .../Identifier_Case_Sensitivity.md | 16 ++++ .../Keywords_and_Reserved_Words.md | 0 .../Language_Structure/Property_Reference.md | 63 +++++++++++++++ .../Language_Structure/Schema_Object_Names.md | 8 ++ .../Statement_Composition.md | 30 +++++++ .../User-Defined_Variables.md | 18 +++++ .../DATA_Manipulation_Statements/Go_Syntax.md | 79 +++++++++++++++++++ .../INSERT_EDGE_Syntax.md | 45 +++++++++++ .../INSERT_VERTEX_Syntax.md | 44 +++++++++++ .../PIPE_Syntax.md | 11 +++ .../WHERE_Syntax.md | 24 ++++++ .../YIELD_Syntax.md | 46 +++++++++++ .../fetch_Syntax.md | 59 ++++++++++++++ .../Drop_User_Syntax.md | 4 + .../cn_Variables_Syntax.md | 67 ++++++++++++++++ .../Create_Space_Syntax.md | 0 .../Create_Tag_Edge_Syntax.md | 0 .../Drop_Edge_Syntax.md | 9 +++ .../Drop_Space_Syntax.md | 11 +++ .../Drop_Tag_Syntax.md | 13 +++ .../Show_Syntax.md | 0 .../cn_Alter_Tag_Edge_Syntax.md | 34 ++++++++ 29 files changed, 624 insertions(+), 2 deletions(-) rename docs/{cn_doc => cn-doc}/cn-README.md (97%) rename docs/{cn_doc => cn-doc}/cn-contribute-to-documentation.md (100%) rename docs/{cn_doc => cn-doc}/cn-get-started.md (99%) rename docs/{cn_doc => cn-doc}/cn-how-to-contribute.md (100%) rename docs/{cn_doc => cn-doc}/cn-nGQL-tutorial.md (100%) create mode 100644 docs/cn-manual-doc/Language_Structure/Comment_Syntax.md create mode 100644 docs/cn-manual-doc/Language_Structure/Expression.md create mode 100644 docs/cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md create mode 100644 docs/cn-manual-doc/Language_Structure/Keywords_and_Reserved_Words.md create mode 100644 docs/cn-manual-doc/Language_Structure/Property_Reference.md create mode 100644 docs/cn-manual-doc/Language_Structure/Schema_Object_Names.md create mode 100644 docs/cn-manual-doc/Language_Structure/Statement_Composition.md create mode 100644 docs/cn-manual-doc/Language_Structure/User-Defined_Variables.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Space_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Tag_Edge_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Show_Syntax.md create mode 100644 docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md diff --git a/docs/cn_doc/cn-README.md b/docs/cn-doc/cn-README.md similarity index 97% rename from docs/cn_doc/cn-README.md rename to docs/cn-doc/cn-README.md index fcbd4b9388e..1a2ff4bb54c 100644 --- a/docs/cn_doc/cn-README.md +++ b/docs/cn-doc/cn-README.md @@ -7,7 +7,8 @@ **Nebula Graph** 的主要特点: - * 无共享分布式(shared-nothing distributed) + * shared-nothing distributed + * 对称分布 * 可扩展 * 高容错 * 类似SQL的查询语言 diff --git a/docs/cn_doc/cn-contribute-to-documentation.md b/docs/cn-doc/cn-contribute-to-documentation.md similarity index 100% rename from docs/cn_doc/cn-contribute-to-documentation.md rename to docs/cn-doc/cn-contribute-to-documentation.md diff --git a/docs/cn_doc/cn-get-started.md b/docs/cn-doc/cn-get-started.md similarity index 99% rename from docs/cn_doc/cn-get-started.md rename to docs/cn-doc/cn-get-started.md index bb0fb230eff..cd5b0331ab1 100644 --- a/docs/cn_doc/cn-get-started.md +++ b/docs/cn-doc/cn-get-started.md @@ -84,7 +84,7 @@ For macOS users, click the Docker Desktop icon -> Preferences -> Daemon -> Regis 启动docker容器。 -进入容器后,默认在`root`目录下,使用`/usr/local/nebula/script/`切换到`neula`主目录。 +进入容器后,默认在根目录下`/`,使用`/usr/local/nebula/script/`切换到`neula`主目录。 运行 diff --git a/docs/cn_doc/cn-how-to-contribute.md b/docs/cn-doc/cn-how-to-contribute.md similarity index 100% rename from docs/cn_doc/cn-how-to-contribute.md rename to docs/cn-doc/cn-how-to-contribute.md diff --git a/docs/cn_doc/cn-nGQL-tutorial.md b/docs/cn-doc/cn-nGQL-tutorial.md similarity index 100% rename from docs/cn_doc/cn-nGQL-tutorial.md rename to docs/cn-doc/cn-nGQL-tutorial.md diff --git a/docs/cn-manual-doc/Language_Structure/Comment_Syntax.md b/docs/cn-manual-doc/Language_Structure/Comment_Syntax.md new file mode 100644 index 00000000000..e734e25b2b3 --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/Comment_Syntax.md @@ -0,0 +1,21 @@ +Nebula支持四种注释方式: +* 在行末加 # +* 在行末加 -- +* 在行末加 //,与C语言类似 +* 添加`/* */`符号,其开始和结束序列无需在同一行,因此此类注释方式支持换行。 + +尚不支持嵌套注释。 +注释方式示例如下: + +``` +nebula> -- Do nothing this line +nebula> YIELD 1+1 # 注释在本行末结束 +nebula> YIELD 1+1 -- 注释在本行末结束 +nebula> YIELD 1+1 // 注释在本行末结束 +nebula> YIELD 1 /* 此为行内注释 */ + 1 +nebula> YIELD 11 + \ +/* 多行注释使用 \ +隔开 \ +*/ 12 +``` +行内`\`表示换行符。 diff --git a/docs/cn-manual-doc/Language_Structure/Expression.md b/docs/cn-manual-doc/Language_Structure/Expression.md new file mode 100644 index 00000000000..eca08ccd9fd --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/Expression.md @@ -0,0 +1,19 @@ + diff --git a/docs/cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md b/docs/cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md new file mode 100644 index 00000000000..7dae44b8b0e --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md @@ -0,0 +1,16 @@ +In Nebula Graph, Identifiers are case-sensitive. +Nebula Graph标识符为大小写敏感,因此下方示例语句无效,“my_space”和“MY_SPACE”为两个不同的space。 + +``` +nebula> CREATE SPACE my_space; +nebula> use MY_SPACE; +``` + +但是关键词和保留关键词为大小写不敏感,因此如下语句是等价的: + +``` +nebula> show spaces; +nebula> SHOW SPACES; +nebula> SHOW spaces; +nebula> show spaces; +``` diff --git a/docs/cn-manual-doc/Language_Structure/Keywords_and_Reserved_Words.md b/docs/cn-manual-doc/Language_Structure/Keywords_and_Reserved_Words.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/docs/cn-manual-doc/Language_Structure/Property_Reference.md b/docs/cn-manual-doc/Language_Structure/Property_Reference.md new file mode 100644 index 00000000000..4f38d74c277 --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/Property_Reference.md @@ -0,0 +1,63 @@ +# 属性引用 + +`WHERE`和`YIELD`可引用节点或边的属性。 +## 引用点属性 + +### 引用起点属性 + +``` +$^.tag_name.prop_name +``` + +其中符号`$ ^`用于获取起点属性,`tag_name`表示起点的`标签`,`prop_name`为指定属性的名称。 +### 引用终点属性 + +``` +$$.tag_name.prop_name +``` + +其中符号`$$`用于获取终点属性,`tag_name`表示终点的`标签`,`prop_name`为指定属性的名称。 + +### 示例 + +``` +GO FROM 1 YIELD $^.start.name AS startName, $$.end.Age AS endAge +``` + +获取起点的属性名称和终点的属性年龄。 + +## 引用边 + +### 引用边属性 + +使用如下方式获取边属性: + +``` +edge_type.edge_prop +``` + +此处,`edge_type`为边的类型,`edge_prop`为属性,例如: + +``` +GO FROM 1 OVER e1 YIELD e1.prop1 +``` + +### 引用内置属性 + +一条边有四种内置属性: + +- _src: 边起点id +- _dst: 边终点id +- _type: 边类型 +- _rank: 边权重 + +获取起点和终点id可通过`_src`和`_dst`获取,这在显示图路径时经常会用到。 + +例如: + +``` +GO FROM 1 OVER e1 YIELD e1._src as startVID /* which is, 1 */, e1._dst as endVID +``` + +该语句通过引用`e1._src`作为起始顶点id(当然,这是`1`)和`e1._dst`作为结束顶点,返回`1`在边缘类型`e1`上的所有邻域。 ID。 +上述语句返回点`1`沿边`e1`的所有近邻,其中`e1._src`返回起点ID,此处为1,`e1._dst`返回终点ID。 diff --git a/docs/cn-manual-doc/Language_Structure/Schema_Object_Names.md b/docs/cn-manual-doc/Language_Structure/Schema_Object_Names.md new file mode 100644 index 00000000000..ca02aec1adb --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/Schema_Object_Names.md @@ -0,0 +1,8 @@ +Certain objects within Nebula graph, including space, tag, edge, alias, customer variables and other object names are referred as identifiers. This section describes the rules for identifiers in Nebula Graph: +Nebula Graph将以下对象名称作为标识符,包括图空间,标签,边,别名,自定义变量等。本节介绍Nebula Graph标识符规则: +* 标识符中允许的字符: + + ASCII: [_0-9,a-z,A-Z,_] (基本拉丁字母,数字0-9,下划线),不支持其他标点字符。 +* 所有标识符必须以字母表中的字母开头。 +* 标识符区分大小写。 +* 不可使用关键字或保留关键字做标识符。 diff --git a/docs/cn-manual-doc/Language_Structure/Statement_Composition.md b/docs/cn-manual-doc/Language_Structure/Statement_Composition.md new file mode 100644 index 00000000000..692d4685687 --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/Statement_Composition.md @@ -0,0 +1,30 @@ +组合语句(或子查询)的方法有两种: +* 将多个语句放在一个语句中进行批处理,以分号(;)隔开,最后一个语句的结果将作为批处理的结果返回。 + +* 将多个语句通过运算符(|)连接在一起,类似于shell脚本中的管道。前一个语句得到的结果可以重定向到下一个语句作为输入。 + +> 注意复合语句非`事务性`查询。 +>例如,由三个子查询组成的语句:A | B | C,其中A是读操作,B是计算,C是写操作。 + +>如果任何部分在执行中失败,整个结果将未被定义 - 目前尚不支持调用回滚 - 写入内容依赖于查询优化器。 + +### 示例 + +* 分号复合语句 + +``` +SHOW TAGS; SHOW EDGES; -- 仅列出边 + +INSERT VERTEX player(name, age) VALUES 100:("Tim Duncan", 42); \ +INSERT VERTEX player(name, age) VALUES 101:("Tony Parker", 36); \ +INSERT VERTEX player(name, age) VALUES 102:("LaMarcus Aldridge", 33); /* 通过复合语句插入多个点*/ + +``` + +* PIPE管道复合语句 + +``` +GO FROM 201 OVER edge_serve | GO FROM $-.id OVER edge_fans | GO FROM $-.id ... +``` + +占位符`$-.id`获取第一个语句`GO FROM 201 OVER edge_serve`返回的结果。 diff --git a/docs/cn-manual-doc/Language_Structure/User-Defined_Variables.md b/docs/cn-manual-doc/Language_Structure/User-Defined_Variables.md new file mode 100644 index 00000000000..3a8830bfc31 --- /dev/null +++ b/docs/cn-manual-doc/Language_Structure/User-Defined_Variables.md @@ -0,0 +1,18 @@ + diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md new file mode 100644 index 00000000000..f0492a412ff --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md @@ -0,0 +1,79 @@ +`GO`是Nebula中最常用的关键字,表示以指定过滤条件(如`WHERE`)遍历图数据并获取点和边的属性, +以指定顺序(`ORDER BY ASC | DESC`)返回指定数目(`LIMIT`)结果。 + + +>`GO`和`FIND`的用法与SQL中的`SELECT`类似,重要区别是`GO`必须从遍历一系列的节点开始。 + +>请参考`FIND`的用法,它对应于SQL中的`SELECT`。 + +``` +GO FROM +OVER +WHERE (expression [ AND | OR expression ...])   +YIELD | YIELDS  [DISTINCT] + + + | vid [, vid ...] + | $-.id + + + edge_type [, edge_type ...] + + + [AS ] [, [AS ] ...] +``` + +* 为逗号隔开的节点id,或特殊占位符`$-.id`(参看`PIPE`用法)。 +* 为图遍历返回的边类型列表。 +* WHERE 指定被筛选的逻辑条件,WHERE可用于起点,边及终点,同样支持逻辑关键词 +AND,OR,NOT,详情参见WHERE的用法。 +* YIELD [DISTINCT] 以列的形式返回结果,并可对列进行重命名。详情参看`YIELD` +用法。`DISTINCT`的用法与SQL相同。 + +### 示例 + +``` +nebula> GO FROM 101 OVER serve \ + /* 从点101出发,沿边serve,找到点204,215 */ +======= +| id  | +======= +| 204 | +------- +| 215 | +------- +``` + + +``` +nebula> GO FROM 101 OVER serve \ + WHERE serve.start_year > 1990 /* 筛选边serve的start_year属性 */ \ + YIELD $$.team.name AS team_name, /* 目标点team的serve.start_year属性 serve.start_year */ +================================ +| team_name | serve.start_year | +================================ +| Spurs     | 1999             | +--------------------------------  +| Hornets   | 2018             |  +--------------------------------    +``` + +``` +nebula> GO FROM 100,102 OVER serve \ + WHERE serve.start_year > 1995 /* 筛选边属性*/ \ + YIELD DISTINCT $$.team.name AS team_name, /* DISTINCT与SQL用法相同 */ \ + serve.start_year, /* 边属性 */ \ + $^.player.name AS player_name /* 起点(player)属性 */ +======================================================== +| team_name     | serve.start_year | player_name       | +======================================================== +| Trail Blazers | 2006             | LaMarcus Aldridge | +-------------------------------------------------------- +| Spurs         | 2015             | LaMarcus Aldridge | +-------------------------------------------------------- +| Spurs         | 1997             | Tim Duncan        | +--------------------------------------------------------    +``` + + +### 参考 diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md new file mode 100644 index 00000000000..f0fa2ed1e23 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md @@ -0,0 +1,45 @@ +``` +INSERT EDGE edge_name ( ) {VALUES | VALUE} + -> : ( ) +[, -> : ( )] + +: + [ [, ] ...] + +: + [ [, ] ...] +``` + +INSERT EDGE用于插入从起点(src_vid)到终点(dst_vid)的一条边。 + +* ``表示边类型,在进行`INSERT EDGE`操作前需创建好。 +* ``为指定边的属性列表。 +* ``须根据列出属性,如无匹配类型,则返回错误。 + +>目前版本尚不支持默认属性值。 + +### 示例 + +``` +# CREATE EDGE e1() -- 创建空属性边t1 +INSERT EDGE e1 () VALUES 10->11:() -- 插入一条从点10到点11的空属性边 +``` + +``` +# CREATE EDGE e2 (name string, age int) -- 创建有两种属性的边e2 +INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 1) -- 插入一条从点11到点13的 +有两条属性的边 +INSERT EDGE e2 (name, age) VALUES \ +12->13:("n1", 1), 13->14("n2", 2) -- 插入两条边 +INSERT EDGE e2 (name, age) VALUES 11->13:("n1", "a13") -- 错误操作,"a13"不是int类型 +``` + + +同一条边可被多次插入或写入,读取时以最后一次插入为准。 +``` +-- 为插入边赋新值 +insert edge with new version of values.  +INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 12) +INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 13) +INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 14) -- 读取最后插入的值 +``` diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md new file mode 100644 index 00000000000..f62977f52c9 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md @@ -0,0 +1,44 @@ +``` +INSERT VERTEX tag_name[, tag_name] (prop_name_list[, prop_name_list]) + {VALUES | VALUE} vid: (prop_value_list[, prop_value_list]) + +prop_name_list: + [prop_name [, prop_name] ...] + +prop_value_list: + [prop_value [, prop_value] ...] +``` + +INSERT VERTEX可向Nebula插入节点。 +* `tag_name`表示标签(节点类型),在进行`INSERT VERTEX`操作前需创建好。 +* `prop_name_list`为指定标签的属性列表。 +* `prop_value_list`须根据列出属性性,如无匹配类型,则返回错误。 + +>目前版本尚不支持默认属性值。 +### 示例 + +``` +# CREATE TAG t1() -- 创建空属性标签t1 +INSERT VERTEX t1 () VALUES 10:() -- 插入空属性点100 +``` + +``` +# CREATE TAG t2 (name string, age int) -- 创建有两种属性的标签t2 +INSERT VERTEX t2 (name, age) VALUES 11:("n1", 12) -- 插入有两种属性的点11 +INSERT VERTEX t2 (name, age) VALUES 12:("n1", "a13") -- 错误操作,"a13"不是int类型 +``` + +``` +# CREATE TAG t1(i1 int) +# CREATE TAG t2(s2 string) +INSERT VERTEX t1 (i1), t2(s2) VALUES 21: (321, "hello") -- 插入有两个标签的点21 +``` + +同一节点可被多次插入或写入,读取时以最后一次插入为准。 + +``` +-- 为点11多次插入新值 +INSERT VERTEX t2 (name, age) VALUES 11:("n2", 13) +INSERT VERTEX t2 (name, age) VALUES 11:("n3", 14) +INSERT VERTEX t2 (name, age) VALUES 11:("n4", 15)  -- 读取最后插入的值 +``` diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md new file mode 100644 index 00000000000..4833d4b5d0f --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md @@ -0,0 +1,11 @@ + +nGQL和SQL的主要区别之一是子查询的组合方式。 +SQL中的查询语句通常由子查询嵌套组成,而nGQL则使用类似于shell的管道方式`PIPE(|)`来组合子查询 + +### 示例 + +``` +GO FROM 201 OVER edge_serve | GO FROM $-.id OVER edge_fans | GO FROM $-.id ... + +GO FROM 100 OVER like YIELD like._dst AS Id, $$.player.name AS Name | GO FROM $-.Id OVER like YIELD like._dst, like.likeness, $-.Name +``` diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md new file mode 100644 index 00000000000..a3fefd1183f --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md @@ -0,0 +1,24 @@ +目前,`WHERE`语句仅适用于`GO`语句。 + +``` +WHERE (expression [ AND | OR expression ...]) +``` + +通常,筛选条件是关于节点、边的表达式的逻辑组合。 + +>作为语法糖,逻辑和可用`AND`或`&&`,同理,逻辑或可用`OR`或`||`表示。 + +### 示例 + +``` +/* GO FROM 201 OVER like */ -- 适用于GO语句 +WHERE e1.prop1 >= 17 -- 边e1的prop1属性大于17 + +WHERE $^.v1.prop1 == $$.v2.prop2 -- 起点v1的prop1属性与终点v2的prop2属性值相等 + +WHERE ((e3.prop3 < 0.5) OR ($^.v4.prop4 != "hello")) AND $$.v5.prop5 == "world" -- logical combination is allowed + +WHERE 1 == 1 OR TRUE --always TRUE +``` + +### 参考 diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md new file mode 100644 index 00000000000..c9577805838 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md @@ -0,0 +1,46 @@ + +``` +YIELD + [DISTINCT] + [AS ] + [, [AS ] ...] +``` + +* YIELD语句可以独立使用,而无需遍历图数据。您可以使用`AS`重命名返回的列。 + +``` +nebula> YIELD 1 + 1 +========= +| (1+1) | +========= +| 2     | +--------- + +nebula> YIELD "Hel" + "\tlo" AS HELLO_1, ", World!" as WORLD_2 +====================== +| HELLO_1 | WORLD_2  | +====================== +| Hel   lo  | , World! | +---------------------- +``` + +* 但是YIELD语句更常用于返回由`GO`(详情请参阅`GO`用法)语句生成的结果。 + + +``` +nebula> GO FROM 201 OVER relations_edge YIELD $$.student.name AS Friend, $$.student.age AS Age, $$.student.gender AS Gender +========================= +| Friend | Age | Gender | +========================= +| Jane | 17 | female | +------------------------- +``` + +e.g., $$.student.name用来获取目标点($$)的属性。 + +* DISTINCT + +`YIELD DISTINCT`必须与`GO`同时使用 +``` +nebula> YIELD DISTINCT 1 --- 语法错误 +``` diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md new file mode 100644 index 00000000000..d8ed94e15b5 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md @@ -0,0 +1,59 @@ +# Fetch语句 + +`FETCH` 语句用于获取点和边的属性。 + +## 获取点属性 + +`FETCH PROP ON`可返回节点的一系列属性,目前已支持一条语句返回多个节点属性。 + +``` +FETCH PROP ON [YIELD [DISTINCT] ] + +为标签名称,与return_list中的标签相同。 + +::=[vertex_id [, vertex_id]] is a list of vertex id separated by comma(,) + +[YIELD [DISTINCT] ]为返回的属性列表,`YIELD`语法参看[此处](Yield_Syntax.md)。 +``` + +### 示例 + +``` +nebula> FETCH PROP ON player 1 -- 如未指定YIELD字段,则返回节点1的所有属性 + +nebula> FETCH PROP ON player 1 YIELD player.name, player.age -- 返回节点1的姓名与年龄属性 + +nebula> FETCH PROP ON player hash(\"nebula\") YIELD player.name, player.age -- 通过hash生成int64节点id,返回其姓名和年龄属性 + +nebula> GO FROM 1 over e1 | FETCH PROP ON player $- YIELD player.name, player.age -- 沿边e1寻找节点1的所有近邻,返回其姓名和年龄属性 + +nebula> $var = GO FROM 1 over e1; FETCH PROP ON player $var.id YIELD player.name, player.age -- 与上述语句相同 + +nebula> FETCH PROP ON player 1,2,3 YIELD DISTINCT player.name, player.age -- 获取1,2,3三个节点,返回姓名和年龄都不相同的记录 +``` + +## 获取边属性 + +使用`FETCH`获取边属性的用法与点属性大致相同,且可同时获取相同类型多条边的属性。 + +``` +FETCH PROP ON -> [, -> ...] [YIELD [DISTINCT] ] + +指定边的类型,需与相同。 + + -> 从起始节点到终止节点。多条边需使用逗号隔开。 + +[YIELD [DISTINCT] ]为返回的属性列表。 +``` + +### 示例 + +``` +nebula> FETCH PROP ON e1 100 -> 200 -- 本语句未指定YIELD,因此获取从节点100到节点200边e1的所有属性 +nebula> FETCH PROP ON e1 100 -> 200 YIELD e1.p1 -- 仅返回属性p1 +nebula> GO FROM 1 OVER e1 YIELD e1.prop1 -- 获取节点1出边e1的prop1属性 +nebula> GO FROM 1 OVER e1 YIELD e1._src AS s, serve._dst AS d \ + | FETCH PROP ON e1 $-.s -> $-.d YIELD e1.prop1 -- 同上述语句 +nebula> $var = GO FROM 1 OVER e1 YIELD e1._src AS s, e2._dst AS d;\ + FETCH PROP ON serve $var.s -> $var.d YIELD e1.prop1. -- 同上述语句 +``` diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md new file mode 100644 index 00000000000..26e1127203e --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md @@ -0,0 +1,4 @@ +>DROP USER [IF EXISTS] user_name + +只有`God`和`Admin`用户有使用DROP语句的权限。 +`DROP USER` 不会自动关闭任何已打开的客户端连接。 diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md new file mode 100644 index 00000000000..f9c54afd6a9 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md @@ -0,0 +1,67 @@ +Nebula使用`gflags`进行运行时配置。 + +### 显示变量 +``` +SHOW VARIABLES graph|meta|storage +``` + +例如 + +``` +nebula> SHOW VARIABLES meta +============================================================================================================================ +| module | name | type | mode | value | +============================================================================================================================ +| META | v | INT64 | IMMUTABLE | 4 | +---------------------------------------------------------------------------------------------------------------------------- +| META | help | BOOL | IMMUTABLE | False | +---------------------------------------------------------------------------------------------------------------------------- +| META | port | INT64 | IMMUTABLE | 45500 | +---------------------------------------------------------------------------------------------------------------------------- +``` + + +### 获取变量 +``` +GET VARIABLES [graph|meta|storage :] var +``` + +例如 +``` +nebula> GET VARIABLES storage:load_config_interval_secs +================================================================= +| module | name | type | mode | value | +================================================================= +| STORAGE | load_config_interval_secs | INT64 | MUTABLE | 120 | +----------------------------------------------------------------- +``` + +``` +nebula> GET VARIABLES load_config_interval_secs +=================================================================== +| module | name | type | mode | value | +=================================================================== +| META | load_config_interval_secs | INT64 | IMMUTABLE | 120 | +------------------------------------------------------------------- +| STORAGE | load_config_interval_secs | INT64 | MUTABLE | 1 | +------------------------------------------------------------------- +``` + +### 更新变量 +``` +UPDATE VARIABLES [graph|meta|storage :] var = value +``` +> 更新的变量将永久存储于meta-service中。 +> 如果变量模式为`MUTABLE`,更改会即时生效。如果模式为`REBOOT`,更改在服务器重启后生效。 + +例如 +``` +nebula> UPDATE VARIABLES storage:load_config_interval_secs=1 +Execution succeeded (Time spent: 1750/2484 us) +nebula> GET VARIABLES storage:load_config_interval_secs +================================================================= +| module | name | type | mode | value | +================================================================= +| STORAGE | load_config_interval_secs | INT64 | MUTABLE | 1 | +----------------------------------------------------------------- +``` diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Space_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Space_Syntax.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Tag_Edge_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Tag_Edge_Syntax.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md new file mode 100644 index 00000000000..c2b0432582e --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md @@ -0,0 +1,9 @@ +``` +DROP EDGE edge_type_name +``` + +仅支持有DROP权限的用户进行此操作。 + +此操作将移除指定类型的所有边。 + +磁盘中所有文件及路径仅仅逻辑上标记为不可访问,后续版本将支持此功能(参见TODO)。 diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md new file mode 100644 index 00000000000..c76169ca573 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md @@ -0,0 +1,11 @@ +``` +DROP SPACE space_name +``` + +仅支持有DROP权限的用户进行此操作。 +DROP SPACE将删除指定space内的所有点和边。 + +其他space不受影响。 +磁盘中所有文件及路径均不会直接删除,后续版本将支持此功能(参见TODO)。 +此操作不会立即删除存储引擎及磁盘空间内的文件及路径,删除操作取决于存储引擎。 +> 请谨慎进行此操作。 diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md new file mode 100644 index 00000000000..060ec573c84 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md @@ -0,0 +1,13 @@ +``` +DROP TAG tag_name +``` + +仅支持有DROP权限的用户进行此操作。 +> 请谨慎进行此操作。 + +一个节点可以有一个或多个标签(类型)。 + +删除所有标签后,节点将不可访问,同时与节点连接的边也不可使用。 + +删除单个标签后,节点仍可访问,但是已删除标签的属性不可访问。 +磁盘中所有文件及路径均不会直接删除,后续版本将支持此功能(参见TODO)。 diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Show_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Show_Syntax.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md new file mode 100644 index 00000000000..dce1c0516a0 --- /dev/null +++ b/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md @@ -0,0 +1,34 @@ +``` +ALTER {TAG | EDGE} tag_name | edge_name + [alter_definition [, alter_definition] ...] + [ttl_definition [, ttl_definition] ... ] + +alter_definition: +| ADD (prop_name data_type) +| DROP (prop_name) +| CHANGE (prop_name data_type) + +ttl_definition: + TTL_DURATION = ttl_duration, TTL_COL = prop_name +``` + +>`ALTER` 可产生不同的结果,如果使用不匹配的版本/schema,其成行为是未定义的。 + + +`ALTER` 语句可改变标签或边的结构,例如,可以添加或删除属性,更改已有属性的类型或重命名属性,也可 +将属性设置为TTL(生存时间),或更改TTL时间。 + +一个`ALTER`语句允许使用多个`ADD`,`DROP`,`CHANGE`语句,语句之间需用逗号隔开。但是不要在一个 +语句中添加,删除或更改相同的属性。如果必须进行此操作,请将其作为每个`ALTER`的子语句。 + +``` +ALTER TAG t1 ADD (id int, name string) + +ALTER EDGE e1 ADD (prop1 int, prop2 string), /* 添加prop1 */ + CHANGE (prop3 string), /* 将prop3类型更改为字符 */ + DROP (prop4, prop5) /* 删除prop4和prop5 */ + +ALTER EDGE e1 TTL_DURATION = 2, TTL_COL = prop1 -- 注意prop1的值将在2秒内移除 +``` + +注意TTL_COL仅支持INT和TIMESTAMP。 From 80c3cef0e4a401a089b38ae4ec6b66574d2bb257 Mon Sep 17 00:00:00 2001 From: Boyuan Fang <32655525+Priceincoding@users.noreply.github.com> Date: Mon, 19 Aug 2019 15:31:39 +0800 Subject: [PATCH 09/18] Translate manual docs into CN (Partial). (#791) * Translate manual docs into CN (Partial). * Resolve translation problems * Resolve translation problems 2 * Resolve translation problems & add translation for Literals * Resolve translation problems 3 --- .../cn_manual_doc/Data_Types/Nemeric_Types.md | 7 ++ docs/cn_manual_doc/Data_Types/String_Types.md | 3 + .../Comparison_Functions_and_Operators.md | 103 ++++++++++++++++++ .../Functions_and_Operator_Reference.md | 26 +++++ .../Group_By_Function.md | 26 +++++ .../Logical_Operators.md | 49 +++++++++ .../Operator_Precedence.md | 23 ++++ .../Order_By_Function.md | 33 ++++++ .../Functions_and_Operators/Set_Operation.md | 0 .../Type_Conversion.md | 3 + .../Literal_Values/Boolean_Literals.md | 10 ++ .../Literal_Values/NULL_Values.md | 5 + .../Literal_Values/Numeric_Literals.md | 20 ++++ .../Literal_Values/String_Literals.md | 38 +++++++ .../Utility_Statements/DESCRIBE_syntax.md | 50 +++++++++ .../Utility_Statements/USE_syntax.md | 22 ++++ .../literal-values/string-literals.md | 10 +- 17 files changed, 423 insertions(+), 5 deletions(-) create mode 100755 docs/cn_manual_doc/Data_Types/Nemeric_Types.md create mode 100755 docs/cn_manual_doc/Data_Types/String_Types.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Group_By_Function.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Logical_Operators.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Operator_Precedence.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Order_By_Function.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Set_Operation.md create mode 100755 docs/cn_manual_doc/Functions_and_Operators/Type_Conversion.md create mode 100644 docs/cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md create mode 100644 docs/cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md create mode 100644 docs/cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md create mode 100644 docs/cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md create mode 100644 docs/cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md create mode 100644 docs/cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md diff --git a/docs/cn_manual_doc/Data_Types/Nemeric_Types.md b/docs/cn_manual_doc/Data_Types/Nemeric_Types.md new file mode 100755 index 00000000000..40a0bcc4186 --- /dev/null +++ b/docs/cn_manual_doc/Data_Types/Nemeric_Types.md @@ -0,0 +1,7 @@ +# 数类 + +Nebula支持两种基础数据类型 -- int64 & double + +int64的范围是[-9223372036854775808, 9223372036854775807]。double没有上限和下限。 + +注意:在基于int64的计算中不存在溢出。 \ No newline at end of file diff --git a/docs/cn_manual_doc/Data_Types/String_Types.md b/docs/cn_manual_doc/Data_Types/String_Types.md new file mode 100755 index 00000000000..3baa78aaaac --- /dev/null +++ b/docs/cn_manual_doc/Data_Types/String_Types.md @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/docs/cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md b/docs/cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md new file mode 100755 index 00000000000..b78a4ed644f --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md @@ -0,0 +1,103 @@ +# 比较函数和运算符 + +| 运算符 | 描述 | +|:---- |:----:| +| = | 赋值运算符 | +| / | 除法运算符 | +| == | 等于运算符 | +| != | 不等于运算符 | +| < | 小于运算符 | +| <= | 小于或等于运算符 | +| - | 减法运算符 | +| % | 余数运算符 | +| + | 加法运算符 | +| * | 乘法运算符 | +| - | 负号运算符 | + + +比较运算的结果是 _true_ 或 _false_ 。 + +* == + +等于。String的比较大小写敏感。不同类的值不相同: + +``` +nebula> YIELD 'A' == 'a'; +============== +| ("A"=="a") | +============== +| false | +-------------- + +nebula> YIELD '2' == 2; +============ +| ("2"==2) | +============ +|false | +------------ +``` + +* > + +大于: + +``` +nebula> YIELD 3 > 2; +========= +| (3>2) | +========= +| true | +--------- +``` + +* ≥ + +大于或等于: + +``` +nebula> YIELD 2 >= 2; +========== +| (2>=2) | +========== +| true | +---------- +``` + +* < + +小于: + +``` +nebula> YIELD 2.0 < 1.9; +======================= +| (2.000000<1.900000) | +======================= +| false | +----------------------- +``` + +* ≤ + +小于或等于: + +``` +nebula> YIELD 0.11 <= 0.11; +======================== +| (0.110000<=0.110000) | +======================== +| true | +------------------------ +``` + +* != + +不等于: + +``` +nebula> YIELD 1 != '1' +============ +| (1!="1") | +============ +| true | +------------ +``` \ No newline at end of file diff --git a/docs/cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md b/docs/cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md new file mode 100755 index 00000000000..e66b52acdca --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md @@ -0,0 +1,26 @@ +# 函数和运算符 + +| ***名称*** | ***描述*** | +|:----|:----:| +| abs() | 返回绝对值 | +| acos() | 返回反余弦函数值 | +| asin() | 返回反正弦函数值 | +| atan() | 返回反正切函数值 | +| cbrt() | 返回参数的三次方根 | +| ceil() | 返回大于参数的最小整数(向上取整) | +| cos() | 返回余弦函数值 | +| exp() | 增加到自然指数的指定次幂 | +| floor() | 返回小于参数的最大整数(向下取整) | +| hypot() | 返回一个正三角形的斜边 | +| log() | 返回第一个参数的自然对数 | +| log2() | 返回第一个参数底数为2的对数 | +| log10() | 返回第一个参数底数为10的对数 | +| now() | 返回当前日期和时间 | +| pow() | 返回将参数增加到指定次幂 | +| rand32() | 返回一个随机的32位整数 | +| rand64() | 返回一个随机的64位整数 | +| round() | 对参数取整 | +| sin() | 返回正弦函数值 | +| sqrt() | 返回参数的平方根 | +| strcasecmp() | 无视大小写比较字符串 | +| tan() | 返回正切函数值 | diff --git a/docs/cn_manual_doc/Functions_and_Operators/Group_By_Function.md b/docs/cn_manual_doc/Functions_and_Operators/Group_By_Function.md new file mode 100755 index 00000000000..c6070956968 --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Group_By_Function.md @@ -0,0 +1,26 @@ + +# 聚合函数 (Group by) + + `GROUP BY` 函数类似于SQL。 只能在 `YIELD` 语句中使用. + +|名称 | 描述 | +|:----|:----:| +| AVG() | 返回参数的平均值 | +| COUNT() | 返回记录值总数 | +| COUNT(DISTINCT) | 返回独立记录值的总数 | +| MAX() | 返回最大值 | +| MIN() | 返回最小值 | +| STD() | 返回总体标准差 | +| SUM() | 返回总合 | + +以上函数只作用于 int64 和 double。 + +### 示例 + +``` +nebula> GO FROM 1 OVER e1 | YIELD $-.id AS fid, COUNT(*) AS cnt GROUP BY fid +-- 统计与节点"1" 有e1关系的点的id出现的次数 + +nebula> GO FROM 1 YIELD e1._dst AS fid, e1.prop1 AS prop1 | YIELD fid, SUM(prop1) GROUP BY fid +-- 统计与节点"1" 有e1关系的点的prop1的总合。 +``` \ No newline at end of file diff --git a/docs/cn_manual_doc/Functions_and_Operators/Logical_Operators.md b/docs/cn_manual_doc/Functions_and_Operators/Logical_Operators.md new file mode 100755 index 00000000000..ed71d3ba77d --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Logical_Operators.md @@ -0,0 +1,49 @@ +# 逻辑运算符 + +| ***名称*** | ***描述*** | +|:----|:----:| +| && | 逻辑和 AND | +| ! | 逻辑非 NOT | +| \|\| | 逻辑或 OR | + + +在 nGQL 中, 非 0 数字将被视为 _true_. 逻辑运算符的优先级参见 [Operator Precedence](./Operator_Precedence.md)。 + +* && + +逻辑和 AND: + +``` +nebula> YIELD -1 && true; +================ +| (-(1)&&true) | +================ +| true | +---------------- +``` + +* ! + +逻辑非 NOT: + +``` +nebula> YIELD !(-1); +=========== +| !(-(1)) | +=========== +| false | +----------- + +``` + +* || + +逻辑或 OR: + +``` +nebula> YIELD 1 || !1; +============= +| (1||!(1)) | +============= +| true | +``` \ No newline at end of file diff --git a/docs/cn_manual_doc/Functions_and_Operators/Operator_Precedence.md b/docs/cn_manual_doc/Functions_and_Operators/Operator_Precedence.md new file mode 100755 index 00000000000..ae0de1f7d55 --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Operator_Precedence.md @@ -0,0 +1,23 @@ +# 运算符优先级 + +下面的列表展示了 nGQL 运算符的优先级(降序)。同一行的运算符拥有一致的优先级。 +``` +! +- (unary minus) +*, /, % +-, + +== , >=, >, <=, <, <>, != +&& +|| += (assignment) +``` + +在一个表达式中,同等优先级的运算符将按照从左到右的顺序执行,唯一例外是赋值按照从右往左的顺序执行。但是,可以使用括号来修改执行顺序。 + +示例: + +``` +nebula> YIELD 2+3*5; +nebula> YIELD (2+3)*5; +``` + diff --git a/docs/cn_manual_doc/Functions_and_Operators/Order_By_Function.md b/docs/cn_manual_doc/Functions_and_Operators/Order_By_Function.md new file mode 100755 index 00000000000..4f7dee24ebc --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Order_By_Function.md @@ -0,0 +1,33 @@ +# Order By 函数 + +类似于 SQL, `ORDER BY` 可以进行升序 (`ASC`) 或降序 (`DESC`) 的排序来返回结果. +并且它只能在`PIPE`语句 ("|") 中使用 + +``` +ORDER BY ASC | DESC [, ASC | DESC ...] +``` +如果没有指明 ASC 或 DESC,`ORDER BY` 将默认进行升序排序。 + +### 示例 + +``` +nebula> FETCH PROP ON player 1,2,3,4 YIELD player.age AS age, player.weight AS weight | ORDER BY $-.age, $-.weight DESC + +-- 取4个顶点并将他们以age从小到大的顺序排列,如 age 一致,则按 weight 从大到小的顺序排列。 +``` +(参见 `FETCH` 文档来了解使用方法) + +``` +nebula> GO FROM 1 OVER edge2 YIELD $^.t1.prop1 AS s1_p1, edge2.prop2 AS e2_p2, $$.t3.prop3 AS d3_p3 | ORDER BY s1_p1 ASC, e2_p2 DESC, d3_p3 ASC + +-- 返回类似如下的列表 + ========================== + | s1_p1 | e2_p2 | d3_p3 | + -------------------------- + | 123 | 345 | 234 | + | 234 | 32 | 0 | + | 234 | 31 | 0 | + | 234 | 31 | 1 | + ========================== + 第一列按升序排列,第二列按降序排列,第三列按升序排列 +``` diff --git a/docs/cn_manual_doc/Functions_and_Operators/Set_Operation.md b/docs/cn_manual_doc/Functions_and_Operators/Set_Operation.md new file mode 100755 index 00000000000..e69de29bb2d diff --git a/docs/cn_manual_doc/Functions_and_Operators/Type_Conversion.md b/docs/cn_manual_doc/Functions_and_Operators/Type_Conversion.md new file mode 100755 index 00000000000..c426d9bb6b8 --- /dev/null +++ b/docs/cn_manual_doc/Functions_and_Operators/Type_Conversion.md @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md b/docs/cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md new file mode 100644 index 00000000000..245f93d49eb --- /dev/null +++ b/docs/cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md @@ -0,0 +1,10 @@ +# 布尔字面值 + +布尔字面值 `TRUE` 和 `FALSE` 对大小写不敏感。 + +``` +nebula> yield TRUE, true, FALSE, false, FalsE +========================================= +|  true |  true | false | false | false |   +========================================= +``` diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md b/docs/cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md new file mode 100644 index 00000000000..5695f76a65d --- /dev/null +++ b/docs/cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md b/docs/cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md new file mode 100644 index 00000000000..7d8a9bf79a3 --- /dev/null +++ b/docs/cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md @@ -0,0 +1,20 @@ +# 数值字面值 + +数值字面值包括整数字面值和浮点字面值。 + +整数为64位,并且可以用 `+` 和 `-` 来表明正负性。它们和 C 语言中的 `int64_t` 是一致的。 + +浮点数和 C 语言中的 `double` 是一致的。 + +以下为几个例子: + +``` +1, -5, +10000100000 +-2.3, +1.00000000000 +``` + +注意整数的最大值为 `9223372036854775807`。输入任何大于此最大值的整数为语法错误。整数的最小值`-9223372036854775808` 同理。 + +然而浮点数没有上限和下限。 + +科学计数法会在下个 release 版本中支持。 \ No newline at end of file diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md b/docs/cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md new file mode 100644 index 00000000000..6fb5e7e3807 --- /dev/null +++ b/docs/cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md @@ -0,0 +1,38 @@ +# 字符串字面值 + +字符串由一串字节或字符组成,并由一对单引号 (') 或双引号 (") 包装。 + +``` +nebula> YIELD 'a string' +nebula> YIELD "another string" +``` + +一些转义字符 (\\) 已被支持,如下表所示: +| **转移字符** | **对应的字符** | +|:----|:----| +| \' | 单引号 (') | +| \" | 双引号 (") | +| \t | 制表符 | +| \n | 换行符 | +| \b | 退格符 | +| \\\ | 反斜杠 (\\) | + +示例: + +``` +nebula> YIELD 'This\nIs\nFour\nLines' +-------------------- +| This +Is +Four +Lines | +-------------------- + +nebula> YIELD 'disappearing\ backslash'   +-------------------- +|   disappearing backslash |  +-------------------- + + +``` + diff --git a/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md b/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md new file mode 100644 index 00000000000..85fc917de17 --- /dev/null +++ b/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md @@ -0,0 +1,50 @@ +# DESCRIBE + +``` +DESCRIBE SPACE space_name +DESCRIBE TAG tag_name +DESCRIBE EDGE edge_name +``` + +在 Nebula 中 DESCRIBE 和 EXPLAIN 是`不同`的关键词。 DESCRIBE 关键词的作用是获取关于 space, tag, edge 结构的信息。 然而 EXPLAIN 的作用是查看nGQL语句的执行计划。( EXPLAIN 将在下个版本中发布)。 + +同时需要注意的是,DESCRIBE 和 SHOW 也是不同的。 详细参见 SHOW 文档。 + +### 示例 + +获取指定 space 的信息,对应 ` DESCRIBE SPACE `。 + +``` +nebula> DESCRIBE SPACE laura_space; +======================================================== +| ID |        Name | Partition number | Replica Factor | +======================================================== +|  1 | laura_space |             1024 |              1 | +--------------------------------------------------------  +``` + +获取指定 tag 的信息,对应 ` DESCRIBE TAG `。 + +``` +nebula> DESCRIBE TAG player +================== +| Field |   Type | +================== +|  name | string | +------------------ +|   age |    int | +------------------  +``` + +获取指定 EDGE 的信息,对应 ` DESCRIBE EDGE `。 + +``` +nebula> DESCRIBE EDGE serve +===================== +|      Field | Type | +===================== +| start_year |  int | +--------------------- +|   end_year |  int | +--------------------- +``` diff --git a/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md b/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md new file mode 100644 index 00000000000..5108bef0dd2 --- /dev/null +++ b/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md @@ -0,0 +1,22 @@ +# USE + +``` +USE graph_space_name +``` + +在 Nebula 中 `USE` 语句的作用是选择一个图空间来作为当前的工作图空间。USE 需要一些特定的权限来执行。 + +当前的图空间会保持默认直至当前会话结束或另一个 USE 被执行。 + +``` +USE space1 +GO FROM 1 OVER edge1 -- 遍历 space1 +USE space2 +GO FROM 1 OVER edge1 -- 遍历 space2。所有的 nodes 和 edges 与 space1 无关. +USE space1; -- 此时你回到了 space1。 至此你不能从 space2 中读取数据。 +``` + +和 SQL 不同的是,选取一个当前的工作图空间会阻止你访问其他图空间。遍历一个新的图空间的唯一方案是通过 `USE` 语句来切换工作图空间 + +> SPACES 之间是 `完全隔离的`。不像 SQL 允许在一个语句中选择两个来自不同数据库的表单,在 Nebula 中一时间只能对一个图空间进行操作。 + diff --git a/docs/manual-doc/language-structure/literal-values/string-literals.md b/docs/manual-doc/language-structure/literal-values/string-literals.md index 15f62538fc0..1786b661b6a 100644 --- a/docs/manual-doc/language-structure/literal-values/string-literals.md +++ b/docs/manual-doc/language-structure/literal-values/string-literals.md @@ -5,15 +5,15 @@ nebula> YIELD 'a string' nebula> YIELD "another string" ``` -Certain backslash escapes (\) have been supported (also known as the *escape character*). They are shown in the following table: +Certain backslash escapes (\\) have been supported (also known as the *escape character*). They are shown in the following table: | **Escape Sequence** | **Character Represented by Sequence** | |:----|:----| | \' | A single quote (') character | | \" | A double quote (") character | -| \t | A tab character | -| \n | A newline character | -| \b | A backspace character | -| \\ | A backslash (\) character | +| \t | A tab character | +| \n | A newline character | +| \b | A backspace character | +| \\| | A backslash (\\) character | Here are some examples: From e62ccb9513941a55a3171fcbd060abc320ab83f1 Mon Sep 17 00:00:00 2001 From: Boyuan Fang <32655525+Priceincoding@users.noreply.github.com> Date: Mon, 19 Aug 2019 18:39:59 +0800 Subject: [PATCH 10/18] Translate how-to-build.md into CN (#801) --- docs/cn-doc/how-to-build.md | 373 ++++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 docs/cn-doc/how-to-build.md diff --git a/docs/cn-doc/how-to-build.md b/docs/cn-doc/how-to-build.md new file mode 100644 index 00000000000..86b0e5501a6 --- /dev/null +++ b/docs/cn-doc/how-to-build.md @@ -0,0 +1,373 @@ +--- +This tutorial provides an introduction to build `Nebula` code. +--- + +### 编译器 + +Nebula 在 C++14 上开发,因此它需要一个支持 C++14 的编译器。 + +### 支持系统版本 +- Fedora29, 30 +- Centos6.5, 7.5 +- Ubuntu16.04, 18.04 + + +### 在 Fedora29 和 Fedora30 上构建 +#### 步骤 1: 准备工作 +- 安装工具 + + ``` + bash> sudo yum -y install git git-lfs + ``` + +- 安装依赖模块 + + ``` + bash> sudo yum -y install autoconf automake libtool cmake bison unzip boost gperf krb5 openssl libunwind ncurses readline maven java-1.8.0-openjdk + ``` + +#### 步骤 2: 构建和安装第三方库 +第三方库被安装在 **/opt/nebula/third-party** + +``` +bash> git clone https://github.com/vesoft-inc/nebula-3rdparty.git +bash> cd nebula-3rdparty +bash> cmake ./ +bash> cmake -DSKIP_JAVA_JAR=OFF ./ # if you need to build java client +bash> make +bash> sudo make install +``` + +#### 步骤 3: 构建 Nebula +默认的安装路径是 **/usr/local/nebula** + +``` +bash> git clone https://github.com/vesoft-inc/nebula.git +bash> cd nebula && mkdir build && cd build +bash> cmake .. +bash> cmake -DSKIP_JAVA_CLIENT=OFF .. # if you need to build java client +bash> make +bash> sudo make install +``` + +### 在 Centos7.5 上构建 + +#### 步骤 1: 准备工作 +- 安装工具 + + ``` + bash> sudo yum -y install git git-lfs + ``` +- 安装依赖模块 + + 通过 yum install + + ``` + bash> sudo yum install -y libtool autoconf autoconf-archive automake perl-WWW-Curl libstdc++-static maven java-1.8.0-openjdk + ``` + + 和通过 vesoft offer + + ``` + bash> wget https://nebula-graph.oss-cn-hangzhou.aliyuncs.com/build-deb/centos-7.5-1804.tar.gz + ``` + + 1) 建立一个系统用户, 并将其 home 目录设置为共享目录 + + ``` + bash> sudo adduser --system --group --home /home/engshare engshare + ``` + + 2) 确保 home 目录 **/home/engshare** 对全用户可读 + + ``` + bash> chmod -R 755 /home/engshare + ``` + + 3) 在此目录下安装所有需要的 rpm 包 + + ``` + bash> tar xf centos-7.5-1804.tar.gz && cd centos-7.5-1804/ + bash> rpm -ivh *.rpm + ``` + + 4) 在 **~/.bashrc** 末添加如下几行 + + ``` + alias cmake='/home/engshare/cmake/bin/cmake -DCMAKE_C_COMPILER=/home/engshare/gcc/bin/gcc -DCMAKE_CXX_COMPILER=/home/engshare/gcc/bin/g++ -DNEBULA_GPERF_BIN_DIR=/home/engshare/gperf/bin -DNEBULA_FLEX_ROOT=/home/engshare/flex -DNEBULA_BOOST_ROOT=/home/engshare/boost -DNEBULA_OPENSSL_ROOT=/home/engshare/openssl -DNEBULA_KRB5_ROOT=/home/engshare/krb5 -DNEBULA_LIBUNWIND_ROOT=/home/engshare/libunwind' + + alias ctest='/home/engshare/cmake/bin/ctest' + ``` + 5) 应用 **~/.bashrc** 修改 + + ``` + bash> source ~/.bashrc + ``` + +#### 步骤 2: 构建和安装第三方库 +第三方库被安装在 **/opt/nebula/third-party** + +``` +bash> git clone https://github.com/vesoft-inc/nebula-3rdparty.git +bash> cd nebula-3rdparty +bash> cmake ./ +bash> cmake -DSKIP_JAVA_JAR=OFF ./ # if you need to build java client +bash> make +bash> sudo make install +``` + +#### 步骤 3: 构建 Nebula +默认的安装路径是 **/usr/local/nebula** + +``` +bash> git clone https://github.com/vesoft-inc/nebula.git +bash> cd nebula && mkdir build && cd build +bash> cmake .. +bash> cmake -DSKIP_JAVA_CLENT=OFF .. # if you need to build java client +bash> make +bash> sudo make install +``` + +### 在 Centos6.5 上构建 + +#### 步骤 1: 准备工作 +- 安装工具 + + ``` + bash> sudo yum -y install git git-lfs + ``` +- 安装依赖模块 + + 通过 yum install + + ``` + bash> sudo yum -y install libtool autoconf autoconf-archive automake perl-WWW-Curl perl-YAML perl-CGI glibc-devel libstdc++-static maven java-1.8.0-openjdk + ``` + + 和通过 vesoft offer + + ``` + bash> wget https://nebula-graph.oss-cn-hangzhou.aliyuncs.com/build-deb/centos-6.5.tar.gz + ``` + + 1) 在此目录下安装所有需要的 rpm 包 + + ``` + bash> tar xf centos-6.5.tar.gz && cd centos-6.5/ + bash> sudo rpm -ivh *.rpm + ``` + + 2) 在 **~/.bashrc** 末添加如下几行 + + ``` + export PATH=/opt/nebula/autoconf/bin:/opt/nebula/automake/bin:/opt/nebula/libtool/bin:/opt/nebula/git/bin:/opt/nebula/gettext/bin:/opt/nebula/flex/bin:/opt/nebula/bison/bin:/opt/nebula/binutils/bin:$PATH + export ACLOCAL_PATH=/opt/nebula/automake/share/aclocal-1.15:/opt/nebula/libtool/share/aclocal:/opt/nebula/autoconf-archive/share/aclocal + + alias cmake='/opt/nebula/cmake/bin/cmake -DCMAKE_C_COMPILER=/opt/nebula/gcc/bin/gcc -DCMAKE_CXX_COMPILER=/opt/nebula/gcc/bin/g++ -DNEBULA_GPERF_BIN_DIR=/opt/nebula/gperf/bin -DNEBULA_FLEX_ROOT=/opt/nebula/flex -DNEBULA_BISON_ROOT=/opt/nebula/bison -DNEBULA_BOOST_ROOT=/opt/nebula/boost -DNEBULA_OPENSSL_ROOT=/opt/nebula/openssl -DNEBULA_KRB5_ROOT=/opt/nebula/krb5 -DNEBULA_LIBUNWIND_ROOT=/opt/nebula/libunwind -DNEBULA_READLINE_ROOT=/opt/nebula/readline -DNEBULA_NCURSES_ROOT=/opt/nebula/ncurses' + alias ctest='/opt/nebula/cmake/bin/ctest' + ``` + 3) 应用 **~/.bashrc** 修改 + + ``` + bash> source ~/.bashrc + ``` + +#### 步骤 2: 构建和安装第三方库 +第三方库被安装在 **/opt/nebula/third-party** + +``` +bash> git clone https://github.com/vesoft-inc/nebula-3rdparty.git +bash> cd nebula-3rdparty +bash> cmake ./ +bash> cmake -DSKIP_JAVA_JAR=OFF ./ # if you need to build java client +bash> make +bash> sudo make install +``` + +#### 步骤 3: 构建 Nebula +默认的安装路径是 **/usr/local/nebula** + +``` +bash> git clone https://github.com/vesoft-inc/nebula.git +bash> cd nebula && mkdir build && cd build +bash> cmake .. +bash> cmake -DSKIP_JAVA_CLENT=OFF .. # if you need to build java client +bash> make +bash> sudo make install +``` + +### 在 Ubuntu18.04 和 Ubuntu16.04 上构建 + +#### 步骤 1: 准备工作 +- 安装工具 + + ``` + bash> sudo yum -y install git git-lfs + ``` +- 安装依赖模块 + + 通过 apt-get install + + ``` + bash> sudo apt-get -y install gcc-multilib libtool autoconf autoconf-archive automake python maven java-1.8.0-openjdk + ``` + + 通过 vesoft offer + + ``` + bash> wget https://nebula-graph.oss-cn-hangzhou.aliyuncs.com/build-deb/ubuntu1804.tar.gz + ``` + + 1) 建立一个系统用户, 并将其 home 目录设置为共享目录 + + ``` + bash> sudo adduser --system --group --home /home/engshare engshare + ``` + + 2) 确保 home 目录 **/home/engshare** 对全用户可读 + + ``` + bash> chmod -R 755 /home/engshare + ``` + + 3) 在此目录下安装所有需要的 deb 包 + + ``` + bash> tar xf ubuntu1804.tar.gz && cd ubuntu1804/ + bash> sudo dpkg -i *.deb + ``` + + 4) 在 **~/.bashrc** 末添加如下几行 + + ``` + alias cmake='/home/engshare/cmake/bin/cmake -DCMAKE_C_COMPILER=/home/engshare/gcc/bin/gcc -DCMAKE_CXX_COMPILER=/home/engshare/gcc/bin/g++ -DNEBULA_GPERF_BIN_DIR=/home/engshare/gperf/bin -DNEBULA_FLEX_ROOT=/home/engshare/flex -DNEBULA_BOOST_ROOT=/home/engshare/boost -DNEBULA_OPENSSL_ROOT=/home/engshare/openssl -DNEBULA_KRB5_ROOT=/home/engshare/krb5 -DNEBULA_LIBUNWIND_ROOT=/home/engshare/libunwind -DNEBULA_READLINE_ROOT=/home/engshare/readline -DNEBULA_NCURSES_ROOT=/home/engshare/ncurses' + + alias ctest='/home/engshare/cmake/bin/ctest' + ``` + 5) 应用 **~/.bashrc** 修改 + + ``` + bash> source ~/.bashrc + ``` + +#### 步骤 2: 构建和安装第三方库 +第三方库被安装在 **/opt/nebula/third-party** + +``` +bash> git clone https://github.com/vesoft-inc/nebula-3rdparty.git +bash> cd nebula-3rdparty +bash> cmake +bash> cmake -DSKIP_JAVA_JAR=OFF ./ # if you need to build java client +bash> make +bash> sudo make install +``` + +#### 步骤 3: 构建 Nebula +默认的安装路径是 **/usr/local/nebula** + +``` +bash> git clone https://github.com/vesoft-inc/nebula.git +bash> cd nebula && mkdir build && cd build +bash> cmake .. +bash> cmake -DSKIP_JAVA_CLENT=OFF .. # if you need to build java client +bash> make +bash> sudo make install +``` + +#### **构建完成** +- 如果没有任何错误信息 + + ``` + [100%] Built target .... + ``` + **编译成功!** +- 在安装目录 **/usr/local/nebula** 下有如下四个子目录 **etc/**, **bin/**, **scripts/** **share/** + + ``` + [root@centos7.5 nebula]# ls /usr/local/nebula/ + bin etc scripts share + ``` + **现在可以开始运行 Nebula** [get_start](https://github.com/vesoft-inc/nebula/blob/master/docs/get-started.md) + + + +### 常见问题和解决方案 +- **错误信息**: `/usr/bin/ld: cannot find Scrt1.o: No such file or directory` + + **解决方案**: + + **步骤 1**: 在 **~/.bashrc** 末添加如下行 + + ``` + export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH + ``` + + **步骤 2**: 应用 **~/.bashrc** 修改 + + ``` + bash> source ~/.bashrc + ``` + +- **错误信息**: `bison verson less than 3.0.5` + + **解决方案**: + + 1) 下载 bison-3.0.5.tar.gz + + ``` + bash> wget http://ftp.gnu.org/gnu/bison/bison-3.0.5.tar.gz + ``` + + 2) 构建和安装 + + ``` + bash> ./configure + bash> make && make install + + ``` + +- **错误信息**: 构建第三方库失败, 并且 _build.log 提示 `No such file or directory` + + **解决方案**: + + ``` + bash> cd nebula-3rdparty/ + bash> git-lfs pull + ``` + +- **错误信息**: `[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?` + + **解决方案**: + 1) 运行 `java -version` 来获取 jdk 版本信息 + 2) 如果你的 jdk 版本不是 `1.8.0_xxx`,请安装 + + **ubuntu** + + ``` + sudo apt-get -y install openjdk-8-jdk + ``` + + **centos** + + ``` + sudo yum -y install java-1.8.0-openjdk + ``` + + 3) 在 **~/.bashrc** 末添加 + + **ubuntu** + ``` + export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 + export JRE_HOME=$JAVA_HOME/jre + export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH + export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH + ``` + + **centos** + + ``` + export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk + export JRE_HOME=$JAVA_HOME/jre + export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH + export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH + ``` From 545b86813ab8025bd8d1e7f2168e53e76fbfc4a9 Mon Sep 17 00:00:00 2001 From: jude-zhu <51590253+jude-zhu@users.noreply.github.com> Date: Mon, 19 Aug 2019 22:26:36 +0800 Subject: [PATCH 11/18] change file structure (#802) * add create-tag-edge, show and update get-started * update * update * update * update * add FAQ * update * update * update * update * file structure * add create-tag-edge, show and update get-started * update * add FAQ * update * update * update * update * file structure * change build * update * update * update * update * update * last update * update * update --- README-EN.md | 39 +++ README.md | 61 ++-- docs/cn-doc/cn-README.md | 37 --- docs/get-started.md | 169 ++++------- .../contribute-to-documentation.md} | 0 .../data-types/numeric-types.md} | 0 .../data-types/string-types.md} | 0 .../comparison-functions-and-operators.md} | 0 .../functions-and-operator-reference.md} | 0 .../group-by-function.md} | 0 .../logical-operators.md} | 0 .../operator-precedence.md} | 0 .../order-by-function.md} | 0 .../functions-and-operators/set-operation.md} | 0 .../type-conversion.md} | 0 .../get-started.md} | 275 +++++++++--------- docs/{cn-doc => manual-CN}/how-to-build.md | 0 .../how-to-contribute.md} | 0 .../language-structure/comment-syntax.md} | 0 .../language-structure/expression.md} | 0 .../identifier-case-sensitivity.md} | 0 .../keywords-and-reserved-words.md | 0 .../literal-values/NULL-values.md} | 0 .../literal-values/boolean-literals.md} | 0 .../literal-values/numeric-literals.md} | 0 .../literal-values/string-literals.md} | 0 .../language-structure/property-reference.md} | 0 .../schema-object-names.md} | 0 .../statement-composition.md} | 0 .../user-defined-variables.md} | 0 .../nGQL-tutorial.md} | 0 .../drop-user-syntax.md} | 0 .../variables-syntax.md} | 0 .../alter-tag-edge-syntax.md} | 0 .../create-space-syntax.md} | 0 .../create-tag-edge-syntax.md} | 0 .../drop-edge-syntax.md} | 0 .../drop-space-syntax.md} | 0 .../drop-tag-syntax.md} | 0 .../show-syntax.md} | 0 .../fetch-syntax.md} | 0 .../go-syntax.md} | 0 .../insert-edge-syntax.md} | 0 .../insert-vertex-syntax.md} | 0 .../pipe-syntax.md} | 0 .../where-syntax.md} | 0 .../yield-syntax.md} | 0 .../utility-statements/describe-syntax.md} | 0 .../utility-statements/use-syntax.md} | 0 .../data-types/numeric-types.md | 0 .../data-types/string-types.md | 0 .../comparison-functions-and-operators.md | 0 .../functions-and-operator-reference.md | 0 .../group-by-function.md | 0 .../logical-operators.md | 0 .../operator-precedence.md | 0 .../order-by-function.md | 0 .../functions-and-operators/set-operations.md | 0 .../type-conversion.md | 0 .../language-structure/comment-syntax.md | 0 .../language-structure/expression.md | 0 .../identifier-case-sensitivity.md | 0 .../keywords-and-reserved-words.md} | 0 .../literal-values/NULL-values.md | 0 .../literal-values/boolean-literals.md | 0 .../literal-values/numeric-literals.md | 0 .../literal-values/string-literals.md | 0 .../language-structure/property-reference.md | 0 .../language-structure/schema-object-names.md | 0 .../statement-composition.md | 0 .../user-defined_variable.md | 0 .../drop-user-syntax.md | 0 .../variables-syntax.md | 0 .../alter-tag-edge-syntax.md | 0 .../create-space-syntax.md | 0 .../create-tag-edge-syntax.md | 0 .../drop-edge-syntax.md | 0 .../drop-space-syntax.md | 0 .../drop-tag-syntax.md | 0 .../data-definition-statements/show-syntax.md | 0 .../fetch-syntax.md | 0 .../data-manipulation-statements/go-syntax.md | 0 .../insert-edge-syntax.md | 0 .../insert-vertex-syntax.md | 0 .../pipe-syntax.md | 0 .../where-syntax.md | 0 .../yield-syntax.md | 0 .../utility-statements/describe-syntax.md | 0 .../utility-statements/use-syntax.md | 0 89 files changed, 268 insertions(+), 313 deletions(-) create mode 100644 README-EN.md delete mode 100644 docs/cn-doc/cn-README.md rename docs/{cn-doc/cn-contribute-to-documentation.md => manual-CN/contribute-to-documentation.md} (100%) rename docs/{cn_manual_doc/Data_Types/Nemeric_Types.md => manual-CN/data-types/numeric-types.md} (100%) rename docs/{cn_manual_doc/Data_Types/String_Types.md => manual-CN/data-types/string-types.md} (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md => manual-CN/functions-and-operators/comparison-functions-and-operators.md} (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md => manual-CN/functions-and-operators/functions-and-operator-reference.md} (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Group_By_Function.md => manual-CN/functions-and-operators/group-by-function.md} (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Logical_Operators.md => manual-CN/functions-and-operators/logical-operators.md} (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Operator_Precedence.md => manual-CN/functions-and-operators/operator-precedence.md} (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Order_By_Function.md => manual-CN/functions-and-operators/order-by-function.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Keywords_and_Reserved_Words.md => manual-CN/functions-and-operators/set-operation.md} (100%) mode change 100644 => 100755 rename docs/{cn_manual_doc/Functions_and_Operators/Type_Conversion.md => manual-CN/functions-and-operators/type-conversion.md} (100%) rename docs/{cn-doc/cn-get-started.md => manual-CN/get-started.md} (55%) rename docs/{cn-doc => manual-CN}/how-to-build.md (100%) rename docs/{cn-doc/cn-how-to-contribute.md => manual-CN/how-to-contribute.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Comment_Syntax.md => manual-CN/language-structure/comment-syntax.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Expression.md => manual-CN/language-structure/expression.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md => manual-CN/language-structure/identifier-case-sensitivity.md} (100%) rename docs/{manual-doc => manual-CN}/language-structure/keywords-and-reserved-words.md (100%) rename docs/{cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md => manual-CN/language-structure/literal-values/NULL-values.md} (100%) rename docs/{cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md => manual-CN/language-structure/literal-values/boolean-literals.md} (100%) rename docs/{cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md => manual-CN/language-structure/literal-values/numeric-literals.md} (100%) rename docs/{cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md => manual-CN/language-structure/literal-values/string-literals.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Property_Reference.md => manual-CN/language-structure/property-reference.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Schema_Object_Names.md => manual-CN/language-structure/schema-object-names.md} (100%) rename docs/{cn-manual-doc/Language_Structure/Statement_Composition.md => manual-CN/language-structure/statement-composition.md} (100%) rename docs/{cn-manual-doc/Language_Structure/User-Defined_Variables.md => manual-CN/language-structure/user-defined-variables.md} (100%) rename docs/{cn-doc/cn-nGQL-tutorial.md => manual-CN/nGQL-tutorial.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md => manual-CN/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md => manual-CN/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md => manual-CN/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Space_Syntax.md => manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Tag_Edge_Syntax.md => manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md => manual-CN/statement-syntax/data-definition-statements/drop-edge-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md => manual-CN/statement-syntax/data-definition-statements/drop-space-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md => manual-CN/statement-syntax/data-definition-statements/drop-tag-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Show_Syntax.md => manual-CN/statement-syntax/data-definition-statements/show-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/go-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/pipe-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/where-syntax.md} (100%) rename docs/{cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md => manual-CN/statement-syntax/data-manipulation-statements/yield-syntax.md} (100%) rename docs/{cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md => manual-CN/statement-syntax/utility-statements/describe-syntax.md} (100%) rename docs/{cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md => manual-CN/statement-syntax/utility-statements/use-syntax.md} (100%) rename docs/{manual-doc => manual-EN}/data-types/numeric-types.md (100%) rename docs/{manual-doc => manual-EN}/data-types/string-types.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/comparison-functions-and-operators.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/functions-and-operator-reference.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/group-by-function.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/logical-operators.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/operator-precedence.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/order-by-function.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/set-operations.md (100%) rename docs/{manual-doc => manual-EN}/functions-and-operators/type-conversion.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/comment-syntax.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/expression.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/identifier-case-sensitivity.md (100%) rename docs/{cn_manual_doc/Functions_and_Operators/Set_Operation.md => manual-EN/language-structure/keywords-and-reserved-words.md} (100%) mode change 100755 => 100644 rename docs/{manual-doc => manual-EN}/language-structure/literal-values/NULL-values.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/literal-values/boolean-literals.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/literal-values/numeric-literals.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/literal-values/string-literals.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/property-reference.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/schema-object-names.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/statement-composition.md (100%) rename docs/{manual-doc => manual-EN}/language-structure/user-defined_variable.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/create-space-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/create-tag-edge-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/drop-edge-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/drop-space-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/drop-tag-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-definition-statements/show-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/fetch-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/go-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/insert-edge-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/pipe-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/where-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/data-manipulation-statements/yield-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/utility-statements/describe-syntax.md (100%) rename docs/{manual-doc => manual-EN}/statement-syntax/utility-statements/use-syntax.md (100%) diff --git a/README-EN.md b/README-EN.md new file mode 100644 index 00000000000..875ccc387ce --- /dev/null +++ b/README-EN.md @@ -0,0 +1,39 @@ +![](docs/logo.png) + +[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-green)](#licensing) +[![GitHub release](https://img.shields.io/badge/release-v1.0.0--beta-blue)](https://github.com/vesoft-inc/nebula/releases) + +## Nebula + +**Nebula** is a distributed, scalable, lighting-fast graph database. It is the only solution in the world capable to host graphs with dozens of billions of vertices (nodes) and trillions of edges, while still provides millisecond latency. + +**Nebula's** goal is to provide reading, writing, and computing with high concurrency, low latency for super large scale graphs. Nebula is an open source project and we are looking forward to working with the community to popularize and promote the graph database. + +As a graph database, **Nebula** has these features +* Symmetrically distributed +* Highly scalable +* Fault tolerant +* Strong data consistency +* SQL-like query language + +## How can I get Nebula ## +Apart from installing **Nebula Graph** from source code, you can use the [official Nebula Graph image](https://hub.docker.com/r/vesoft/nebula-graph/tags). For more details on how to install Nebula Graph, see [Get Started](docs/get-started.md). + +## How can I contribute ## +As the team behind **Nebula**, we fully commit to the community and all-in to the open source project. All the core features are and will be implemented in the open source repository. + +We also encourage the community to involve the project. There are a few ways you can contribute: + +* You can download and try **Nebula**, and provide us feedbacks +* You can submit your feature requirements and bug reports +* You can perfectionate documentations +* You can fix bugs or implement features. More details on how to build the project and submit the Pull Requests click [`how-to-contribute`](https://github.com/vesoft-inc/nebula/blob/master/docs/how-to-contribute.md). + +## Licensing ### +**Nebula** is under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license, so you can freely download, modify, deploy the source code to meet your needs. You can also freely deploy **Nebula** as a back-end service to support your SAAS deployment. + +In order to prevent cloud providers monetizing from the project without contributing back, we added [Common Clause 1.0](https://commonsclause.com/) to the project. As mentioned above, we fully commit to the open source community. We would love to hear your thoughts on the licensing model and are willing to make it more suitable for the community. + +## Contact +- Please use [`GitHub issue tracker`](https://github.com/vesoft-inc/nebula/issues) for filling bugs or feature requests. +- Join [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200). \ No newline at end of file diff --git a/README.md b/README.md index b041040e050..f7e1d9ef61c 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,44 @@ -![](docs/logo.png) +

+ +
中文 | English +
世界上唯一能够容纳千亿个顶点和万亿条边,并提供毫秒级查询延时的图数据库解决方案
+

-[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-green)](#licensing) -[![GitHub release](https://img.shields.io/badge/release-v1.0.0--beta-blue)](https://github.com/vesoft-inc/nebula/releases) +

+ WeiXin + Zhihu + Sina Weibo +

-## Nebula +**Nebula Graph** 的目标是为超大规模图数据提供高并发,低延时的读、写及计算。Nebula是一个开源项目,我们期待与社区合作共同推广图数据库。 -**Nebula** is a distributed, scalable, lighting-fast graph database. It is the only solution in the world capable to host graphs with dozens of billions of vertices (nodes) and trillions of edges, while still provides millisecond latency. +**Nebula Graph** 的主要特点: -**Nebula's** goal is to provide reading, writing, and computing with high concurrency, low latency for super large scale graphs. Nebula is an open source project and we are looking forward to working with the community to popularize and promote the graph database. + * shared-nothing distributed + * 对称分布 + * 可扩展 + * 高容错 + * 类似SQL的查询语言 -As a graph database, **Nebula** has these features -* Symmetrically distributed -* Highly scalable -* Fault tolerant -* Strong data consistency -* SQL-like query language +## 获取 `Nebula` ## -## How can I get Nebula ## -Apart from installing **Nebula Graph** from source code, you can use the [official Nebula Graph image](https://hub.docker.com/r/vesoft/nebula-graph/tags). For more details on how to install Nebula Graph, see [Get Started](docs/get-started.md). +**Nebula Graph** 源码参见[GitHub](https://github.com/vesoft-inc/nebula)。 +也可下载Nebula [Docker](https://hub.docker.com/r/vesoft/nebula-graph/tags)镜像进行试用。 +更多详情参见[Get Started](get-started.md). -## How can I contribute ## -As the team behind **Nebula**, we fully commit to the community and all-in to the open source project. All the core features are and will be implemented in the open source repository. +## 参与 `Nebula` ## -We also encourage the community to involve the project. There are a few ways you can contribute: +**Nebula Graph** 是一个完全开源的项目,其所有核心功能都将在开源repository中实现。Nebula鼓励社区参与该项目,目前有以下贡献方式: -* You can download and try **Nebula**, and provide us feedbacks -* You can submit your feature requirements and bug reports -* You can perfectionate documentations -* You can fix bugs or implement features. More details on how to build the project and submit the Pull Requests click [`how-to-contribute`](https://github.com/vesoft-inc/nebula/blob/master/docs/how-to-contribute.md). +* 直接下载试用 **Nebula Graph** 并给出反馈 +* 提交功能要求和错误报告 +* 帮助我们完善文档,详情参见[Contribute to Nebula Graph Docs](cn-contribute-to-documentation.md) -## Licensing ### -**Nebula** is under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license, so you can freely download, modify, deploy the source code to meet your needs. You can also freely deploy **Nebula** as a back-end service to support your SAAS deployment. +## 许可 ### +**Nebula Graph** 使用[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)许可,您可以免费下载,修改,部署源代码以满足您的需求。您还可以将 **Nebula Graph** 作为后端服务部署以支持您的SAAS部署。 -In order to prevent cloud providers monetizing from the project without contributing back, we added [Common Clause 1.0](https://commonsclause.com/) to the project. As mentioned above, we fully commit to the open source community. We would love to hear your thoughts on the licensing model and are willing to make it more suitable for the community. - -## Contact -- Please use [`GitHub issue tracker`](https://github.com/vesoft-inc/nebula/issues) for filling bugs or feature requests. -- Join [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200). +为防止云供应商从项目赢利而不回馈,Nebula在项目中添加了[Common Clause 1.0](https://commonsclause.com/)条款。如上所述,Nebula是一个完全开源的项目,欢迎您就许可模式提议,帮助Nebula更适合社区发展。 +## 联系方式 +- 使用[GitHub issue tracker](https://github.com/vesoft-inc/nebula/issues) 提交错误报告和功能要求。 +- 加入 [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200)。 +- **Nebula Graph** 详情访问[Home Page](http://nebula-graph.io/)。 \ No newline at end of file diff --git a/docs/cn-doc/cn-README.md b/docs/cn-doc/cn-README.md deleted file mode 100644 index 1a2ff4bb54c..00000000000 --- a/docs/cn-doc/cn-README.md +++ /dev/null @@ -1,37 +0,0 @@ -# 欢迎使用Nebula Graph官方文档 ---- - -**Nebula Graph** 是世界上唯一能够容纳千亿个顶点(节点)和万亿条边,并提供毫秒级查询延时的图数据库解决方案。 - -**Nebula Graph** 的目标是为超大规模图数据提供高并发,低延时的读、写及计算。Nebula是一个开源项目,我们期待与社区合作共同推广图数据库。 - -**Nebula Graph** 的主要特点: - - * shared-nothing distributed - * 对称分布 - * 可扩展 - * 高容错 - * 类似SQL的查询语言 - -## 获取 `Nebula` ## - -**Nebula Graph** 源码参见[GitHub](https://github.com/vesoft-inc/nebula)。 -也可下载Nebula [Docker](https://hub.docker.com/r/vesoft/nebula-graph/tags)镜像进行试用。 -更多详情参见[Get Started](cn-get-started.md). - -## 参与 `Nebula` ## - -**Nebula Graph** 是一个完全开源的项目,其所有核心功能都将在开源repository中实现。Nebula鼓励社区参与该项目,目前有以下贡献方式: - -* 直接下载试用 **Nebula Graph** 并给出反馈 -* 提交功能要求和错误报告 -* 帮助我们完善文档,详情参见[Contribute to Nebula Graph Docs](cn-contribute-to-documentation.md) - -## 许可 ### -**Nebula Graph** 使用[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)许可,您可以免费下载,修改,部署源代码以满足您的需求。您还可以将 **Nebula Graph** 作为后端服务部署以支持您的SAAS部署。 - -为防止云供应商从项目赢利而不回馈,Nebula在项目中添加了[Common Clause 1.0](https://commonsclause.com/)条款。如上所述,Nebula是一个完全开源的项目,欢迎您就许可模式提议,帮助Nebula更适合社区发展。 -## 联系方式 -- 使用[GitHub issue tracker](https://github.com/vesoft-inc/nebula/issues) 提交错误报告和功能要求。 -- 加入 [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200)。 -- **Nebula Graph** 详情访问[Home Page](http://nebula-graph.io/)。 diff --git a/docs/get-started.md b/docs/get-started.md index acb69deb3ae..b595967c528 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -1,47 +1,18 @@ ---- - -This tutorial provides a quick introduction to use `Nebula Graph`. - ---- +# Quick Start ## Install Nebula Graph ### From Docker -The easiest way to startup `nebula` is using `docker`. - -First of all, you should make sure that `docker` has been installed on your machine. Open a terminal and run the following command : +The easiest way to get Nebula Graph up and running is using Docker. Before you start, make sure that you have: -``` -> docker --version -Docker version 18.09.2, build 6247962 -``` +* Installed the latest version of [Docker](https://docs.docker.com/) -If `docker` is not found, please see [here](https://docs.docker.com/install/) for more information to install docker. +* Pulled the latest images of Nebula from [Nebula Docker Hub](https://hub.docker.com/r/vesoft/nebula-graph). If not, pull the images using the following command: -After that, using ``` > docker pull vesoft/nebula-graph:latest -ac9208207ada: Pulling fs layer -cdcb67189ff7: Pulling fs layer -80407c3cb6b4: Pulling fs layer -latest: Pulling from vesoft/nebula-graph -ac9208207ada: Pull complete -cdcb67189ff7: Pull complete -80407c3cb6b4: Pull complete -Digest: sha256:72a73c801685595776779291969b57ab758f53ebd9bda8bab56421e50bfee161 -Status: Downloaded newer image for vesoft/nebula-graph:latest -``` -to get `nebula` docker images. - - -Then type command `docker images` to check the image status. - -``` -> docker images -REPOSITORY TAG IMAGE ID CREATED SIZE -vesoft/nebula-graph latest 1afd60e223ca 4 weeks ago 401MB ``` ---- - **Startup Nebula Graph** -When `nebula` image is ready, run +When `nebula` image is ready, run a container: ``` > docker run -it vesoft/nebula-graph:latest /bin/bash ``` -to start and login to the docker container. -After login, you're in the `root` directory and you should use `cd ~/nebula-graph/` to switch to the nebula home directory. - -Run +After login, you're in the `root` directory and you should switch to the nebula directory ``` -> ./start-all.sh -Starting MetaService StorageService and GraphService ... +> cd /usr/local/nebula/ ``` -to start meta service, storage service and graph service. -Run +Start meta service, storage service and graph service: ``` -> ps -ef | grep nebula +> scripts/nebula.service start all ``` -to display the services' running status. +Check services' status: -Please make sure the services are working. +``` +> scripts/nebula.service status all +``` -To connect to the graph server, run +**Connect to Nebula Graph** + +connect to Nebula: ``` -> ./start-console.sh - -Welcome to Nebula Graph (Version 0.1) - -nebula> +> bin/nebula -u=user -p=password ``` +* -u is to set the user name, `user` is the default Nebula user account +* -p is to set password, `password` is the default password for account `user` + If you have any questions or concerns about the deployment procedures, please do not hesitate to open an issue on [GitHub](https://github.com/vesoft-inc/nebula/issues). ### From Source(Linux) **Prerequisite Tools** -Nebula Graph is written in C++14, so it requires a complier supporting C++14 features. +Nebula Graph is written in C++14, so it requires a compiler supporting C++14 features. 3rd-party Libraries @@ -138,6 +105,7 @@ Nebula Graph is written in C++14, so it requires a complier supporting C++14 fea - libunwind - ncurses - readline +- flex It is recommended to install g++ 5 or higher Linux system, such as Fedora 29. Currently, we are using `git-lfs` to store the 3rd-party libraries so make sure @@ -172,49 +140,49 @@ Then run the following command: **Running** -Configure nebula-metad.conf +* Configure nebula-metad.conf -In your Nebula installation directory, run + In your Nebula installation directory, run -``` -> cp etc/nebula-metad.conf.default etc/nebula-metad.conf -``` + ``` + > cp etc/nebula-metad.conf.default etc/nebula-metad.conf + ``` -Modify configurations in nebula-metad.conf: + Modify configurations in nebula-metad.conf: -- local_ip -- port -- ws_http_port metaservice HTTP -- ws_h2_port metaservice HTTP2 + - local_ip + - port + - ws_http_port metaservice HTTP + - ws_h2_port metaservice HTTP2 -Configure nebula-storaged.conf +* Configure nebula-storaged.conf -``` -> cp etc/nebula-storaged.conf.default etc/nebula-storaged.conf -``` + ``` + > cp etc/nebula-storaged.conf.default etc/nebula-storaged.conf + ``` -Modify configurations in nebula-storaged.conf: + Modify configurations in nebula-storaged.conf: -- local_ip -- port -- ws_http_port storageservice HTTP -- ws_h2_port storageservice HTTP2 + - local_ip + - port + - ws_http_port storageservice HTTP + - ws_h2_port storageservice HTTP2 -Configure nebula-graphd.conf +* Configure nebula-graphd.conf -``` -> cp etc/nebula-graphd.conf.default etc/nebula-graphd.conf -``` + ``` + > cp etc/nebula-graphd.conf.default etc/nebula-graphd.conf + ``` -Modify configurations in nebula-graphd.conf: + Modify configurations in nebula-graphd.conf: -- local_ip -- port -- ws_http_port graphservice HTTP -- ws_h2_port graphservice HTTP2 + - local_ip + - port + - ws_http_port graphservice HTTP + - ws_h2_port graphservice HTTP2 -**Start service** +**Start Service** ``` > scripts/nebula.service start all @@ -226,28 +194,26 @@ Make sure all the services are working > scripts/nebula.service status all ``` -**Connect to Nebula** +**Connect to Nebula Graph** ``` > bin/nebula -u=user -p=password ``` -- -u is to set user name, `user` is the default Nebula user account -- -p is to set password, `password` is the default password for account `user` - -`Add HOSTS` to register the storage hosts: +* -u is to set the user name, `user` is the default Nebula user account +* -p is to set password, `password` is the default password for account `user` + Then you’re now ready to start using Nebula Graph. ---- - ## Build Your Own Graph This section describes how to build a graph and run queries. The example is built on the graph below: @@ -282,10 +248,9 @@ There are three kinds of tags (_course_, _building_ and _student_) and two edge } ``` - ### Create a Graph Space -**SPACE** is a region that provides physically isolation of graphs in Nebula. First we need to create a space and use it before other operations. +**SPACE** is a region that provides physically isolation of graphs in Nebula. First, we need to create a space and use it before other operations. @@ -301,9 +266,9 @@ nebula> CREATE SPACE myspace_test2(partition_num=1, replica_factor=1); -- Use this space nebula> USE myspace_test2; ``` -`replica_factor` specifies the number of replicas in the cluster. +* `replica_factor` specifies the number of replicas in the cluster. -`partition_num` specifies the number of partitions in one replica. +* `partition_num` specifies the number of partitions in one replica. ### Define Graph Schema @@ -340,10 +305,9 @@ nebula> DESCRIBE EDGE like; ### Insert Data - Insert the vertices and edges based on the graph above. -``` +``` -- Insert vertices nebula> INSERT VERTEX student(name, age, gender) VALUES 200:("Monica", 16, "female"); nebula> INSERT VERTEX student(name, age, gender) VALUES 201:("Mike", 18, "male"); @@ -351,9 +315,6 @@ nebula> INSERT VERTEX student(name, age, gender) VALUES 202:("Jane", 17, "female nebula> INSERT VERTEX course(name, credits),building(name) VALUES 101:("Math", 3, "No5"); nebula> INSERT VERTEX course(name, credits),building(name) VALUES 102:("English", 6, "No11"); -``` - -``` -- Insert edges nebula> INSERT EDGE select(grade) VALUES 200 -> 101:(5); nebula> INSERT EDGE select(grade) VALUES 200 -> 102:(3); @@ -364,7 +325,7 @@ nebula> INSERT EDGE like(likeness) VALUES 201 -> 200:(85.6); nebula> INSERT EDGE like(likeness) VALUES 201 -> 202:(93.2); ``` -## Sample Queries +### Sample Queries Q1. Find the vertexes that 201 likes: @@ -380,7 +341,7 @@ nebula> GO FROM 201 OVER like; ------- ``` -Q2. Find the vertexes that 201 likes, whose age are greater than 17. Return their name, age and gender, and alias the columns as Friend, Age and Gender, respectively. +Q2. Find the vertexes that 201 likes, whose ages are greater than 17. Return their name, age and gender, and alias the columns as Friend, Age and Gender, respectively. ``` nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name AS Friend, $$.student.age AS Age, $$.student.gender AS Gender; @@ -391,6 +352,7 @@ nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name A | Jane | 17 | female | ------------------------- ``` + `YIELD` specifies what values or results you might want to return from query. `$^` represents the source vertex. @@ -400,7 +362,6 @@ nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name A Q3. Find the selected courses and corresponding grades of students liked by 201. ``` - -- By pipe nebula> GO FROM 201 OVER like | GO FROM $-.id OVER select YIELD $^.student.name AS Student, $$.course.name AS Course, select.grade AS Grade; @@ -426,12 +387,10 @@ nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.nam ----------------------------- | Jane | English | 3 | ----------------------------- - ``` `|` denotes a pipe. The output of the formal query acts as input to the next one like a pipeline. - `$-` refers to the input stream. The second approach adopts a user-defined variable `$a`. The scope of this variable is within the compound statement. diff --git a/docs/cn-doc/cn-contribute-to-documentation.md b/docs/manual-CN/contribute-to-documentation.md similarity index 100% rename from docs/cn-doc/cn-contribute-to-documentation.md rename to docs/manual-CN/contribute-to-documentation.md diff --git a/docs/cn_manual_doc/Data_Types/Nemeric_Types.md b/docs/manual-CN/data-types/numeric-types.md similarity index 100% rename from docs/cn_manual_doc/Data_Types/Nemeric_Types.md rename to docs/manual-CN/data-types/numeric-types.md diff --git a/docs/cn_manual_doc/Data_Types/String_Types.md b/docs/manual-CN/data-types/string-types.md similarity index 100% rename from docs/cn_manual_doc/Data_Types/String_Types.md rename to docs/manual-CN/data-types/string-types.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md b/docs/manual-CN/functions-and-operators/comparison-functions-and-operators.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Comparison_Functions_and_Operators.md rename to docs/manual-CN/functions-and-operators/comparison-functions-and-operators.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md b/docs/manual-CN/functions-and-operators/functions-and-operator-reference.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Functions_and_Operator_Reference.md rename to docs/manual-CN/functions-and-operators/functions-and-operator-reference.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Group_By_Function.md b/docs/manual-CN/functions-and-operators/group-by-function.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Group_By_Function.md rename to docs/manual-CN/functions-and-operators/group-by-function.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Logical_Operators.md b/docs/manual-CN/functions-and-operators/logical-operators.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Logical_Operators.md rename to docs/manual-CN/functions-and-operators/logical-operators.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Operator_Precedence.md b/docs/manual-CN/functions-and-operators/operator-precedence.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Operator_Precedence.md rename to docs/manual-CN/functions-and-operators/operator-precedence.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Order_By_Function.md b/docs/manual-CN/functions-and-operators/order-by-function.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Order_By_Function.md rename to docs/manual-CN/functions-and-operators/order-by-function.md diff --git a/docs/cn-manual-doc/Language_Structure/Keywords_and_Reserved_Words.md b/docs/manual-CN/functions-and-operators/set-operation.md old mode 100644 new mode 100755 similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Keywords_and_Reserved_Words.md rename to docs/manual-CN/functions-and-operators/set-operation.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Type_Conversion.md b/docs/manual-CN/functions-and-operators/type-conversion.md similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Type_Conversion.md rename to docs/manual-CN/functions-and-operators/type-conversion.md diff --git a/docs/cn-doc/cn-get-started.md b/docs/manual-CN/get-started.md similarity index 55% rename from docs/cn-doc/cn-get-started.md rename to docs/manual-CN/get-started.md index cd5b0331ab1..c00b547ef51 100644 --- a/docs/cn-doc/cn-get-started.md +++ b/docs/manual-CN/get-started.md @@ -1,41 +1,23 @@ - ---- -本教程旨在对 **Nebula Graph** 的使用做简要介绍。 +# Quick Start ## 安装Nebula Graph -### 通过Docker +### Docker 方式 -启动 **Nebula Graph** 最快捷的方式是使用`docker`。首先,查看电脑是否已安装Docker: - -``` -> docker --version -Docker version 18.09.2, build 6247962 -``` +Docker 安装方法请参考 [Docker 官方文档](https://docs.docker.com/)。 -如果未安装,参看[这里](https://docs.docker.com/install/)。 -安装之后,运行: +从 Docker 镜像仓库获取最新 [Nebula Graph镜像](https://hub.docker.com/r/vesoft/nebula-graph): ``` > docker pull vesoft/nebula-graph:latest -ac9208207ada: Pulling fs layer -cdcb67189ff7: Pulling fs layer -80407c3cb6b4: Pulling fs layer -latest: Pulling from vesoft/nebula-graph -ac9208207ada: Pull complete -cdcb67189ff7: Pull complete -80407c3cb6b4: Pull complete -Digest: sha256:72a73c801685595776779291969b57ab758f53ebd9bda8bab56421e50bfee161 -Status: Downloaded newer image for vesoft/nebula-graph:latest -``` -下载Nebula镜像。 +``` 国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置国内地址。例如: * Azure 中国镜像 https://dockerhub.azk8s.cn * 七牛云 https://reg-mirror.qiniu.com -linux用户请在/etc/docker/daemon.json 中写入如下内容(如果文件不存在请新建该文件 +Linux 用户请在 `/etc/docker/daemon.json` 中加入如下内容(如果文件不存在请新建该文件) ``` { @@ -46,7 +28,7 @@ linux用户请在/etc/docker/daemon.json 中写入如下内容(如果文件不 } ``` -macOS 用户请点击任务栏中Docker Desktop图标 -> Preferences -> Daemon -> Registry mirrors。 在列表中添加 https://dockerhub.azk8s.cn 和 https://reg-mirror.qiniu.com。修改完成后,点击 Apply & Restart 按钮, 重启Docker。 +macOS 用户请点击任务栏中Docker Desktop图标 -> Preferences -> Daemon -> Registry mirrors。 在列表中添加 https://dockerhub.azk8s.cn 和 https://reg-mirror.qiniu.com 。修改完成后,点击 `Apply & Restart` 按钮, 重启Docker。 镜像下载完成后,键入命令`docker images`查看下载完成的镜像。 @@ -72,37 +54,32 @@ You can add the source at `/etc/docker/daemon.json`, for Linux users: For macOS users, click the Docker Desktop icon -> Preferences -> Daemon -> Registry mirrors. Add https://dockerhub.azk8s.cn and https://reg-mirror.qiniu.com to the list. Once the modification is complete, click the Apply & Restart button to restart Docker. --> ---- - **运行 Nebula Graph** -`nebula` 镜像下载完成后,运行 +`nebula` 镜像下载完成后,运行容器: ``` > docker run -it vesoft/nebula-graph:latest /bin/bash ``` -启动docker容器。 +进入容器后,默认在根目录下 `/` ,切换到 `neula` 主目录: -进入容器后,默认在根目录下`/`,使用`/usr/local/nebula/script/`切换到`neula`主目录。 +``` +> cd /usr/local/nebula/ +``` -运行 +启动 metad,storaged 和 graphd 服务: ``` -> ./start-all.sh -Starting MetaService StorageService and GraphService ... +> scripts/nebula.service start all ``` -启动测试服务,存储服务和图服务。 - -运行 +查看服务状态: ``` -> ps -ef | grep nebula +> scripts/nebula.service status all ``` -查看服务进程,,如果看到nebula-metad, nebula-storaged, nebula-graphd ,则表明服务已成功连接。 - -运行以下命令连接nebula +连接 Nebula Graph: ``` -> ./start-console.sh - -Welcome to Nebula Graph (Version 0.1) - -nebula> +> bin/nebula -u=user -p=password ``` -如果对部署过程有任何问题,欢迎在[GitHub](https://github.com/vesoft-inc/nebula/issues)上提issue。 +如果对部署过程有任何问题,欢迎在 [GitHub](https://github.com/vesoft-inc/nebula/issues) 上提 issue。 -### 编译源码(Linux) +### 编译源码方式 (Linux) -**依赖** +**第三方库** -nebula遵循c++14标准,依赖第三方库: +nebula 遵循 c++14 标准,依赖第三方库: - autoconf - automake @@ -148,76 +121,54 @@ nebula遵循c++14标准,依赖第三方库: - libunwind - ncurses - readline +- flex -建议安装g++ 5以上linux系统, 比如Fedora 29。目前,nebula使用`git-lfs`存储第三方库,请确保获取源代码之前您已安装`git-lfs`。 - -**从GitHub获取源码** - -``` -> git clone https://github.com/vesoft-inc/nebula.git -``` +建议安装 g++ 5 以上 Linux 系统, 比如 Fedora 29。目前,nebula 使用 `git-lfs` 存储第三方库,请确保获取源代码之前您已安装 `git-lfs` 。 **编译** -``` -> cmake ./ -``` - -默认安装到 /usr/local路径,如需指定安装路径,请使用: - -``` -> cmake -DCMAKE_INSTALL_PREFIX=$your_nebula_install_dir -``` - -替换此处的 `$your_nebula_install_dir`。 - -然后运行以下命令: - -``` -> make && make install -``` - -**运行nebula(单机)** - -配置nebula-metad.conf +请参见 [how-to-build.md](./how-to-build.md) -在nebula安装目录下,运行以下命令: +#### 运行 nebula(单机) -``` -> cp etc/nebula-metad.conf.default etc/nebula-metad.conf -``` +* 配置 nebula-metad.conf -根据实际修改nebula-metad.conf中的配置: + 在 nebula 安装目录下,运行以下命令: -- local_ip ip地址 -- port 端口号 -- ws_http_port metaservice HTTP HTTP服务端口号 -- ws_h2_port metaservice HTTP2服务端口号 + ``` + > cp etc/nebula-metad.conf.default etc/nebula-metad.conf + ``` + 根据实际修改 nebula-metad.conf 中的配置: -配置nebula-storaged.conf + - local_ip ip地址 + - port 端口号 + - ws_http_port metaservice HTTP HTTP服务端口号 + - ws_h2_port metaservice HTTP2服务端口号 -``` -> cp etc/nebula-storaged.conf.default etc/nebula-storaged.conf -``` +* 配置 nebula-storaged.conf -根据实际修改nebula-storaged.conf中的配置: + ``` + > cp etc/nebula-storaged.conf.default etc/nebula-storaged.conf + ``` -- local_ip ip地址 -- port 端口号 -- ws_http_port storageservice HTTP服务端口号 -- ws_h2_port storageservice HTTP2服务端口号 + 根据实际修改 nebula-storaged.conf 中的配置: -根据实际修改nebula-graphd.conf中的配置: + - local_ip ip地址 + - port 端口号 + - ws_http_port storageservice HTTP服务端口号 + - ws_h2_port storageservice HTTP2服务端口号 -``` -> cp etc/nebula-graphd.conf.default etc/nebula-graphd.conf -``` +* 配置 nebula-graphd.conf -- local_ip ip地址 -- port 端口号 -- ws_http_port graphservice HTTP服务端口号 -- ws_h2_port graphservice HTTP2服务端口号 + ``` + > cp etc/nebula-graphd.conf.default etc/nebula-graphd.conf + ``` + 根据实际修改 nebula-graphd.conf 中的配置: + - local_ip ip地址 + - port 端口号 + - ws_http_port graphservice HTTP服务端口号 + - ws_h2_port graphservice HTTP2服务端口号 **启动服务** @@ -231,22 +182,22 @@ nebula遵循c++14标准,依赖第三方库: > scripts/nebula.service status all ``` -**连接nebula** +**连接 Nebula Graph** ``` > bin/nebula -u=user -p=password ``` -- -u为用户名,默认值为`user` -- -p为密码,用户`user`的默认密码为`password` +* -u 为用户名,默认值为 `user` +* -p 为密码,用户 `user` 的默认密码为 `password` -`ADD HOSTS`将存储节点注册到元数据服务中 + --- @@ -254,32 +205,31 @@ nebula遵循c++14标准,依赖第三方库: 本节介绍如何构建图数据并进行查询。本示例基于下图构建: - ![Untitled Diagram (1)](https://user-images.githubusercontent.com/51590253/60649144-0774c980-9e74-11e9-86d6-bad1653e70ba.png) 示例数据有三种类型的标签(_course_, _building_,_student_),两种类型的边(_select_ 和 _like_),其schema为: ```json -{ - "tags":{ - "course":[ +{ + "tags":{ + "course":[ "name: string", "credits: integer" ], - "building":[ + "building":[ "name: string" ], - "student":[ + "student":[ "name: string", "age: integer", "gender: string" ] }, - "edges":{ - "select":[ + "edges":{ + "select":[ "grade: integer" ], - "like":[ + "like":[ "likeness: double" ] } @@ -291,27 +241,28 @@ nebula遵循c++14标准,依赖第三方库: nebula中的图存储于 **SPACE** 中,每个space是一个物理隔离的空间。首先,需要创建一个space,然后指定使用该space以完成之后的操作。 -列出已有的space: +列出已有的 space: ``` nebula> SHOW SPACES; ``` -创建一个名为myspace_test2的新space: +创建一个名为 myspace_test2 的新 space: ``` nebula> CREATE SPACE myspace_test2(partition_num=1, replica_factor=1); --- 使用这个space +-- 使用这个 space nebula> USE myspace_test2; ``` -`replica_factor` 用来指定集群复本数。 +* `replica_factor` 用来指定集群副本数。 -`partition_num` 用来指定一个复本中的分区数量。 -### 定义图数据Schema +* `partition_num` 用来指定一个副本中的分区数量。 -使用`CREATE TAG`语句定义带有标签类型和属性列表的标签。 +### 定义图数据 Schema + +使用 `CREATE TAG` 语句定义带有标签类型和属性列表的标签: ``` nebula> CREATE TAG course(name string, credits int); @@ -319,40 +270,39 @@ nebula> CREATE TAG building(name string); nebula> CREATE TAG student(name string, age int, gender string); ``` -使用`CREATE EDGE`语句定义边类型。 +使用`CREATE EDGE`语句定义边类型: ``` nebula> CREATE EDGE like(likeness double); nebula> CREATE EDGE select(grade int); ``` -查看上述创建的标签和边: +查看上述创建的标签和边类型: ``` -- 查看标签列表 nebula> SHOW TAGS; --- 查看边列表 +-- 查看边类型列表 nebula> SHOW EDGES; ``` -查看标签或边的属性 +查看标签或边类型的属性: ``` --- 查看标签属性 +-- 查看标签的属性 nebula> DESCRIBE TAG student; --- 查看边属性 +-- 查看边类型的属性 nebula> DESCRIBE EDGE like; ``` ### 插入数据 -为上述图数据插入点和边。 +根据上图,插入相应的点和边: ``` - -- 插入点 nebula> INSERT VERTEX student(name, age, gender) VALUES 200:("Monica", 16, "female"); nebula> INSERT VERTEX student(name, age, gender) VALUES 201:("Mike", 18, "male"); @@ -360,9 +310,6 @@ nebula> INSERT VERTEX student(name, age, gender) VALUES 202:("Jane", 17, "female nebula> INSERT VERTEX course(name, credits),building(name) VALUES 101:("Math", 3, "No5"); nebula> INSERT VERTEX course(name, credits),building(name) VALUES 102:("English", 6, "No11"); -``` - -``` -- 插入边 nebula> INSERT EDGE select(grade) VALUES 200 -> 101:(5); nebula> INSERT EDGE select(grade) VALUES 200 -> 102:(3); @@ -373,7 +320,7 @@ nebula> INSERT EDGE like(likeness) VALUES 201 -> 200:(85.6); nebula> INSERT EDGE like(likeness) VALUES 201 -> 202:(93.2); ``` -## 示例查询 +### 查询示例 Q1. 查询点201喜欢的点: @@ -389,7 +336,7 @@ nebula> GO FROM 201 OVER like; ------- ``` -Q2. 查询点201喜欢的点,并筛选出年龄大于17岁的点,并返回其姓名,年龄,性别,将其重全名为Friend,Age,Gender。 +Q2. 查询点201喜欢的点,并筛选出年龄大于 17 岁的点,并返回其姓名,年龄,性别,将其重全名为 Friend,Age,Gender。 ``` nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name AS Friend, $$.student.age AS Age, $$.student.gender AS Gender; @@ -401,15 +348,15 @@ nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name A ------------------------- ``` -`YIELD`用来指定目标返回值。 +`YIELD` 用来指定返回信息。 -`$^`为起始点。 +`$^` 为起始点。 `$$` 为目标点。 Q3. 查询点201喜欢的点选择了哪些课程和其对应年级。 -``` +``` -- 使用管道 nebula> GO FROM 201 OVER like | GO FROM $-.id OVER select YIELD $^.student.name AS Student, $$.course.name AS Course, select.grade AS Grade; @@ -435,13 +382,55 @@ nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.nam ----------------------------- | Jane | English | 3 | ----------------------------- - ``` -`|` 表示管道,上一个查询的输出可作为下一个管道的输入。 +`|` 表示管道操作,前一个子查询的结果传递给后一个子查询。 `$-` 表示输入流。 -第二种方法使用了用户定义变量`$a`,此变量仅适用于复合语句。 +第二种方法使用了用户定义变量 `$a`,此变量可以在整个复合语句内使用。 + +## 常见问题 + +> graphd 的配置没有注册到 meta server + + 用 `nebula.service` 脚本启动服务时,`graphd`、 `metad` 和 `storaged` 进程启动速度太快,可能会导致graphd 的配置没有注册到 meta server。restart 的时候也有此问题。 + beta版本用户可以先启动 metad,再启动 storaged 和 graphd 来避免此问题。我们将在下一个版本解决此问题。 + + 先启动 metad: + + ``` + nebula> scripts/nebula.service start metad + [INFO] Starting nebula-metad... + [INFO] Done + ``` + + 再启动 storaged 和 graphd: + + ``` + nebula> scripts/nebula.service start storaged + [INFO] Starting nebula-storaged... + [INFO] Done + + nebula> scripts/nebula.service start graphd + [INFO] Starting nebula-graphd... + [INFO] Done + ``` + +> 当创建 tag 或者 edge 类型后,插入数据时报错 + +可能原因, `load_data_interval_secs` 设置了从 meta server 获取元数据时间间隔,默认的是120s,建议用户改为1s。更改方式: + +* 启动前在nebula-metad.conf 和 nebula-graphd.conf 中加入 + + ``` + --load_data_interval_secs=1 + ``` + +* console启动后,运行: + + ``` + nebula> UPDATE VARIABLES graph:load_data_interval_secs=1 + ``` \ No newline at end of file diff --git a/docs/cn-doc/how-to-build.md b/docs/manual-CN/how-to-build.md similarity index 100% rename from docs/cn-doc/how-to-build.md rename to docs/manual-CN/how-to-build.md diff --git a/docs/cn-doc/cn-how-to-contribute.md b/docs/manual-CN/how-to-contribute.md similarity index 100% rename from docs/cn-doc/cn-how-to-contribute.md rename to docs/manual-CN/how-to-contribute.md diff --git a/docs/cn-manual-doc/Language_Structure/Comment_Syntax.md b/docs/manual-CN/language-structure/comment-syntax.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Comment_Syntax.md rename to docs/manual-CN/language-structure/comment-syntax.md diff --git a/docs/cn-manual-doc/Language_Structure/Expression.md b/docs/manual-CN/language-structure/expression.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Expression.md rename to docs/manual-CN/language-structure/expression.md diff --git a/docs/cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md b/docs/manual-CN/language-structure/identifier-case-sensitivity.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Identifier_Case_Sensitivity.md rename to docs/manual-CN/language-structure/identifier-case-sensitivity.md diff --git a/docs/manual-doc/language-structure/keywords-and-reserved-words.md b/docs/manual-CN/language-structure/keywords-and-reserved-words.md similarity index 100% rename from docs/manual-doc/language-structure/keywords-and-reserved-words.md rename to docs/manual-CN/language-structure/keywords-and-reserved-words.md diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md b/docs/manual-CN/language-structure/literal-values/NULL-values.md similarity index 100% rename from docs/cn_manual_doc/Language_Structure/Literal_Values/NULL_Values.md rename to docs/manual-CN/language-structure/literal-values/NULL-values.md diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md b/docs/manual-CN/language-structure/literal-values/boolean-literals.md similarity index 100% rename from docs/cn_manual_doc/Language_Structure/Literal_Values/Boolean_Literals.md rename to docs/manual-CN/language-structure/literal-values/boolean-literals.md diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md b/docs/manual-CN/language-structure/literal-values/numeric-literals.md similarity index 100% rename from docs/cn_manual_doc/Language_Structure/Literal_Values/Numeric_Literals.md rename to docs/manual-CN/language-structure/literal-values/numeric-literals.md diff --git a/docs/cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md b/docs/manual-CN/language-structure/literal-values/string-literals.md similarity index 100% rename from docs/cn_manual_doc/Language_Structure/Literal_Values/String_Literals.md rename to docs/manual-CN/language-structure/literal-values/string-literals.md diff --git a/docs/cn-manual-doc/Language_Structure/Property_Reference.md b/docs/manual-CN/language-structure/property-reference.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Property_Reference.md rename to docs/manual-CN/language-structure/property-reference.md diff --git a/docs/cn-manual-doc/Language_Structure/Schema_Object_Names.md b/docs/manual-CN/language-structure/schema-object-names.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Schema_Object_Names.md rename to docs/manual-CN/language-structure/schema-object-names.md diff --git a/docs/cn-manual-doc/Language_Structure/Statement_Composition.md b/docs/manual-CN/language-structure/statement-composition.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/Statement_Composition.md rename to docs/manual-CN/language-structure/statement-composition.md diff --git a/docs/cn-manual-doc/Language_Structure/User-Defined_Variables.md b/docs/manual-CN/language-structure/user-defined-variables.md similarity index 100% rename from docs/cn-manual-doc/Language_Structure/User-Defined_Variables.md rename to docs/manual-CN/language-structure/user-defined-variables.md diff --git a/docs/cn-doc/cn-nGQL-tutorial.md b/docs/manual-CN/nGQL-tutorial.md similarity index 100% rename from docs/cn-doc/cn-nGQL-tutorial.md rename to docs/manual-CN/nGQL-tutorial.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md b/docs/manual-CN/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Account_Management_Statements/Drop_User_Syntax.md rename to docs/manual-CN/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md b/docs/manual-CN/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Administration_Statements/cn_Configuration_Statements/cn_Variables_Syntax.md rename to docs/manual-CN/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/cn_Alter_Tag_Edge_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Space_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Space_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Tag_Edge_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Create_Tag_Edge_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/drop-edge-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Edge_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/drop-edge-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/drop-space-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Space_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/drop-space-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/drop-tag-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Drop_Tag_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/drop-tag-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Show_Syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/show-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/cn_Data_Definition_Statements/Show_Syntax.md rename to docs/manual-CN/statement-syntax/data-definition-statements/show-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/fetch_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/go-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/Go_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/go-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_EDGE_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/INSERT_VERTEX_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/pipe-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/PIPE_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/pipe-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/where-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/WHERE_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/where-syntax.md diff --git a/docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/yield-syntax.md similarity index 100% rename from docs/cn-manual-doc/cn_Statement_Syntax/DATA_Manipulation_Statements/YIELD_Syntax.md rename to docs/manual-CN/statement-syntax/data-manipulation-statements/yield-syntax.md diff --git a/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md b/docs/manual-CN/statement-syntax/utility-statements/describe-syntax.md similarity index 100% rename from docs/cn_manual_doc/Statement_Syntax/Utility_Statements/DESCRIBE_syntax.md rename to docs/manual-CN/statement-syntax/utility-statements/describe-syntax.md diff --git a/docs/cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md b/docs/manual-CN/statement-syntax/utility-statements/use-syntax.md similarity index 100% rename from docs/cn_manual_doc/Statement_Syntax/Utility_Statements/USE_syntax.md rename to docs/manual-CN/statement-syntax/utility-statements/use-syntax.md diff --git a/docs/manual-doc/data-types/numeric-types.md b/docs/manual-EN/data-types/numeric-types.md similarity index 100% rename from docs/manual-doc/data-types/numeric-types.md rename to docs/manual-EN/data-types/numeric-types.md diff --git a/docs/manual-doc/data-types/string-types.md b/docs/manual-EN/data-types/string-types.md similarity index 100% rename from docs/manual-doc/data-types/string-types.md rename to docs/manual-EN/data-types/string-types.md diff --git a/docs/manual-doc/functions-and-operators/comparison-functions-and-operators.md b/docs/manual-EN/functions-and-operators/comparison-functions-and-operators.md similarity index 100% rename from docs/manual-doc/functions-and-operators/comparison-functions-and-operators.md rename to docs/manual-EN/functions-and-operators/comparison-functions-and-operators.md diff --git a/docs/manual-doc/functions-and-operators/functions-and-operator-reference.md b/docs/manual-EN/functions-and-operators/functions-and-operator-reference.md similarity index 100% rename from docs/manual-doc/functions-and-operators/functions-and-operator-reference.md rename to docs/manual-EN/functions-and-operators/functions-and-operator-reference.md diff --git a/docs/manual-doc/functions-and-operators/group-by-function.md b/docs/manual-EN/functions-and-operators/group-by-function.md similarity index 100% rename from docs/manual-doc/functions-and-operators/group-by-function.md rename to docs/manual-EN/functions-and-operators/group-by-function.md diff --git a/docs/manual-doc/functions-and-operators/logical-operators.md b/docs/manual-EN/functions-and-operators/logical-operators.md similarity index 100% rename from docs/manual-doc/functions-and-operators/logical-operators.md rename to docs/manual-EN/functions-and-operators/logical-operators.md diff --git a/docs/manual-doc/functions-and-operators/operator-precedence.md b/docs/manual-EN/functions-and-operators/operator-precedence.md similarity index 100% rename from docs/manual-doc/functions-and-operators/operator-precedence.md rename to docs/manual-EN/functions-and-operators/operator-precedence.md diff --git a/docs/manual-doc/functions-and-operators/order-by-function.md b/docs/manual-EN/functions-and-operators/order-by-function.md similarity index 100% rename from docs/manual-doc/functions-and-operators/order-by-function.md rename to docs/manual-EN/functions-and-operators/order-by-function.md diff --git a/docs/manual-doc/functions-and-operators/set-operations.md b/docs/manual-EN/functions-and-operators/set-operations.md similarity index 100% rename from docs/manual-doc/functions-and-operators/set-operations.md rename to docs/manual-EN/functions-and-operators/set-operations.md diff --git a/docs/manual-doc/functions-and-operators/type-conversion.md b/docs/manual-EN/functions-and-operators/type-conversion.md similarity index 100% rename from docs/manual-doc/functions-and-operators/type-conversion.md rename to docs/manual-EN/functions-and-operators/type-conversion.md diff --git a/docs/manual-doc/language-structure/comment-syntax.md b/docs/manual-EN/language-structure/comment-syntax.md similarity index 100% rename from docs/manual-doc/language-structure/comment-syntax.md rename to docs/manual-EN/language-structure/comment-syntax.md diff --git a/docs/manual-doc/language-structure/expression.md b/docs/manual-EN/language-structure/expression.md similarity index 100% rename from docs/manual-doc/language-structure/expression.md rename to docs/manual-EN/language-structure/expression.md diff --git a/docs/manual-doc/language-structure/identifier-case-sensitivity.md b/docs/manual-EN/language-structure/identifier-case-sensitivity.md similarity index 100% rename from docs/manual-doc/language-structure/identifier-case-sensitivity.md rename to docs/manual-EN/language-structure/identifier-case-sensitivity.md diff --git a/docs/cn_manual_doc/Functions_and_Operators/Set_Operation.md b/docs/manual-EN/language-structure/keywords-and-reserved-words.md old mode 100755 new mode 100644 similarity index 100% rename from docs/cn_manual_doc/Functions_and_Operators/Set_Operation.md rename to docs/manual-EN/language-structure/keywords-and-reserved-words.md diff --git a/docs/manual-doc/language-structure/literal-values/NULL-values.md b/docs/manual-EN/language-structure/literal-values/NULL-values.md similarity index 100% rename from docs/manual-doc/language-structure/literal-values/NULL-values.md rename to docs/manual-EN/language-structure/literal-values/NULL-values.md diff --git a/docs/manual-doc/language-structure/literal-values/boolean-literals.md b/docs/manual-EN/language-structure/literal-values/boolean-literals.md similarity index 100% rename from docs/manual-doc/language-structure/literal-values/boolean-literals.md rename to docs/manual-EN/language-structure/literal-values/boolean-literals.md diff --git a/docs/manual-doc/language-structure/literal-values/numeric-literals.md b/docs/manual-EN/language-structure/literal-values/numeric-literals.md similarity index 100% rename from docs/manual-doc/language-structure/literal-values/numeric-literals.md rename to docs/manual-EN/language-structure/literal-values/numeric-literals.md diff --git a/docs/manual-doc/language-structure/literal-values/string-literals.md b/docs/manual-EN/language-structure/literal-values/string-literals.md similarity index 100% rename from docs/manual-doc/language-structure/literal-values/string-literals.md rename to docs/manual-EN/language-structure/literal-values/string-literals.md diff --git a/docs/manual-doc/language-structure/property-reference.md b/docs/manual-EN/language-structure/property-reference.md similarity index 100% rename from docs/manual-doc/language-structure/property-reference.md rename to docs/manual-EN/language-structure/property-reference.md diff --git a/docs/manual-doc/language-structure/schema-object-names.md b/docs/manual-EN/language-structure/schema-object-names.md similarity index 100% rename from docs/manual-doc/language-structure/schema-object-names.md rename to docs/manual-EN/language-structure/schema-object-names.md diff --git a/docs/manual-doc/language-structure/statement-composition.md b/docs/manual-EN/language-structure/statement-composition.md similarity index 100% rename from docs/manual-doc/language-structure/statement-composition.md rename to docs/manual-EN/language-structure/statement-composition.md diff --git a/docs/manual-doc/language-structure/user-defined_variable.md b/docs/manual-EN/language-structure/user-defined_variable.md similarity index 100% rename from docs/manual-doc/language-structure/user-defined_variable.md rename to docs/manual-EN/language-structure/user-defined_variable.md diff --git a/docs/manual-doc/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md b/docs/manual-EN/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md rename to docs/manual-EN/statement-syntax/data-administration-statements/account-management-statements/drop-user-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md b/docs/manual-EN/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md rename to docs/manual-EN/statement-syntax/data-administration-statements/configuration-statements/variables-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/alter-tag-edge-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/create-space-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/create-space-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/create-space-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/create-space-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/create-tag-edge-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/drop-edge-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/drop-edge-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/drop-edge-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/drop-edge-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/drop-space-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/drop-space-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/drop-space-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/drop-space-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/drop-tag-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/drop-tag-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/drop-tag-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/drop-tag-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-definition-statements/show-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/show-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-definition-statements/show-syntax.md rename to docs/manual-EN/statement-syntax/data-definition-statements/show-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/fetch-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/fetch-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/fetch-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/fetch-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/go-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/go-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/go-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/go-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/insert-edge-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/insert-edge-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/pipe-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/pipe-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/pipe-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/pipe-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/where-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/where-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/where-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/where-syntax.md diff --git a/docs/manual-doc/statement-syntax/data-manipulation-statements/yield-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/yield-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/data-manipulation-statements/yield-syntax.md rename to docs/manual-EN/statement-syntax/data-manipulation-statements/yield-syntax.md diff --git a/docs/manual-doc/statement-syntax/utility-statements/describe-syntax.md b/docs/manual-EN/statement-syntax/utility-statements/describe-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/utility-statements/describe-syntax.md rename to docs/manual-EN/statement-syntax/utility-statements/describe-syntax.md diff --git a/docs/manual-doc/statement-syntax/utility-statements/use-syntax.md b/docs/manual-EN/statement-syntax/utility-statements/use-syntax.md similarity index 100% rename from docs/manual-doc/statement-syntax/utility-statements/use-syntax.md rename to docs/manual-EN/statement-syntax/utility-statements/use-syntax.md From 58cacc9f169833e22a37750999d7776fbc13eae9 Mon Sep 17 00:00:00 2001 From: Simon Liu <331435+monadbobo@users.noreply.github.com> Date: Tue, 20 Aug 2019 14:23:42 +0800 Subject: [PATCH 12/18] Issue#655 support for building with Clang (#700) * Issue#655 support for building with Clang Compiled by clang 7.0.1((Fedora 7.0.1-6.fc29) * Modified some of the code according to sherman's comments. --- CMakeLists.txt | 14 ++++++++++++-- src/common/base/test/EitherOrTest.cpp | 1 - src/console/CliManager.cpp | 1 - src/dataman/RowUpdater.cpp | 3 +-- src/dataman/RowWriter.cpp | 3 +-- src/graph/GoExecutor.cpp | 4 ++-- src/graph/ShowExecutor.h | 1 - src/interface/CMakeLists.txt | 5 ++++- src/kvstore/raftex/test/LogAppendTest.cpp | 4 +--- src/meta/client/MetaClient.cpp | 8 ++++---- src/meta/processors/BaseProcessor.inl | 2 +- src/meta/processors/admin/AdminClient.cpp | 12 +++++------- src/meta/processors/admin/BalancePlan.cpp | 3 +-- src/meta/test/AdminClientTest.cpp | 4 +--- src/meta/test/MetaHttpDownloadHandlerTest.cpp | 1 - src/parser/TraverseSentences.cpp | 3 +-- src/storage/QueryBaseProcessor.inl | 4 ++-- src/storage/client/StorageClient.h | 3 +-- 18 files changed, 37 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 574c2ae6950..f356b9eca57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -299,8 +299,18 @@ add_compile_options(-Werror) add_compile_options(-Wunused-parameter) add_compile_options(-Wshadow) -# This requries GCC 5.1+ -add_compile_options(-Wsuggest-override) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # This requries GCC 5.1+ + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1) + add_compile_options(-Wsuggest-override) + endif() +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_compile_options(-Wno-overloaded-virtual) + add_compile_options(-Wno-self-assign-overloaded) + add_compile_options(-Wno-self-move) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -latomic") +endif() + if(ENABLE_ASAN) add_definitions(-DBUILT_WITH_SANITIZER) diff --git a/src/common/base/test/EitherOrTest.cpp b/src/common/base/test/EitherOrTest.cpp index def496c12b4..e745928030a 100644 --- a/src/common/base/test/EitherOrTest.cpp +++ b/src/common/base/test/EitherOrTest.cpp @@ -390,4 +390,3 @@ TEST(EitherOr, Destruct) { } } // namespace nebula - diff --git a/src/console/CliManager.cpp b/src/console/CliManager.cpp index 88f2cc6a6c7..efc68bc93b1 100644 --- a/src/console/CliManager.cpp +++ b/src/console/CliManager.cpp @@ -24,7 +24,6 @@ namespace graph { const int32_t kMaxAuthInfoRetries = 3; const int32_t kMaxUsernameLen = 16; const int32_t kMaxPasswordLen = 24; -const int32_t kMaxCommandLineLen = 1024; CliManager::CliManager() { curSpaceName_ = std::string("(none)"); diff --git a/src/dataman/RowUpdater.cpp b/src/dataman/RowUpdater.cpp index 38f504431bf..0411f0e0ead 100644 --- a/src/dataman/RowUpdater.cpp +++ b/src/dataman/RowUpdater.cpp @@ -156,7 +156,7 @@ ResultType RowUpdater::setString(const folly::StringPiece name, switch (type.get_type()) { case cpp2::SupportedType::STRING: hash = SpookyHashV2::Hash64(name.begin(), name.size(), 0); - updatedFields_[hash] = std::move(v.toString()); + updatedFields_[hash] = v.toString(); break; default: return ResultType::E_INCOMPATIBLE_TYPE; @@ -317,4 +317,3 @@ ResultType RowUpdater::getTimestamp(const folly::StringPiece name, #undef CHECK_UPDATED_FIELDS } // namespace nebula - diff --git a/src/dataman/RowWriter.cpp b/src/dataman/RowWriter.cpp index 0eee2fa0655..10482fe5087 100644 --- a/src/dataman/RowWriter.cpp +++ b/src/dataman/RowWriter.cpp @@ -77,7 +77,7 @@ void RowWriter::encodeTo(std::string& encoded) noexcept { Schema RowWriter::moveSchema() { if (schemaWriter_) { - return std::move(schemaWriter_->moveSchema()); + return schemaWriter_->moveSchema(); } else { return Schema(); } @@ -263,4 +263,3 @@ RowWriter& RowWriter::operator<<(Skip&& skip) noexcept { } } // namespace nebula - diff --git a/src/graph/GoExecutor.cpp b/src/graph/GoExecutor.cpp index aee18590fdf..5bf0e009829 100644 --- a/src/graph/GoExecutor.cpp +++ b/src/graph/GoExecutor.cpp @@ -474,7 +474,7 @@ StatusOr> GoExecutor::getStepOutProps() { for (auto &tagIt : tagProps) { auto status = ectx()->schemaManager()->toTagID(spaceId, tagIt.first); if (!status.ok()) { - return Status::Error("No schema found for '%s'", tagIt.first); + return Status::Error("No schema found for '%s'", tagIt.first.c_str()); } auto tagId = status.value(); for (auto &prop : tagIt.second) { @@ -511,7 +511,7 @@ StatusOr> GoExecutor::getDstProps() { for (auto &tagIt : tagProps) { auto status = ectx()->schemaManager()->toTagID(spaceId, tagIt.first); if (!status.ok()) { - return Status::Error("No schema found for '%s'", tagIt.first); + return Status::Error("No schema found for '%s'", tagIt.first.c_str()); } auto tagId = status.value(); for (auto &prop : tagIt.second) { diff --git a/src/graph/ShowExecutor.h b/src/graph/ShowExecutor.h index 6966edf5a65..105a5c39942 100644 --- a/src/graph/ShowExecutor.h +++ b/src/graph/ShowExecutor.h @@ -37,7 +37,6 @@ class ShowExecutor final : public Executor { private: ShowSentence *sentence_{nullptr}; std::unique_ptr resp_; - ConfigRowItem *configItem_{nullptr}; }; } // namespace graph diff --git a/src/interface/CMakeLists.txt b/src/interface/CMakeLists.txt index 9c417419c85..1f00259a856 100644 --- a/src/interface/CMakeLists.txt +++ b/src/interface/CMakeLists.txt @@ -1,4 +1,7 @@ -add_compile_options(-Wno-maybe-uninitialized) + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + add_compile_options(-Wno-maybe-uninitialized) +endif() set(THRIFT1 ${Fbthrift_BIN}) set(THRIFT_TEMPLATES ${Fbthrift_INCLUDE_DIR}/thrift/templates) diff --git a/src/kvstore/raftex/test/LogAppendTest.cpp b/src/kvstore/raftex/test/LogAppendTest.cpp index 7f341e9cb82..5eac764fe41 100644 --- a/src/kvstore/raftex/test/LogAppendTest.cpp +++ b/src/kvstore/raftex/test/LogAppendTest.cpp @@ -87,7 +87,7 @@ TEST(LogAppend, MultiThreadAppend) { FLAGS_max_batch_size = numThreads * numLogs + 1; std::vector threads; for (int i = 0; i < numThreads; ++i) { - threads.emplace_back(std::thread([i, numLogs, leader] { + threads.emplace_back(std::thread([i, leader] { for (int j = 1; j <= numLogs; ++j) { do { auto fut = leader->appendAsync( @@ -151,5 +151,3 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } - - diff --git a/src/meta/client/MetaClient.cpp b/src/meta/client/MetaClient.cpp index b510d0695cc..5231cdb1eb1 100644 --- a/src/meta/client/MetaClient.cpp +++ b/src/meta/client/MetaClient.cpp @@ -1048,7 +1048,7 @@ MetaClient::regConfig(const std::vector& items) { req.set_items(items); return getResponse(std::move(req), [] (auto client, auto request) { return client->future_regConfig(request); - }, [this] (cpp2::ExecResp&& resp) -> decltype(auto) { + }, [] (cpp2::ExecResp&& resp) -> decltype(auto) { return resp.code == cpp2::ErrorCode::SUCCEEDED; }, true); } @@ -1063,7 +1063,7 @@ MetaClient::getConfig(const cpp2::ConfigModule& module, const std::string& name) req.set_item(item); return getResponse(std::move(req), [] (auto client, auto request) { return client->future_getConfig(request); - }, [this] (cpp2::GetConfigResp&& resp) -> decltype(auto) { + }, [] (cpp2::GetConfigResp&& resp) -> decltype(auto) { return std::move(resp).get_items(); }); } @@ -1082,7 +1082,7 @@ MetaClient::setConfig(const cpp2::ConfigModule& module, const std::string& name, req.set_item(item); return getResponse(std::move(req), [] (auto client, auto request) { return client->future_setConfig(request); - }, [this] (cpp2::ExecResp&& resp) -> decltype(auto) { + }, [] (cpp2::ExecResp&& resp) -> decltype(auto) { return resp.code == cpp2::ErrorCode::SUCCEEDED; }, true); } @@ -1093,7 +1093,7 @@ MetaClient::listConfigs(const cpp2::ConfigModule& module) { req.set_module(module); return getResponse(std::move(req), [] (auto client, auto request) { return client->future_listConfigs(request); - }, [this] (cpp2::ListConfigsResp&& resp) -> decltype(auto) { + }, [] (cpp2::ListConfigsResp&& resp) -> decltype(auto) { return std::move(resp).get_items(); }); } diff --git a/src/meta/processors/BaseProcessor.inl b/src/meta/processors/BaseProcessor.inl index 84597159c8b..c504598e8a7 100644 --- a/src/meta/processors/BaseProcessor.inl +++ b/src/meta/processors/BaseProcessor.inl @@ -158,7 +158,7 @@ int32_t BaseProcessor::autoIncrementId() { kvstore_->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data), - [this] (kvstore::ResultCode code) { + [] (kvstore::ResultCode code) { CHECK_EQ(code, kvstore::ResultCode::SUCCEEDED); }); return id; diff --git a/src/meta/processors/admin/AdminClient.cpp b/src/meta/processors/admin/AdminClient.cpp index 5542f07f116..b507d639433 100644 --- a/src/meta/processors/admin/AdminClient.cpp +++ b/src/meta/processors/admin/AdminClient.cpp @@ -26,7 +26,7 @@ folly::Future AdminClient::transLeader(GraphSpaceID spaceId, req.set_new_leader(to(dst)); return getResponse(leader, std::move(req), [] (auto client, auto request) { return client->future_transLeader(request); - }, [this] (auto&& resp) -> Status { + }, [] (auto&& resp) -> Status { switch (resp.get_code()) { case storage::cpp2::ErrorCode::SUCCEEDED: case storage::cpp2::ErrorCode::E_LEADER_CHANGED: { @@ -52,7 +52,7 @@ folly::Future AdminClient::addPart(GraphSpaceID spaceId, req.set_as_learner(asLearner); return getResponse(host, std::move(req), [] (auto client, auto request) { return client->future_addPart(request); - }, [this] (auto&& resp) -> Status { + }, [] (auto&& resp) -> Status { if (resp.get_code() == storage::cpp2::ErrorCode::SUCCEEDED) { return Status::OK(); } else { @@ -150,7 +150,7 @@ folly::Future AdminClient::updateMeta(GraphSpaceID spaceId, kv_->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data), - [this, p = std::move(pro)] (kvstore::ResultCode code) mutable { + [p = std::move(pro)] (kvstore::ResultCode code) mutable { if (code == kvstore::ResultCode::SUCCEEDED) { p.setValue(Status::OK()); } else { @@ -171,7 +171,7 @@ folly::Future AdminClient::removePart(GraphSpaceID spaceId, req.set_part_id(partId); return getResponse(host, std::move(req), [] (auto client, auto request) { return client->future_removePart(request); - }, [this] (auto&& resp) -> Status { + }, [] (auto&& resp) -> Status { if (resp.get_code() == storage::cpp2::ErrorCode::SUCCEEDED) { return Status::OK(); } else { @@ -195,8 +195,7 @@ folly::Future AdminClient::getResponse( auto client = clientsMan_->client(host, evb); remoteFunc(client, std::move(req)) .then(evb, [p = std::move(pro), - respGen, - this] (folly::Try&& t) mutable { + respGen] (folly::Try&& t) mutable { // exception occurred during RPC if (t.hasException()) { p.setValue(Status::Error(folly::stringPrintf("RPC failure in MetaClient: %s", @@ -337,4 +336,3 @@ StatusOr> AdminClient::getPeers(GraphSpaceID spaceId, Part } // namespace meta } // namespace nebula - diff --git a/src/meta/processors/admin/BalancePlan.cpp b/src/meta/processors/admin/BalancePlan.cpp index 15a2dba73aa..aa828209835 100644 --- a/src/meta/processors/admin/BalancePlan.cpp +++ b/src/meta/processors/admin/BalancePlan.cpp @@ -114,7 +114,7 @@ bool BalancePlan::saveInStore(bool onlyPlan) { kv_->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data), - [this, &baton, &ret] (kvstore::ResultCode code) { + [&baton, &ret] (kvstore::ResultCode code) { if (kvstore::ResultCode::SUCCEEDED == code) { ret = true; } else { @@ -195,4 +195,3 @@ BalancePlan::Status BalancePlan::status(const folly::StringPiece& rawVal) { } // namespace meta } // namespace nebula - diff --git a/src/meta/test/AdminClientTest.cpp b/src/meta/test/AdminClientTest.cpp index 3030eb3f0a3..cf2b55b7b0d 100644 --- a/src/meta/test/AdminClientTest.cpp +++ b/src/meta/test/AdminClientTest.cpp @@ -176,7 +176,7 @@ TEST(AdminClientTest, RetryTest) { kv->asyncMultiPut(kDefaultSpaceId, kDefaultPartId, std::move(data), - [this, &baton] (kvstore::ResultCode code) { + [&baton] (kvstore::ResultCode code) { CHECK_EQ(kvstore::ResultCode::SUCCEEDED, code); baton.post(); }); @@ -259,5 +259,3 @@ int main(int argc, char** argv) { google::SetStderrLogging(google::INFO); return RUN_ALL_TESTS(); } - - diff --git a/src/meta/test/MetaHttpDownloadHandlerTest.cpp b/src/meta/test/MetaHttpDownloadHandlerTest.cpp index e7828b028e5..8ff70aecc00 100644 --- a/src/meta/test/MetaHttpDownloadHandlerTest.cpp +++ b/src/meta/test/MetaHttpDownloadHandlerTest.cpp @@ -107,4 +107,3 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } - diff --git a/src/parser/TraverseSentences.cpp b/src/parser/TraverseSentences.cpp index 248727ca4fc..65e6723aa54 100644 --- a/src/parser/TraverseSentences.cpp +++ b/src/parser/TraverseSentences.cpp @@ -214,8 +214,7 @@ StatusOr EdgeKeyRef::varname() const { } if (uniqVar_.size() != 1) { - return Status::SyntaxError( - "Near %s, Only support single data source.", toString()); + return Status::SyntaxError("Near %s, Only support single data source.", toString().c_str()); } for (auto &var : uniqVar_) { diff --git a/src/storage/QueryBaseProcessor.inl b/src/storage/QueryBaseProcessor.inl index 0601b5ae47b..a7fbdf8aeb1 100644 --- a/src/storage/QueryBaseProcessor.inl +++ b/src/storage/QueryBaseProcessor.inl @@ -378,8 +378,8 @@ kvstore::ResultCode QueryBaseProcessor::collectEdgeProps( getters.getEdgeRank = [&] () -> VariantType { return rank; }; - getters.getSrcTagProp = [&, this] (const std::string& tag, - const std::string& prop) -> OptVariantType { + getters.getSrcTagProp = [&fcontext] (const std::string& tag, + const std::string& prop) -> OptVariantType { auto it = fcontext->tagFilters_.find(std::make_pair(tag, prop)); if (it == fcontext->tagFilters_.end()) { return Status::Error("Invalid Tag Filter"); diff --git a/src/storage/client/StorageClient.h b/src/storage/client/StorageClient.h index 75385d0806e..f11cdeb573a 100644 --- a/src/storage/client/StorageClient.h +++ b/src/storage/client/StorageClient.h @@ -83,7 +83,7 @@ class StorageClient { public: StorageClient(std::shared_ptr ioThreadPool, meta::MetaClient *client); - ~StorageClient(); + virtual ~StorageClient(); folly::SemiFuture> addVertices( GraphSpaceID space, @@ -220,4 +220,3 @@ class StorageClient { #include "storage/client/StorageClient.inl" #endif // STORAGE_CLIENT_STORAGECLIENT_H_ - From a830d90b899ffc3749b0f40af8774c8df00737f9 Mon Sep 17 00:00:00 2001 From: dutor <440396+dutor@users.noreply.github.com> Date: Tue, 20 Aug 2019 15:54:02 +0800 Subject: [PATCH 13/18] Extend FileUtils::makeDir with customized permission mode (#805) --- src/common/fs/FileUtils.cpp | 6 +++--- src/common/fs/FileUtils.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/fs/FileUtils.cpp b/src/common/fs/FileUtils.cpp index c88551ae3f6..d912247c68c 100644 --- a/src/common/fs/FileUtils.cpp +++ b/src/common/fs/FileUtils.cpp @@ -313,7 +313,7 @@ bool FileUtils::remove(const char* path, bool recursively) { } -bool FileUtils::makeDir(const std::string& dir) { +bool FileUtils::makeDir(const std::string& dir, uint32_t mode) { if (dir.empty()) { return false; } @@ -332,13 +332,13 @@ bool FileUtils::makeDir(const std::string& dir) { // create parent if it is not empty if (!parent.empty()) { - bool ret = makeDir(parent.toString()); + bool ret = makeDir(parent.toString(), mode); if (!ret) { return false; } } - int err = mkdir(dir.c_str(), S_IRWXU); + int err = mkdir(dir.c_str(), mode); if (err != 0) { return fileType(dir.c_str()) == FileType::DIRECTORY; } diff --git a/src/common/fs/FileUtils.h b/src/common/fs/FileUtils.h index 74248126e3d..890fec7dacb 100644 --- a/src/common/fs/FileUtils.h +++ b/src/common/fs/FileUtils.h @@ -105,7 +105,7 @@ class FileUtils final { // // It will make the parent directories as needed // (much like commandline "mkdir -p") - static bool makeDir(const std::string& dir); + static bool makeDir(const std::string& dir, uint32_t mode = 0775); // Check the path is exist static bool exist(const std::string& path); From 0065959e5c971b2c63da6c8b9776a234551756a4 Mon Sep 17 00:00:00 2001 From: jude-zhu <51590253+jude-zhu@users.noreply.github.com> Date: Tue, 20 Aug 2019 17:09:15 +0800 Subject: [PATCH 14/18] Updatedoc (#807) * add create-tag-edge, show and update get-started * update * update * update * update * add FAQ * update * update * update * update * file structure * add create-tag-edge, show and update get-started * update * add FAQ * update * update * update * update * file structure * change build * update * update * update * update * update * last update * update * update * update doc * update * update * update * update --- README-CN.md | 47 ++++++++++ README-EN.md | 39 --------- README.md | 56 ++++++------ docs/deploy-cluster.md | 8 +- docs/get-started.md | 12 +-- docs/how-to-build.md | 10 +-- docs/how-to-contribute.md | 22 ++--- docs/manual-CN/contribute-to-documentation.md | 4 +- .../logical-operators.md | 2 +- .../operator-precedence.md | 4 +- docs/manual-CN/get-started.md | 77 ++++++++-------- docs/manual-CN/how-to-build.md | 5 +- docs/manual-CN/how-to-contribute.md | 2 +- .../identifier-case-sensitivity.md | 3 +- .../literal-values/string-literals.md | 5 +- .../language-structure/property-reference.md | 6 +- .../language-structure/schema-object-names.md | 5 +- .../create-space-syntax.md | 40 +++++++++ .../create-tag-edge-syntax.md | 87 +++++++++++++++++++ .../data-definition-statements/show-syntax.md | 31 +++++++ .../fetch-syntax.md | 16 ++-- .../logical-operators.md | 2 +- .../functions-and-operators/set-operations.md | 2 +- .../literal-values/string-literals.md | 3 +- .../create-space-syntax.md | 4 +- .../drop-space-syntax.md | 2 +- .../drop-tag-syntax.md | 4 +- .../fetch-syntax.md | 21 ++--- .../insert-edge-syntax.md | 2 +- .../insert-vertex-syntax.md | 2 +- .../pipe-syntax.md | 2 +- .../where-syntax.md | 4 +- 32 files changed, 342 insertions(+), 187 deletions(-) create mode 100644 README-CN.md delete mode 100644 README-EN.md diff --git a/README-CN.md b/README-CN.md new file mode 100644 index 00000000000..c621b0f1fb5 --- /dev/null +++ b/README-CN.md @@ -0,0 +1,47 @@ +

+ +
中文 | English +
世界上唯一能够容纳千亿个顶点和万亿条边,并提供毫秒级查询延时的图数据库解决方案
+

+ +

+ WeiXin + Zhihu + SegmentFault + Sina Weibo +

+ +**Nebula Graph** 的目标是为超大规模图数据提供高并发,低延时的读、写及计算。Nebula是一个开源项目,我们期待与社区合作共同推广图数据库。 + +**Nebula Graph** 的主要特点: + + * 全对称分布式架构 + * 可扩展 + * 高可用 + * 数据强一致 + * 类 SQL 查询语言 + +## 获取 `Nebula` ## + +除编译源代码外,也可使用 [Nebula Graph 镜像](https://hub.docker.com/r/vesoft/nebula-graph/tags) 进行试用。 +更多详情参见 [Get Started](docs/manual-CN/get-started.md). + +## 参与 `Nebula` ## + +**Nebula Graph** 是一个完全开源的项目,欢迎开源爱好者参与 Nebula 社区,目前有以下贡献方式: + +* 试用 **Nebula Graph** 并给出反馈 +* 提交功能需求或者 issue +* 贡献代码,详情请参见 [How to Contribute](docs/manual-CN/how-to-contribute.md) +* 帮助我们完善文档,详情参见 [Contribute to Nebula Graph Docs](docs/manual-CN/contribute-to-documentation.md) + +## 许可证 ### + +**Nebula Graph** 使用 [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) 许可证,您可以免费下载,修改以及部署源代码。您还可以将 **Nebula Graph** 作为后端服务部署以支持您的 SaaS 部署。 + +为防止云供应商从项目赢利而不回馈,Nebula 在项目中添加了 [Commons Clause 1.0](https://commonsclause.com/) 条款。如上所述,Nebula 是一个完全开源的项目,欢迎您就许可模式提出建议,帮助 Nebula 社区更好地发展。 + +## 联系方式 +- 使用 [GitHub issue tracker](https://github.com/vesoft-inc/nebula/issues) 提交 issue 或功能需求。 +- 加入 [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200)。 +- 访问官网 [Home Page](http://nebula-graph.io/)。 \ No newline at end of file diff --git a/README-EN.md b/README-EN.md deleted file mode 100644 index 875ccc387ce..00000000000 --- a/README-EN.md +++ /dev/null @@ -1,39 +0,0 @@ -![](docs/logo.png) - -[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-green)](#licensing) -[![GitHub release](https://img.shields.io/badge/release-v1.0.0--beta-blue)](https://github.com/vesoft-inc/nebula/releases) - -## Nebula - -**Nebula** is a distributed, scalable, lighting-fast graph database. It is the only solution in the world capable to host graphs with dozens of billions of vertices (nodes) and trillions of edges, while still provides millisecond latency. - -**Nebula's** goal is to provide reading, writing, and computing with high concurrency, low latency for super large scale graphs. Nebula is an open source project and we are looking forward to working with the community to popularize and promote the graph database. - -As a graph database, **Nebula** has these features -* Symmetrically distributed -* Highly scalable -* Fault tolerant -* Strong data consistency -* SQL-like query language - -## How can I get Nebula ## -Apart from installing **Nebula Graph** from source code, you can use the [official Nebula Graph image](https://hub.docker.com/r/vesoft/nebula-graph/tags). For more details on how to install Nebula Graph, see [Get Started](docs/get-started.md). - -## How can I contribute ## -As the team behind **Nebula**, we fully commit to the community and all-in to the open source project. All the core features are and will be implemented in the open source repository. - -We also encourage the community to involve the project. There are a few ways you can contribute: - -* You can download and try **Nebula**, and provide us feedbacks -* You can submit your feature requirements and bug reports -* You can perfectionate documentations -* You can fix bugs or implement features. More details on how to build the project and submit the Pull Requests click [`how-to-contribute`](https://github.com/vesoft-inc/nebula/blob/master/docs/how-to-contribute.md). - -## Licensing ### -**Nebula** is under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license, so you can freely download, modify, deploy the source code to meet your needs. You can also freely deploy **Nebula** as a back-end service to support your SAAS deployment. - -In order to prevent cloud providers monetizing from the project without contributing back, we added [Common Clause 1.0](https://commonsclause.com/) to the project. As mentioned above, we fully commit to the open source community. We would love to hear your thoughts on the licensing model and are willing to make it more suitable for the community. - -## Contact -- Please use [`GitHub issue tracker`](https://github.com/vesoft-inc/nebula/issues) for filling bugs or feature requests. -- Join [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200). \ No newline at end of file diff --git a/README.md b/README.md index f7e1d9ef61c..ad6101b69c9 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,46 @@

-
中文 | English -
世界上唯一能够容纳千亿个顶点和万亿条边,并提供毫秒级查询延时的图数据库解决方案
+
English | 中文 +
A distributed, scalable, lighting-fast graph database

-

+ + +## Nebula -**Nebula Graph** 的目标是为超大规模图数据提供高并发,低延时的读、写及计算。Nebula是一个开源项目,我们期待与社区合作共同推广图数据库。 +**Nebula** is the only solution in the world capable to host graphs with dozens of billions of vertices (nodes) and trillions of edges, while still provides millisecond latency. -**Nebula Graph** 的主要特点: +**Nebula's** goal is to provide reading, writing, and computing with high concurrency, low latency for super large scale graphs. Nebula is an open source project and we are looking forward to working with the community to popularize and promote the graph database. - * shared-nothing distributed - * 对称分布 - * 可扩展 - * 高容错 - * 类似SQL的查询语言 +As a graph database, **Nebula** has these features +* Symmetrically distributed +* Highly scalable +* Fault tolerant +* Strong data consistency +* SQL-like query language -## 获取 `Nebula` ## +## How can I get Nebula ## +Apart from installing **Nebula Graph** from source code, you can use the [official Nebula Graph image](https://hub.docker.com/r/vesoft/nebula-graph/tags). For more details on how to install Nebula Graph, see [Get Started](docs/get-started.md). -**Nebula Graph** 源码参见[GitHub](https://github.com/vesoft-inc/nebula)。 -也可下载Nebula [Docker](https://hub.docker.com/r/vesoft/nebula-graph/tags)镜像进行试用。 -更多详情参见[Get Started](get-started.md). +## How can I contribute ## +As the team behind **Nebula**, we fully commit to the community and all-in to the open source project. All the core features are and will be implemented in the open source repository. -## 参与 `Nebula` ## +We also encourage the community to involve the project. There are a few ways you can contribute: -**Nebula Graph** 是一个完全开源的项目,其所有核心功能都将在开源repository中实现。Nebula鼓励社区参与该项目,目前有以下贡献方式: +* You can download and try **Nebula**, and provide us feedbacks +* You can submit your feature requirements and bug reports +* You can perfectionate documentations +* You can fix bugs or implement features. More details on how to build the project and submit the Pull Requests click [`how-to-contribute`](https://github.com/vesoft-inc/nebula/blob/master/docs/how-to-contribute.md). -* 直接下载试用 **Nebula Graph** 并给出反馈 -* 提交功能要求和错误报告 -* 帮助我们完善文档,详情参见[Contribute to Nebula Graph Docs](cn-contribute-to-documentation.md) +## Licensing ### +**Nebula** is under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license, so you can freely download, modify, deploy the source code to meet your needs. You can also freely deploy **Nebula** as a back-end service to support your SaaS deployment. -## 许可 ### -**Nebula Graph** 使用[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)许可,您可以免费下载,修改,部署源代码以满足您的需求。您还可以将 **Nebula Graph** 作为后端服务部署以支持您的SAAS部署。 +In order to prevent cloud providers monetizing from the project without contributing back, we added [Commons Clause 1.0](https://commonsclause.com/) to the project. As mentioned above, we fully commit to the open source community. We would love to hear your thoughts on the licensing model and are willing to make it more suitable for the community. -为防止云供应商从项目赢利而不回馈,Nebula在项目中添加了[Common Clause 1.0](https://commonsclause.com/)条款。如上所述,Nebula是一个完全开源的项目,欢迎您就许可模式提议,帮助Nebula更适合社区发展。 -## 联系方式 -- 使用[GitHub issue tracker](https://github.com/vesoft-inc/nebula/issues) 提交错误报告和功能要求。 -- 加入 [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200)。 -- **Nebula Graph** 详情访问[Home Page](http://nebula-graph.io/)。 \ No newline at end of file +## Contact +- Please use [`GitHub issue tracker`](https://github.com/vesoft-inc/nebula/issues) for filling bugs or feature requests. +- Join [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200). \ No newline at end of file diff --git a/docs/deploy-cluster.md b/docs/deploy-cluster.md index 6f0cfc25023..2469007310d 100644 --- a/docs/deploy-cluster.md +++ b/docs/deploy-cluster.md @@ -6,17 +6,15 @@ This tutorial provides an introduction to deploy `Nebula` cluster. #### Download and install package -First at all, you can download rpm or deb from [Here](https://github.com/vesoft-inc/nebula/releases). +Currently, we have offered packages for `CentOS 7.5`, `CentOS 6.5`, `Ubuntu 1604` and `Ubuntu 1804`. You can download rpm or deb packages [here](https://github.com/vesoft-inc/nebula/releases). -Currently, we have offered `CentOS 7.5`, `CentOS 6.5`, `Ubuntu 1604` and `Ubuntu 1804`'s installation package. - -For `CentOS`: +For `CentOS` : ``` rpm -ivh nebula-{VERSION}.{SYSTEM_VERSION}.x86_64.rpm ``` -For `Ubuntu`: +For `Ubuntu` : ``` dpkg -i nebula-{VERSION}.{SYSTEM_VERSION}.amd64.deb diff --git a/docs/get-started.md b/docs/get-started.md index b595967c528..da405b1422e 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -152,8 +152,8 @@ Then run the following command: - local_ip - port - - ws_http_port metaservice HTTP - - ws_h2_port metaservice HTTP2 + - ws_http_port: metaservice HTTP port + - ws_h2_port: metaservice HTTP2 port * Configure nebula-storaged.conf @@ -166,8 +166,8 @@ Then run the following command: - local_ip - port - - ws_http_port storageservice HTTP - - ws_h2_port storageservice HTTP2 + - ws_http_port: storageservice HTTP port + - ws_h2_port: storageservice HTTP2 port * Configure nebula-graphd.conf @@ -179,8 +179,8 @@ Then run the following command: - local_ip - port - - ws_http_port graphservice HTTP - - ws_h2_port graphservice HTTP2 + - ws_http_port: graphservice HTTP port + - ws_h2_port: graphservice HTTP2 port **Start Service** diff --git a/docs/how-to-build.md b/docs/how-to-build.md index e88033d134c..6d1a7a8169e 100644 --- a/docs/how-to-build.md +++ b/docs/how-to-build.md @@ -40,12 +40,12 @@ The project itself includes the source code of several 3rd-party libraries, whic - zstd ### How to get 3rd-party Libraries -[Install guide](https://github.com/vesoft-inc/nebula-3rdparty/blob/master/README.md) +Please refer to [Installation Guide](https://github.com/vesoft-inc/nebula-3rdparty/blob/master/README.md) ### How to build - - 1. create build dir : `cd nebula && mkdir build && cd build` - - 2. generate makefile : `cmake -DNEBULA_THIRDPARTY_ROOT=${3rd-party_install_root} ..` - - 3. make : `make or make -j${threadnum}` - - 4. install: `make install` + - create build dir: `cd nebula && mkdir build && cd build` + - generate makefile: `cmake -DNEBULA_THIRDPARTY_ROOT=${3rd-party_install_root} ..` + - make: `make or make -j${threadnum}` + - install: `make install` - notes : the default installation dir is **/usr/local/**, if you want to change the dir, on step 2, your command can be `cmake -DCMAKE_INSTALL_PREFIX=$your_nebula_install_dir ..` diff --git a/docs/how-to-contribute.md b/docs/how-to-contribute.md index a5453d06c41..261a12e2e76 100644 --- a/docs/how-to-contribute.md +++ b/docs/how-to-contribute.md @@ -14,10 +14,10 @@ Define a local working directory: working_dir=$HOME/Workspace ``` -Set `user` to match your github profile name: +Set `user` to match your Github profile name: ```sh -user={your github profile name} +user={your Github profile name} ``` Create your clone: @@ -73,7 +73,7 @@ git checkout master git rebase upstream/master ``` -Branch from master: +Checkout a new branch from master: ```sh git checkout -b myfeature @@ -95,7 +95,7 @@ git push --force origin master #### Edit the code -You can now edit the code on the `myfeature` branch. Please follow the coding style guidance [here](/cpp-coding-style/). +You can now edit the code on the `myfeature` branch. We are following [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). #### Run stand-alone mode @@ -118,7 +118,7 @@ nebula #### Run Test ```sh -# Run unit test to make sure all test passed. +# Run unit test to make sure all tests passed. ``` ### Step 5: Keep your branch in sync @@ -156,13 +156,5 @@ git push -f origin myfeature ### Step 9: Get a code review -Once your pull request has been opened, it will be assigned to at least one -reviewers. Those reviewers will do a thorough code review, looking for -correctness, bugs, opportunities for improvement, documentation and comments, -and style. - -Commit changes made in response to review comments to the same branch on your -fork. - -Very small PRs are easy to review. Very large PRs are very difficult to -review. +Once your pull request has been opened, it will be assigned to at least two +reviewers. Those reviewers will do a thorough code review to ensure the changes meet the repository's contributing guidelines and other quality standards. \ No newline at end of file diff --git a/docs/manual-CN/contribute-to-documentation.md b/docs/manual-CN/contribute-to-documentation.md index fd90708db27..75ba506bf9d 100644 --- a/docs/manual-CN/contribute-to-documentation.md +++ b/docs/manual-CN/contribute-to-documentation.md @@ -2,7 +2,7 @@ --- ## 贡献文档 -Nebula文档完全开源,我们欢迎更多贡献者帮助改进文档。Nebula文档使用Markdown语言,并参考了[Google开发者文档风格指南](https://developers.google.com/style/)进行编写。 +Nebula 文档完全开源,我们欢迎更多贡献者帮助改进文档。Nebula 文档使用 Markdown 语言,并参考了 [Google开发者文档风格指南](https://developers.google.com/style/) 进行编写。 ## 如何贡献 @@ -10,6 +10,6 @@ Nebula文档完全开源,我们欢迎更多贡献者帮助改进文档。Nebul - 使用每页右侧的铅笔标记直接在网站编辑或提交问题。 - - 在GitHub上提[issue](https://github.com/vesoft-inc/nebula/issues)。 + - 在 GitHub 上提 [issue](https://github.com/vesoft-inc/nebula/issues)。 - Fork仓库,在本地分支上做更改,然后提交PR。 diff --git a/docs/manual-CN/functions-and-operators/logical-operators.md b/docs/manual-CN/functions-and-operators/logical-operators.md index ed71d3ba77d..f1fe980e715 100755 --- a/docs/manual-CN/functions-and-operators/logical-operators.md +++ b/docs/manual-CN/functions-and-operators/logical-operators.md @@ -7,7 +7,7 @@ | \|\| | 逻辑或 OR | -在 nGQL 中, 非 0 数字将被视为 _true_. 逻辑运算符的优先级参见 [Operator Precedence](./Operator_Precedence.md)。 +在 nGQL 中, 非 0 数字将被视为 _true_. 逻辑运算符的优先级参见 [Operator Precedence](./operator-precedence.md)。 * && diff --git a/docs/manual-CN/functions-and-operators/operator-precedence.md b/docs/manual-CN/functions-and-operators/operator-precedence.md index ae0de1f7d55..4aa762b7ca1 100755 --- a/docs/manual-CN/functions-and-operators/operator-precedence.md +++ b/docs/manual-CN/functions-and-operators/operator-precedence.md @@ -3,13 +3,13 @@ 下面的列表展示了 nGQL 运算符的优先级(降序)。同一行的运算符拥有一致的优先级。 ``` ! -- (unary minus) +- (减法) *, /, % -, + == , >=, >, <=, <, <>, != && || -= (assignment) += (赋值) ``` 在一个表达式中,同等优先级的运算符将按照从左到右的顺序执行,唯一例外是赋值按照从右往左的顺序执行。但是,可以使用括号来修改执行顺序。 diff --git a/docs/manual-CN/get-started.md b/docs/manual-CN/get-started.md index c00b547ef51..933b4d057a3 100644 --- a/docs/manual-CN/get-started.md +++ b/docs/manual-CN/get-started.md @@ -12,12 +12,12 @@ Docker 安装方法请参考 [Docker 官方文档](https://docs.docker.com/)。 > docker pull vesoft/nebula-graph:latest ``` -国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置国内地址。例如: +国内从 Docker Hub 拉取镜像时可能会遇到下载过慢问题,此时可以通过配置国内地址解决。例如: * Azure 中国镜像 https://dockerhub.azk8s.cn * 七牛云 https://reg-mirror.qiniu.com -Linux 用户请在 `/etc/docker/daemon.json` 中加入如下内容(如果文件不存在请新建该文件) +Linux 用户请在 `/etc/docker/daemon.json` 中加入如下内容(若文件不存在,请新建该文件) ``` { @@ -28,7 +28,7 @@ Linux 用户请在 `/etc/docker/daemon.json` 中加入如下内容(如果文 } ``` -macOS 用户请点击任务栏中Docker Desktop图标 -> Preferences -> Daemon -> Registry mirrors。 在列表中添加 https://dockerhub.azk8s.cn 和 https://reg-mirror.qiniu.com 。修改完成后,点击 `Apply & Restart` 按钮, 重启Docker。 +macOS 用户请点击任务栏中 `Docker Desktop图标 -> Preferences -> Daemon -> Registry mirrors`。 在列表中添加 https://dockerhub.azk8s.cn 和 https://reg-mirror.qiniu.com 。修改后,点击 `Apply & Restart` 按钮, 重启Docker。 镜像下载完成后,键入命令`docker images`查看下载完成的镜像。 @@ -62,7 +62,7 @@ For macOS users, click the Docker Desktop icon -> Preferences -> Daemon -> Regis > docker run -it vesoft/nebula-graph:latest /bin/bash ``` -进入容器后,默认在根目录下 `/` ,切换到 `neula` 主目录: +进入容器后,默认在根目录下 `/` ,切换到 `Nebula` 主目录: ``` > cd /usr/local/nebula/ @@ -100,7 +100,7 @@ to connect to the graph server. --> > bin/nebula -u=user -p=password ``` -如果对部署过程有任何问题,欢迎在 [GitHub](https://github.com/vesoft-inc/nebula/issues) 上提 issue。 +在部署过程遇到的任何问题,欢迎你前往 [GitHub](https://github.com/vesoft-inc/nebula/issues) 向我们提 issue。 ### 编译源码方式 (Linux) @@ -123,13 +123,13 @@ nebula 遵循 c++14 标准,依赖第三方库: - readline - flex -建议安装 g++ 5 以上 Linux 系统, 比如 Fedora 29。目前,nebula 使用 `git-lfs` 存储第三方库,请确保获取源代码之前您已安装 `git-lfs` 。 +建议安装 g++ 5 以上 Linux 系统, 比如 Fedora 29。目前,nebula 使用 `git-lfs` 存储第三方库,请确保获取源代码之前已安装 `git-lfs` 。 **编译** 请参见 [how-to-build.md](./how-to-build.md) -#### 运行 nebula(单机) +#### 运行 Nebula) * 配置 nebula-metad.conf @@ -141,10 +141,10 @@ nebula 遵循 c++14 标准,依赖第三方库: 根据实际修改 nebula-metad.conf 中的配置: - - local_ip ip地址 - - port 端口号 - - ws_http_port metaservice HTTP HTTP服务端口号 - - ws_h2_port metaservice HTTP2服务端口号 + - local_ip: ip地址 + - port: 端口号 + - ws_http_port: metaservice HTTP服务端口号 + - ws_h2_port: metaservice HTTP2服务端口号 * 配置 nebula-storaged.conf @@ -154,10 +154,10 @@ nebula 遵循 c++14 标准,依赖第三方库: 根据实际修改 nebula-storaged.conf 中的配置: - - local_ip ip地址 - - port 端口号 - - ws_http_port storageservice HTTP服务端口号 - - ws_h2_port storageservice HTTP2服务端口号 + - local_ip: ip地址 + - port: 端口号 + - ws_http_port: storageservice HTTP 服务端口号 + - ws_h2_port: storageservice HTTP2 服务端口号 * 配置 nebula-graphd.conf @@ -165,10 +165,10 @@ nebula 遵循 c++14 标准,依赖第三方库: > cp etc/nebula-graphd.conf.default etc/nebula-graphd.conf ``` 根据实际修改 nebula-graphd.conf 中的配置: - - local_ip ip地址 - - port 端口号 - - ws_http_port graphservice HTTP服务端口号 - - ws_h2_port graphservice HTTP2服务端口号 + - local_ip: ip 地址 + - port: 端口号 + - ws_http_port: graphservice HTTP 服务端口号 + - ws_h2_port: graphservice HTTP2 服务端口号 **启动服务** @@ -207,7 +207,7 @@ nebula 遵循 c++14 标准,依赖第三方库: ![Untitled Diagram (1)](https://user-images.githubusercontent.com/51590253/60649144-0774c980-9e74-11e9-86d6-bad1653e70ba.png) -示例数据有三种类型的标签(_course_, _building_,_student_),两种类型的边(_select_ 和 _like_),其schema为: +示例数据有三种类型的标签(_course_, _building_,_student_),两种类型的边(_select_ 和 _like_),其 Schema 为: ```json { @@ -239,15 +239,15 @@ nebula 遵循 c++14 标准,依赖第三方库: ### 创建图空间 -nebula中的图存储于 **SPACE** 中,每个space是一个物理隔离的空间。首先,需要创建一个space,然后指定使用该space以完成之后的操作。 +Nebula 中的图存储于 **SPACE** 中,每个 Space 是一个物理隔离的空间。首先,需要创建一个 Space ,并使用该 Space 以完成之后的操作。 -列出已有的 space: +列出已有的 Space: ``` nebula> SHOW SPACES; ``` -创建一个名为 myspace_test2 的新 space: +创建一个名为 myspace_test2 的新 Space: ``` nebula> CREATE SPACE myspace_test2(partition_num=1, replica_factor=1); @@ -256,9 +256,9 @@ nebula> CREATE SPACE myspace_test2(partition_num=1, replica_factor=1); nebula> USE myspace_test2; ``` -* `replica_factor` 用来指定集群副本数。 +- `replica_factor` 用来指定集群副本数。 -* `partition_num` 用来指定一个副本中的分区数量。 +- `partition_num` 用来指定一个副本中的分区数量。 ### 定义图数据 Schema @@ -270,7 +270,7 @@ nebula> CREATE TAG building(name string); nebula> CREATE TAG student(name string, age int, gender string); ``` -使用`CREATE EDGE`语句定义边类型: +使用 `CREATE EDGE` 语句定义边类型: ``` nebula> CREATE EDGE like(likeness double); @@ -322,7 +322,7 @@ nebula> INSERT EDGE like(likeness) VALUES 201 -> 202:(93.2); ### 查询示例 -Q1. 查询点201喜欢的点: +Q1. 查询点 201 喜欢的点: ``` nebula> GO FROM 201 OVER like; @@ -336,7 +336,7 @@ nebula> GO FROM 201 OVER like; ------- ``` -Q2. 查询点201喜欢的点,并筛选出年龄大于 17 岁的点,并返回其姓名,年龄,性别,将其重全名为 Friend,Age,Gender。 +Q2. 查询点 201 喜欢的点,并筛选出年龄大于 17 岁的点,并返回其姓名,年龄,性别,将其重全名为 Friend,Age,Gender。 ``` nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name AS Friend, $$.student.age AS Age, $$.student.gender AS Gender; @@ -347,12 +347,12 @@ nebula> GO FROM 201 OVER like WHERE $$.student.age >= 17 YIELD $$.student.name A | Jane | 17 | female | ------------------------- ``` +说明: +- `YIELD` 用来指定返回信息。 -`YIELD` 用来指定返回信息。 +- `$^` 为起始点。 -`$^` 为起始点。 - -`$$` 为目标点。 +- `$$` 为目标点。 Q3. 查询点201喜欢的点选择了哪些课程和其对应年级。 @@ -384,9 +384,10 @@ nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.nam ----------------------------- ``` -`|` 表示管道操作,前一个子查询的结果传递给后一个子查询。 +说明: +- `|` 表示管道操作,前一个子查询的结果传递给后一个子查询。 -`$-` 表示输入流。 +- `$-` 表示输入流。 第二种方法使用了用户定义变量 `$a`,此变量可以在整个复合语句内使用。 @@ -394,7 +395,7 @@ nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.nam ## 常见问题 -> graphd 的配置没有注册到 meta server +### graphd 的配置没有注册到 meta server 用 `nebula.service` 脚本启动服务时,`graphd`、 `metad` 和 `storaged` 进程启动速度太快,可能会导致graphd 的配置没有注册到 meta server。restart 的时候也有此问题。 beta版本用户可以先启动 metad,再启动 storaged 和 graphd 来避免此问题。我们将在下一个版本解决此问题。 @@ -419,17 +420,17 @@ nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.nam [INFO] Done ``` -> 当创建 tag 或者 edge 类型后,插入数据时报错 +### 当创建 tag 或者 edge 类型后,插入数据时报错 可能原因, `load_data_interval_secs` 设置了从 meta server 获取元数据时间间隔,默认的是120s,建议用户改为1s。更改方式: -* 启动前在nebula-metad.conf 和 nebula-graphd.conf 中加入 +- 启动前在nebula-metad.conf 和 nebula-graphd.conf 中加入 ``` --load_data_interval_secs=1 ``` -* console启动后,运行: +- console启动后,运行: ``` nebula> UPDATE VARIABLES graph:load_data_interval_secs=1 diff --git a/docs/manual-CN/how-to-build.md b/docs/manual-CN/how-to-build.md index 86b0e5501a6..6263a52d484 100644 --- a/docs/manual-CN/how-to-build.md +++ b/docs/manual-CN/how-to-build.md @@ -1,6 +1,3 @@ ---- -This tutorial provides an introduction to build `Nebula` code. ---- ### 编译器 @@ -287,7 +284,7 @@ bash> sudo make install [root@centos7.5 nebula]# ls /usr/local/nebula/ bin etc scripts share ``` - **现在可以开始运行 Nebula** [get_start](https://github.com/vesoft-inc/nebula/blob/master/docs/get-started.md) + **现在可以开始运行 Nebula** 。 diff --git a/docs/manual-CN/how-to-contribute.md b/docs/manual-CN/how-to-contribute.md index e9d3338b073..1cbf842071a 100644 --- a/docs/manual-CN/how-to-contribute.md +++ b/docs/manual-CN/how-to-contribute.md @@ -93,7 +93,7 @@ git push --force origin master #### 编辑代码 -此时可在 `myfeature` 分支编辑代码, 编辑时请遵循[编码风格指南](/cpp-coding-style/)。 +此时可在 `myfeature` 分支编辑代码, 编辑时请遵循 [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)。 #### 运行独立模式 diff --git a/docs/manual-CN/language-structure/identifier-case-sensitivity.md b/docs/manual-CN/language-structure/identifier-case-sensitivity.md index 7dae44b8b0e..d4be8774cbb 100644 --- a/docs/manual-CN/language-structure/identifier-case-sensitivity.md +++ b/docs/manual-CN/language-structure/identifier-case-sensitivity.md @@ -1,5 +1,4 @@ -In Nebula Graph, Identifiers are case-sensitive. -Nebula Graph标识符为大小写敏感,因此下方示例语句无效,“my_space”和“MY_SPACE”为两个不同的space。 +Nebula Graph 标识符为大小写敏感,因此下方示例语句无效,`my_space` 和`MY_SPACE` 为两个不同的space。 ``` nebula> CREATE SPACE my_space; diff --git a/docs/manual-CN/language-structure/literal-values/string-literals.md b/docs/manual-CN/language-structure/literal-values/string-literals.md index 6fb5e7e3807..30b144f0055 100644 --- a/docs/manual-CN/language-structure/literal-values/string-literals.md +++ b/docs/manual-CN/language-structure/literal-values/string-literals.md @@ -8,6 +8,7 @@ nebula> YIELD "another string" ``` 一些转义字符 (\\) 已被支持,如下表所示: + | **转移字符** | **对应的字符** | |:----|:----| | \' | 单引号 (') | @@ -15,7 +16,7 @@ nebula> YIELD "another string" | \t | 制表符 | | \n | 换行符 | | \b | 退格符 | -| \\\ | 反斜杠 (\\) | +| \\ | 反斜杠 (\\) | 示例: @@ -32,7 +33,5 @@ nebula> YIELD 'disappearing\ backslash'   -------------------- |   disappearing backslash |  -------------------- - - ``` diff --git a/docs/manual-CN/language-structure/property-reference.md b/docs/manual-CN/language-structure/property-reference.md index 4f38d74c277..b7c71cadf87 100644 --- a/docs/manual-CN/language-structure/property-reference.md +++ b/docs/manual-CN/language-structure/property-reference.md @@ -1,6 +1,7 @@ # 属性引用 -`WHERE`和`YIELD`可引用节点或边的属性。 +`WHERE` 和 `YIELD` 可引用节点或边的属性。 + ## 引用点属性 ### 引用起点属性 @@ -59,5 +60,4 @@ GO FROM 1 OVER e1 YIELD e1.prop1 GO FROM 1 OVER e1 YIELD e1._src as startVID /* which is, 1 */, e1._dst as endVID ``` -该语句通过引用`e1._src`作为起始顶点id(当然,这是`1`)和`e1._dst`作为结束顶点,返回`1`在边缘类型`e1`上的所有邻域。 ID。 -上述语句返回点`1`沿边`e1`的所有近邻,其中`e1._src`返回起点ID,此处为1,`e1._dst`返回终点ID。 +该语句通过引用 `e1._src` 作为起始顶点id(当然,这是 `1` )和` e1._dst` 作为结束顶点,返回 `1` 边类型为 `e1` 的所有邻居节点。其中 `e1._src` 返回起点ID,此处为1,`e1._dst` 返回终点ID。 diff --git a/docs/manual-CN/language-structure/schema-object-names.md b/docs/manual-CN/language-structure/schema-object-names.md index ca02aec1adb..28346aac2be 100644 --- a/docs/manual-CN/language-structure/schema-object-names.md +++ b/docs/manual-CN/language-structure/schema-object-names.md @@ -1,7 +1,6 @@ -Certain objects within Nebula graph, including space, tag, edge, alias, customer variables and other object names are referred as identifiers. This section describes the rules for identifiers in Nebula Graph: -Nebula Graph将以下对象名称作为标识符,包括图空间,标签,边,别名,自定义变量等。本节介绍Nebula Graph标识符规则: -* 标识符中允许的字符: +Nebula Graph 将对象名称作为标识符,包括图空间,标签,边,别名,自定义变量等。本节介绍 Nebula Graph 标识符规则: +* 标识符中允许的字符: ASCII: [_0-9,a-z,A-Z,_] (基本拉丁字母,数字0-9,下划线),不支持其他标点字符。 * 所有标识符必须以字母表中的字母开头。 * 标识符区分大小写。 diff --git a/docs/manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md index e69de29bb2d..a385372a03b 100644 --- a/docs/manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md +++ b/docs/manual-CN/statement-syntax/data-definition-statements/create-space-syntax.md @@ -0,0 +1,40 @@ +# CREATE SPACE 语法 + +``` +CREATE SPACE space_name + (space_option,...) + +space_option: + option_name = value +``` + +以上语句作用是创建一个新的图空间。不同的图空间是物理隔离的。 + +### Space Name 图空间名 + +* **space_name** + + 图空间的名称在集群中标明了一个唯一的空间。命名规则详见 [Schema Object Names](../../language-structure/schema-object-names.md) + +### Space Options 图空间选项 + +在创建图空间的时候,可以传入自定义选项。选项名称 _option_name_ 可以是以下任何一个: +* _partition_num_ + + _partition_num_ 表示数据分片数量。默认值为 1024。 + +* _replica_factor_ + + _replica_factor_ 表示副本数量。默认值是 1, 集群建议为 3 + +如果没有自定义选项,Nebula 会使用默认的值(partition_number 和 replica_factor)来创建图空间。 + +### 示例 + +``` +CREATE SPACE my_space_1; -- 使用默认选项创建图空间 +CREATE SPACE my_space_2(partition_num=100); -- 使用默认 replica_factor 创建图空间 +CREATE SPACE my_space_3(replica_factor=1); -- 使用默认 partition_number 创建图空间 +CREATE SPACE my_space_4(partition_num=100, replica_factor=1); +``` + diff --git a/docs/manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md index e69de29bb2d..c562872eaa3 100644 --- a/docs/manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md +++ b/docs/manual-CN/statement-syntax/data-definition-statements/create-tag-edge-syntax.md @@ -0,0 +1,87 @@ +# CREATE TAG / EDGE 语法 + +``` +CREATE {TAG | EDGE} tag_name|edge_name + (create_definition, ...) + [tag_edge_options] + +create_definition: + prop_name data_type + +tag_edge_options: + option [, option ...] + +option: + TTL_DURATION [=] ttl_duration + | TTL_COL [=] prop_name +``` + +Nebula 的图结构由带有属性的 tags 和 edges 组成。`CREATE TAG` 使用一个给定的名称创建一个新的 tag。`CREATE EDGE` 则创建一个新的 edge type。 + +`CREATE TAG/EDGE` 语法有一些特点,在如下分块中将对这些特点进行讨论: + +* [Tag 和 Edge Type 名称](#tag-name-and-edgetype-name) + +* [属性名和数据类型](#property-name-and-data-type) + +### Tag 名称和 Edge Type 名称 + +* **tag_name 和 edge_name** + + tags 和 edgeTypes 的名称在图中必须 **唯一**,且名称被定义后无法被修改。Tag 和 edgeType 的命名规则和 space 的命名规则一致。参见 [Schema Object Name](../../language-structure/schema-object-names.md)。 + +### 属性名和数据类 + +* **prop_name** + + prop_name 表示每个属性的名称。在每个 tag 和 edgeType 中必须唯一。 + +* **data_type** + + data_type 表示每个属性的数据类。更多关于 Nebula 支持的数据类型信息请参见 data-type 区文档。 + + > NULL 和 NOT NULL 在创建 tag 和 edge 时不可用。(相比于关系型数据库). + +### Time-to-Live (TTL) 语法 + +* TTL_DURATION + + TTL_DURATION 指定了 vertices 和 edges 的有效期,超过有效期的数据会失效。失效时间为 TTL_COL 设置的属性值加 TTL_DURATION 设置的秒数。 + + > 如果 TTL_DURATION 的值为负或0,则该 edge 不会失效。 + +* TTL_COL + + 指定的列(或者属性)必须是 int64 或者 timestamp. + +* 多 TTL 定义 + + 可以指定多个 TTL_COL 字段, **Nebula Graph** 会使用最早的失效时间。 + +### 示例 + +``` +CREATE TAG course(name string, credits int) +CREATE TAG notag()  -- empty properties + +CREATE EDGE follow(start_time timestamp, likeness double) +CREATE EDGE noedge()  -- empty properties + +CREATE TAG woman(name string, age int, + married bool, salary double, create_time timestamp) + TTL_DURATION = 100, TTL_COL = create_time -- expired when now is later than create_time + 100 + +CREATE EDGE marriage(location string, since timestamp) + TTL_DURATION = 0, TTL_COL = since -- negative or zero, not expire + +CREATE TAG icecream(made timestamp, temperature int) + TTL_DURATION = 100, TTL_COL = made, + TTL_DURATION = 10, TTL_COL = temperature + -- no matter which comes first: made + 100 or temperature + 10 + +CREATE EDGE garbage (thrown timestamp, temperature int) + TTL_DURATION = -2, TTL_COL = thrown, + TTL_DURATION = 10, TTL_COL = thrown + -- legal, but not recommended. expired at thrown + 10 +``` + diff --git a/docs/manual-CN/statement-syntax/data-definition-statements/show-syntax.md b/docs/manual-CN/statement-syntax/data-definition-statements/show-syntax.md index e69de29bb2d..9a6116879f3 100644 --- a/docs/manual-CN/statement-syntax/data-definition-statements/show-syntax.md +++ b/docs/manual-CN/statement-syntax/data-definition-statements/show-syntax.md @@ -0,0 +1,31 @@ +# SHOW 语法 + +``` +SHOW {SPACES | TAGS | EDGES | HOSTS} +SHOW VARIABLES [graph|meta|storage] +``` + +`SHOW SPACES` 列出 Nebula Graph 集群中的所有图空间。 + +`SHOW TAGS` 和 `SHOW EDGES` 则返回当前图空间中被定义的 tag 和 edge type。 + +`SHOW HOSTS` 列出元服务器注册的所有存储主机。 + +更多关于 `SHOW VARIABLES [graph|meta|storage]` 的信息,请参见 [variable syntax](../data-administration-statements/configuration-statements/variables-syntax.md)。 + +### 示例 + +``` +nebula> SHOW SPACES; +======== +| Name | +======== +| test | +-------- + +nebula> USE test; + +nebula> SHOW TAGS; + +nebula> SHOW EDGES; +``` \ No newline at end of file diff --git a/docs/manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md b/docs/manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md index d8ed94e15b5..0bc96056555 100644 --- a/docs/manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md +++ b/docs/manual-CN/statement-syntax/data-manipulation-statements/fetch-syntax.md @@ -8,13 +8,13 @@ ``` FETCH PROP ON [YIELD [DISTINCT] ] +``` -为标签名称,与return_list中的标签相同。 +`` 为标签名称,与return_list中的标签相同。 -::=[vertex_id [, vertex_id]] is a list of vertex id separated by comma(,) +`::=[vertex_id [, vertex_id]]` is a list of vertex id separated by comma(,) -[YIELD [DISTINCT] ]为返回的属性列表,`YIELD`语法参看[此处](Yield_Syntax.md)。 -``` +`[YIELD [DISTINCT] ]` 为返回的属性列表,`YIELD` 语法参看 [YIELD Syntax](yield-syntax.md) 。 ### 示例 @@ -38,13 +38,13 @@ nebula> FETCH PROP ON player 1,2,3 YIELD DISTINCT player.name, player.age -- ``` FETCH PROP ON -> [, -> ...] [YIELD [DISTINCT] ] +``` -指定边的类型,需与相同。 +`` 指定边的类型,需与 `` 相同。 - -> 从起始节点到终止节点。多条边需使用逗号隔开。 +` -> ` 从起始节点到终止节点。多条边需使用逗号隔开。 -[YIELD [DISTINCT] ]为返回的属性列表。 -``` +`[YIELD [DISTINCT] ]` 为返回的属性列表。 ### 示例 diff --git a/docs/manual-EN/functions-and-operators/logical-operators.md b/docs/manual-EN/functions-and-operators/logical-operators.md index 6f6b3fd345c..7d92e2a6e6c 100644 --- a/docs/manual-EN/functions-and-operators/logical-operators.md +++ b/docs/manual-EN/functions-and-operators/logical-operators.md @@ -5,7 +5,7 @@ | \|\| | Logical OR | -In nGQL, nonzero numbers are evaluated to _true_. The precedence of the operators refer to [Operator Precedence](./Operator_Precedence.md). +In nGQL, nonzero numbers are evaluated to _true_. The precedence of the operators refer to [Operator Precedence](./operator-precedence.md). * && diff --git a/docs/manual-EN/functions-and-operators/set-operations.md b/docs/manual-EN/functions-and-operators/set-operations.md index 87161e244b3..1328cf7b81b 100644 --- a/docs/manual-EN/functions-and-operators/set-operations.md +++ b/docs/manual-EN/functions-and-operators/set-operations.md @@ -79,7 +79,7 @@ will return as follows: Notice that line 1 and line 2 return the same id (104) with different column values. The `DISTINCT` check duplication by all the columns for every line. So line 1 and line 2 are different. -You can expect for the `UNION ALL` result +You can expect the `UNION ALL` result ``` GO FROM 1 OVER e1 YIELD e1._dst AS id, e1.prop1 AS left.1, $$.tag.prop2 AS left.2 diff --git a/docs/manual-EN/language-structure/literal-values/string-literals.md b/docs/manual-EN/language-structure/literal-values/string-literals.md index 1786b661b6a..f881cc3e22e 100644 --- a/docs/manual-EN/language-structure/literal-values/string-literals.md +++ b/docs/manual-EN/language-structure/literal-values/string-literals.md @@ -6,6 +6,7 @@ nebula> YIELD "another string" ``` Certain backslash escapes (\\) have been supported (also known as the *escape character*). They are shown in the following table: + | **Escape Sequence** | **Character Represented by Sequence** | |:----|:----| | \' | A single quote (') character | @@ -13,7 +14,7 @@ Certain backslash escapes (\\) have been supported (also known as the *escape ch | \t | A tab character | | \n | A newline character | | \b | A backspace character | -| \\| | A backslash (\\) character | +| \\ | A backslash (\\) character | Here are some examples: diff --git a/docs/manual-EN/statement-syntax/data-definition-statements/create-space-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/create-space-syntax.md index 81025a0dd04..8a112fee878 100644 --- a/docs/manual-EN/statement-syntax/data-definition-statements/create-space-syntax.md +++ b/docs/manual-EN/statement-syntax/data-definition-statements/create-space-syntax.md @@ -14,7 +14,7 @@ This statement creates a new space. SPACE is a region that provides physically i * **space_name** - The name uniquely identifies the space in a cluster. The rules for the naming are given in [Schena_Object_Names.md](../../Language_Structure/Schema_Object_Names.md) + The name uniquely identifies the space in a cluster. The rules for the naming are given in [Schema Object Names](../../language-structure/schema-object-names.md) ### Space Options @@ -27,7 +27,7 @@ When creating a space, options can be given. An _option_name_ can be any of the _replica_factor_ specifies the number of replicas in the cluster. The default replica factor is 1. -However, if no option is given, Nebula Graph will create the space with default patition number and replica factor. +However, if no option is given, Nebula Graph will create the space with the default partition number and replica factor. ### Example diff --git a/docs/manual-EN/statement-syntax/data-definition-statements/drop-space-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/drop-space-syntax.md index 6d78ad069b5..8eb8577bfd1 100644 --- a/docs/manual-EN/statement-syntax/data-definition-statements/drop-space-syntax.md +++ b/docs/manual-EN/statement-syntax/data-definition-statements/drop-space-syntax.md @@ -8,6 +8,6 @@ DROP SPACE deletes everything (all the vertices, edges, indices, and properties) Other spaces remain unchanged. -This statement does not immediately remove all the files and directories in the storage engine (and release disk space). The deletion depends on the implement of different storage engine. +This statement does not immediately remove all the files and directories in the storage engine (and release disk space). The deletion depends on the implementation of different storage engines. >Be *very* careful with this statement. diff --git a/docs/manual-EN/statement-syntax/data-definition-statements/drop-tag-syntax.md b/docs/manual-EN/statement-syntax/data-definition-statements/drop-tag-syntax.md index 53ebb29f5a2..b1e3ef8a604 100644 --- a/docs/manual-EN/statement-syntax/data-definition-statements/drop-tag-syntax.md +++ b/docs/manual-EN/statement-syntax/data-definition-statements/drop-tag-syntax.md @@ -10,6 +10,6 @@ A vertex can have either only one tag (types) or multiple tags (types). In the former case, such a vertex can NOT be accessible after the statement -- which may result in DANGLING edges those are connecting with such vertex. -In the later case, such a vertex is still accessible. But all the properties defined by this dropped tag are not accessible. +In the latter case, such a vertex is still accessible. But all the properties defined by this dropped tag are not accessible. -All the files and directories in the disk are NOT deleted directly. They can only be released by furture operations (see TODO). +All the files and directories in the disk are NOT deleted directly. They can only be released by future operations (see TODO). diff --git a/docs/manual-EN/statement-syntax/data-manipulation-statements/fetch-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/fetch-syntax.md index a65cfdad187..5d83cd2a46f 100644 --- a/docs/manual-EN/statement-syntax/data-manipulation-statements/fetch-syntax.md +++ b/docs/manual-EN/statement-syntax/data-manipulation-statements/fetch-syntax.md @@ -8,13 +8,13 @@ Use `FETCH PROP ON` to return a (list of) vertex's properties. Currently, you ca ``` FETCH PROP ON [YIELD [DISTINCT] ] +``` - is the tag name. It should be the same tag within return_list +`` is the tag name. It should be the same tag within return_list -::=[vertex_id [, vertex_id]] is a list of vertex id separated by comma(,) +`::=[vertex_id [, vertex_id]]` is a list of vertex id separated by comma(,) -[YIELD [DISTINCT] ] is the property list returned. Please refer here [(Yield_Syntax.md)] for `YIELD` syntax -``` +`[YIELD [DISTINCT] ]` is the property list returned. Please refer here [YIELD Syntax](yield-syntax.md). ### Examples @@ -25,7 +25,7 @@ nebula> FETCH PROP ON player 1 YIELD player.name, player.age -- return proper nebula> FETCH PROP ON player hash(\"nebula\") YIELD player.name, player.age -- hash string to int64 as vertex id, fetch name and player -nebula> GO FROM 1 over e1 | FETCH PROP ON player $- YIELD player.name, player.age -- find the all neighbors of vertex 1 through edge e1. Then Get the neighbors' name and age. +nebula> GO FROM 1 over e1 | FETCH PROP ON player $- YIELD player.name, player.age -- find all neighbors of vertex 1 through edge e1. Then Get the neighbors' name and age. nebula> $var = GO FROM 1 over e1; FETCH PROP ON player $var.id YIELD player.name, player.age -- the same as above sentence. @@ -34,18 +34,19 @@ nebula> FETCH PROP ON player 1,2,3 YIELD DISTINCT player.name, player.age -- ## Fetch Edge Property -The `FETCH` usage of edge is almost the same as for vertex. +The `FETCH` usage of an edge is almost the same as for vertex. You can get properties from multiple edges with the same type. ``` FETCH PROP ON -> [, -> ...] [YIELD [DISTINCT] ] +``` - specifies the edge's type. It must be the same as those in +`` specifies the edge's type. It must be the same as those in `` - -> denotes a starting vertex to (->) an ending vertex. Multiple edges are separated by comma(,). +` -> ` denotes a starting vertex to (->) an ending vertex. Multiple edges are separated by comma(,). + +`[YIELD [DISTINCT] ]` is the property list returned. -[YIELD [DISTINCT] ] is the property list returned. -``` ### Example diff --git a/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md index 68a3d67cfab..163089a2a56 100644 --- a/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md +++ b/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-edge-syntax.md @@ -37,7 +37,7 @@ INSERT EDGE e2 (name, age) VALUES 11->13:("n1", "a13") -- WRONG. "a13" is n An edge can be inserted/wrote multiple times. Only the last write values can be read. ``` --- insert edge with new version of values.  +-- insert edge with the new version of values.  INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 12) INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 13) INSERT EDGE e2 (name, age) VALUES 11->13:("n1", 14) -- the last version can be read diff --git a/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md index f2a1708ec8f..43edc1e5a07 100644 --- a/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md +++ b/docs/manual-EN/statement-syntax/data-manipulation-statements/insert-vertex-syntax.md @@ -38,7 +38,7 @@ INSERT VERTEX t1 (i1), t2(s2) VALUES 21: (321, "hello") -- insert vertex 21 w A vertex can be inserted/wrote multiple times. Only the last write values can be read. ``` --- insert vertex 11 with new version of values. +-- insert vertex 11 with the new version of values. INSERT VERTEX t2 (name, age) VALUES 11:("n2", 13) INSERT VERTEX t2 (name, age) VALUES 11:("n3", 14) INSERT VERTEX t2 (name, age) VALUES 11:("n4", 15)  -- the last version can be read diff --git a/docs/manual-EN/statement-syntax/data-manipulation-statements/pipe-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/pipe-syntax.md index 282529b089b..11bb5e9b413 100644 --- a/docs/manual-EN/statement-syntax/data-manipulation-statements/pipe-syntax.md +++ b/docs/manual-EN/statement-syntax/data-manipulation-statements/pipe-syntax.md @@ -3,7 +3,7 @@ One major difference between nGQL and SQL is how subqueries are composed. In SQL, sub-queries are nested (embedded) to form a statement. -MeanWhile, nGQL uses shell style `PIPE (|)`. +Meanwhile, nGQL uses shell style `PIPE (|)`. ### Examples diff --git a/docs/manual-EN/statement-syntax/data-manipulation-statements/where-syntax.md b/docs/manual-EN/statement-syntax/data-manipulation-statements/where-syntax.md index a13fdf5f9bd..da656de0cd9 100644 --- a/docs/manual-EN/statement-syntax/data-manipulation-statements/where-syntax.md +++ b/docs/manual-EN/statement-syntax/data-manipulation-statements/where-syntax.md @@ -1,10 +1,10 @@ -Currently, `WHERE` statement only applies with the `GO` statement. +Currently, the `WHERE` statement only applies to the `GO` statement. ``` WHERE (expression [ AND | OR expression ...]) ``` -Usually, the expression is comparison between vertex or edge properties. +Usually, the expression is for vertex or edge properties. >As syntax sugar, you can freely choose to use both `AND` and `&&`. They are both boolean logical and. So do `OR` and `||`. From 868064a233c3c65969649d37f4703c6e434b5bff Mon Sep 17 00:00:00 2001 From: jude-zhu <51590253+jude-zhu@users.noreply.github.com> Date: Tue, 20 Aug 2019 18:51:00 +0800 Subject: [PATCH 15/18] comment ngql tutorial (#811) --- README-CN.md | 14 ++++++++++---- docs/manual-CN/get-started.md | 4 ++-- docs/manual-CN/nGQL-tutorial.md | 4 ++-- docs/nGQL-tutorial.md | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README-CN.md b/README-CN.md index c621b0f1fb5..de76c2a636b 100644 --- a/README-CN.md +++ b/README-CN.md @@ -5,7 +5,7 @@

- WeiXin + WeiXin Zhihu SegmentFault Sina Weibo @@ -24,7 +24,7 @@ ## 获取 `Nebula` ## 除编译源代码外,也可使用 [Nebula Graph 镜像](https://hub.docker.com/r/vesoft/nebula-graph/tags) 进行试用。 -更多详情参见 [Get Started](docs/manual-CN/get-started.md). +更多详情参见 [Get Started](docs/manual-CN/get-started.md). 您也可以在这里访问 [详细文档](https://docs.nebula-graph.io/manual-CN/data-types/numeric-types/) ## 参与 `Nebula` ## @@ -42,6 +42,12 @@ 为防止云供应商从项目赢利而不回馈,Nebula 在项目中添加了 [Commons Clause 1.0](https://commonsclause.com/) 条款。如上所述,Nebula 是一个完全开源的项目,欢迎您就许可模式提出建议,帮助 Nebula 社区更好地发展。 ## 联系方式 + - 使用 [GitHub issue tracker](https://github.com/vesoft-inc/nebula/issues) 提交 issue 或功能需求。 -- 加入 [![](https://img.shields.io/badge/slack-nebula-519dd9.svg)](https://nebulagraph.slack.com/archives/DJQC9P0H5/p1557815158000200)。 -- 访问官网 [Home Page](http://nebula-graph.io/)。 \ No newline at end of file + +- 访问官网 [Home Page](http://nebula-graph.io/)。 + +- [![WeiXin](https://img.shields.io/badge/WeChat-%E5%BE%AE%E4%BF%A1-brightgreen)](https://cdn.nlark.com/yuque/0/2019/png/208152/1566289806040-08cc1c7b-7762-476b-a397-f1bbe46da5bc.png) +[![Zhihu](https://img.shields.io/badge/Zhihu-%E7%9F%A5%E4%B9%8E-blue)](https://www.zhihu.com/org/nebulagraph/activities) +[![SegmentFault](https://img.shields.io/badge/SegmentFault-%E6%80%9D%E5%90%A6-green)](https://segmentfault.com/t/nebula) +[![Sina Weibo](https://img.shields.io/badge/Weibo-%E5%BE%AE%E5%8D%9A-red)](https://weibo.com/p/1006067122684542/home?from=page_100606&mod=TAB#place) diff --git a/docs/manual-CN/get-started.md b/docs/manual-CN/get-started.md index 933b4d057a3..890b4813f15 100644 --- a/docs/manual-CN/get-started.md +++ b/docs/manual-CN/get-started.md @@ -129,7 +129,7 @@ nebula 遵循 c++14 标准,依赖第三方库: 请参见 [how-to-build.md](./how-to-build.md) -#### 运行 Nebula) +#### 运行 Nebula * 配置 nebula-metad.conf @@ -422,7 +422,7 @@ nebula> $a=GO FROM 201 OVER like; GO FROM $a.id OVER select YIELD $^.student.nam ### 当创建 tag 或者 edge 类型后,插入数据时报错 -可能原因, `load_data_interval_secs` 设置了从 meta server 获取元数据时间间隔,默认的是120s,建议用户改为1s。更改方式: +可能原因, `load_data_interval_secs` 设置了从 meta server 获取元数据时间间隔,生产场景 (默认值) 是120s,s试用时可改为1s。更改方式: - 启动前在nebula-metad.conf 和 nebula-graphd.conf 中加入 diff --git a/docs/manual-CN/nGQL-tutorial.md b/docs/manual-CN/nGQL-tutorial.md index a90e7607ed9..aa761643601 100644 --- a/docs/manual-CN/nGQL-tutorial.md +++ b/docs/manual-CN/nGQL-tutorial.md @@ -1,4 +1,4 @@ -# 查询语言nGQL + + |Property names | Lower camel case, beginning with a lower-case character | inService | --> --> diff --git a/docs/nGQL-tutorial.md b/docs/nGQL-tutorial.md index 5394891ee07..7a374e30259 100644 --- a/docs/nGQL-tutorial.md +++ b/docs/nGQL-tutorial.md @@ -1,4 +1,4 @@ -# nGQL Query Language + + |Property names | Lower camel case, beginning with a lower-case character | inService | --> --> From 3b18530a1c5d78230fac012aa19dea7878e70e4b Mon Sep 17 00:00:00 2001 From: dutor <440396+dutor@users.noreply.github.com> Date: Wed, 21 Aug 2019 10:22:10 +0800 Subject: [PATCH 16/18] Do self-checking in ProcessUtils::isPidAvailable (#806) * Do self-checking in ProcessUtils::isPidAvailable * Fixed UT --- src/common/process/ProcessUtils.cpp | 26 ++++++++++++++----------- src/common/process/ProcessUtils.h | 12 ++++++------ src/common/process/test/ProcessTest.cpp | 4 ++-- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/common/process/ProcessUtils.cpp b/src/common/process/ProcessUtils.cpp index 32fa535c279..1f0830bdef5 100644 --- a/src/common/process/ProcessUtils.cpp +++ b/src/common/process/ProcessUtils.cpp @@ -12,13 +12,17 @@ namespace nebula { -Status ProcessUtils::isPidAvailable(uint32_t pid) { +Status ProcessUtils::isPidAvailable(pid_t pid) { + if (pid == ::getpid()) { + return Status::OK(); + } + constexpr auto SIG_OK = 0; if (::kill(pid, SIG_OK) == 0) { - return Status::Error("Process `%u' already existed", pid); + return Status::Error("Process `%d' already existed", pid); } if (errno == EPERM) { - return Status::Error("Process `%u' already existed but denied to access", pid); + return Status::Error("Process `%d' already existed but denied to access", pid); } if (errno != ESRCH) { return Status::Error("Uknown error: `%s'", ::strerror(errno)); @@ -48,7 +52,7 @@ Status ProcessUtils::isPidAvailable(const std::string &pidFile) { } -Status ProcessUtils::makePidFile(const std::string &pidFile, uint32_t pid) { +Status ProcessUtils::makePidFile(const std::string &pidFile, pid_t pid) { if (pidFile.empty()) { return Status::Error("Path to the pid file is empty"); } @@ -67,7 +71,7 @@ Status ProcessUtils::makePidFile(const std::string &pidFile, uint32_t pid) { pid = ::getpid(); } - ::fprintf(file, "%u\n", pid); + ::fprintf(file, "%d\n", pid); ::fflush(file); ::fclose(file); @@ -95,17 +99,17 @@ Status ProcessUtils::daemonize(const std::string &pidFile) { } -StatusOr ProcessUtils::getExePath(uint32_t pid) { +StatusOr ProcessUtils::getExePath(pid_t pid) { if (pid == 0) { pid = ::getpid(); } char path[PATH_MAX]; - snprintf(path, sizeof(path), "/proc/%u/exe", pid); + snprintf(path, sizeof(path), "/proc/%d/exe", pid); return fs::FileUtils::readLink(path); } -StatusOr ProcessUtils::getExeCWD(uint32_t pid) { +StatusOr ProcessUtils::getExeCWD(pid_t pid) { if (pid == 0) { pid = ::getpid(); } @@ -115,12 +119,12 @@ StatusOr ProcessUtils::getExeCWD(uint32_t pid) { } -StatusOr ProcessUtils::getProcessName(uint32_t pid) { +StatusOr ProcessUtils::getProcessName(pid_t pid) { if (pid == 0) { pid = ::getpid(); } char path[PATH_MAX]; - snprintf(path, sizeof(path), "/proc/%u/comm", pid); + snprintf(path, sizeof(path), "/proc/%d/comm", pid); fs::FileUtils::FileLineIterator iter(path); if (!iter.valid()) { return iter.status(); @@ -129,7 +133,7 @@ StatusOr ProcessUtils::getProcessName(uint32_t pid) { } -uint32_t ProcessUtils::maxPid() { +pid_t ProcessUtils::maxPid() { static const std::regex pattern("([0-9]+)"); fs::FileUtils::FileLineIterator iter("/proc/sys/kernel/pid_max", &pattern); CHECK(iter.valid()); diff --git a/src/common/process/ProcessUtils.h b/src/common/process/ProcessUtils.h index 13c273599e5..c244f4a3ced 100644 --- a/src/common/process/ProcessUtils.h +++ b/src/common/process/ProcessUtils.h @@ -17,7 +17,7 @@ class ProcessUtils final { ProcessUtils() = delete; // Tell if there is no existing process who has the same pid as `pid'. - static Status isPidAvailable(uint32_t pid); + static Status isPidAvailable(pid_t pid); /** * Like isPidAvailable(uint32_t), but use a file which contains a pid as input. * Returns Status::OK if: @@ -29,7 +29,7 @@ class ProcessUtils final { /** * Write pid into file, create if not exist. */ - static Status makePidFile(const std::string &path, uint32_t pid = 0); + static Status makePidFile(const std::string &path, pid_t pid = 0); /** * Make current process a daemon and write the daemon's pid into pidFile */ @@ -38,21 +38,21 @@ class ProcessUtils final { * Get the absolute path to the target process's executable. * Use the current process if pid == 0. */ - static StatusOr getExePath(uint32_t pid = 0); + static StatusOr getExePath(pid_t pid = 0); /** * Get the absolute path to the current working directory of the target process. * Use the current process if pid == 0. */ - static StatusOr getExeCWD(uint32_t pid = 0); + static StatusOr getExeCWD(pid_t pid = 0); /** * Get the name of the target process. * Use the current process if pid == 0. */ - static StatusOr getProcessName(uint32_t pid = 0); + static StatusOr getProcessName(pid_t pid = 0); /** * Get the maximum pid of the system. */ - static uint32_t maxPid(); + static pid_t maxPid(); /** * Execute a shell command and return the standard output of the command */ diff --git a/src/common/process/test/ProcessTest.cpp b/src/common/process/test/ProcessTest.cpp index c0a67c1d51e..de792c5f4f0 100644 --- a/src/common/process/test/ProcessTest.cpp +++ b/src/common/process/test/ProcessTest.cpp @@ -32,7 +32,7 @@ TEST(ProcessUtils, getExeCWD) { TEST(ProcessUtils, isPidAvailable) { { auto status = ProcessUtils::isPidAvailable(::getpid()); - ASSERT_FALSE(status.ok()); + ASSERT_TRUE(status.ok()) << status; } { auto status = ProcessUtils::isPidAvailable(0); // idle/swap @@ -52,7 +52,7 @@ TEST(ProcessUtils, isPidAvailable) { auto status = ProcessUtils::makePidFile(pidFile); ASSERT_TRUE(status.ok()) << status; status = ProcessUtils::isPidAvailable(pidFile); - ASSERT_FALSE(status.ok()); + ASSERT_TRUE(status.ok()) << status; } { // pid file not exist From 40f55991df1d026d1bf4dfbe55b6287f30b03924 Mon Sep 17 00:00:00 2001 From: dutor <440396+dutor@users.noreply.github.com> Date: Wed, 21 Aug 2019 11:12:34 +0800 Subject: [PATCH 17/18] Fixed incorrect rate metric in StatsManager (#754) --- src/common/http/test/CMakeLists.txt | 1 + src/common/stats/StatsManager.cpp | 13 ++++++---- src/common/stats/StatsManager.h | 6 ++--- src/common/stats/StatsManager.inl | 4 +-- src/common/stats/test/CMakeLists.txt | 29 ++++++++++++++++------ src/common/stats/test/StatsManagerTest.cpp | 25 +++++++++++++++++++ src/webservice/test/CMakeLists.txt | 2 ++ 7 files changed, 62 insertions(+), 18 deletions(-) diff --git a/src/common/http/test/CMakeLists.txt b/src/common/http/test/CMakeLists.txt index 24e1b8dba85..d623bb83dd7 100644 --- a/src/common/http/test/CMakeLists.txt +++ b/src/common/http/test/CMakeLists.txt @@ -9,6 +9,7 @@ nebula_add_test( $ $ $ + $ $ LIBRARIES proxygenhttpserver diff --git a/src/common/stats/StatsManager.cpp b/src/common/stats/StatsManager.cpp index 5edead9898b..1564a46ff95 100644 --- a/src/common/stats/StatsManager.cpp +++ b/src/common/stats/StatsManager.cpp @@ -138,14 +138,14 @@ void StatsManager::addValue(int32_t index, VT value) { folly::RWSpinLock::ReadHolder rh(sm.statsLock_); DCHECK_LT(index, sm.stats_.size()); std::lock_guard g(*(sm.stats_[index].first)); - sm.stats_[index].second->addValue(Clock::now(), value); + sm.stats_[index].second->addValue(seconds(time::WallClock::fastNowInSec()), value); } else { // Histogram index = - (index + 1); folly::RWSpinLock::ReadHolder rh(sm.histogramsLock_); DCHECK_LT(index, sm.histograms_.size()); std::lock_guard g(*(sm.histograms_[index].first)); - sm.histograms_[index].second->addValue(Clock::now(), value); + sm.histograms_[index].second->addValue(seconds(time::WallClock::fastNowInSec()), value); } } @@ -262,8 +262,10 @@ void StatsManager::readAllValue(folly::dynamic& vals) { StatsManager::VT StatsManager::readStats(int32_t index, StatsManager::TimeRange range, StatsManager::StatsMethod method) { + using std::chrono::seconds; auto& sm = get(); + CHECK_NE(index, 0); if (index > 0) { @@ -271,14 +273,14 @@ StatsManager::VT StatsManager::readStats(int32_t index, --index; DCHECK_LT(index, sm.stats_.size()); std::lock_guard g(*(sm.stats_[index].first)); - sm.stats_[index].second->update(Clock::now()); + sm.stats_[index].second->update(seconds(time::WallClock::fastNowInSec())); return readValue(*(sm.stats_[index].second), range, method); } else { // histograms_ index = - (index + 1); DCHECK_LT(index, sm.histograms_.size()); std::lock_guard g(*(sm.histograms_[index].first)); - sm.histograms_[index].second->update(Clock::now()); + sm.histograms_[index].second->update(seconds(time::WallClock::fastNowInSec())); return readValue(*(sm.histograms_[index].second), range, method); } } @@ -312,6 +314,7 @@ StatsManager::VT StatsManager::readStats(const std::string& counterName, StatsManager::VT StatsManager::readHisto(const std::string& counterName, StatsManager::TimeRange range, double pct) { + using std::chrono::seconds; auto& sm = get(); // Look up the counter name @@ -332,7 +335,7 @@ StatsManager::VT StatsManager::readHisto(const std::string& counterName, DCHECK_LT(index, sm.histograms_.size()); std::lock_guard g(*(sm.histograms_[index].first)); - sm.histograms_[index].second->update(Clock::now()); + sm.histograms_[index].second->update(seconds(time::WallClock::fastNowInSec())); auto level = static_cast(range); return sm.histograms_[index].second->getPercentileEstimate(pct, level); } diff --git a/src/common/stats/StatsManager.h b/src/common/stats/StatsManager.h index ed7f8922b69..9f30993b009 100644 --- a/src/common/stats/StatsManager.h +++ b/src/common/stats/StatsManager.h @@ -8,6 +8,7 @@ #define COMMON_STATS_STATSMANAGER_H_ #include "base/Base.h" +#include "time/WallClock.h" #include #include #include @@ -39,9 +40,8 @@ namespace stats { */ class StatsManager final { using VT = int64_t; - using Clock = std::chrono::steady_clock; - using StatsType = folly::MultiLevelTimeSeries; - using HistogramType = folly::TimeseriesHistogram; + using StatsType = folly::MultiLevelTimeSeries; + using HistogramType = folly::TimeseriesHistogram; public: enum class StatsMethod { diff --git a/src/common/stats/StatsManager.inl b/src/common/stats/StatsManager.inl index b9415b781a3..0b7df8b215a 100644 --- a/src/common/stats/StatsManager.inl +++ b/src/common/stats/StatsManager.inl @@ -19,9 +19,9 @@ StatsManager::VT StatsManager::readValue(StatsHolder& stats, case StatsMethod::COUNT: return stats.count(level); case StatsMethod::AVG: - return stats.avg(level); + return stats.template avg(level); case StatsMethod::RATE: - return stats.rate(level); + return stats.template rate(level); } LOG(FATAL) << "Unknown statistic method"; diff --git a/src/common/stats/test/CMakeLists.txt b/src/common/stats/test/CMakeLists.txt index 0c4cefdeb04..a7af544883c 100644 --- a/src/common/stats/test/CMakeLists.txt +++ b/src/common/stats/test/CMakeLists.txt @@ -1,14 +1,27 @@ nebula_add_test( - NAME stats_manager_test - SOURCES StatsManagerTest.cpp - OBJECTS $ $ - LIBRARIES gtest + NAME + stats_manager_test + SOURCES + StatsManagerTest.cpp + OBJECTS + $ + $ + $ + $ + LIBRARIES + gtest ) nebula_add_executable( - NAME stats_manager_bm - SOURCES StatsManagerBenchmark.cpp - OBJECTS $ - LIBRARIES follybenchmark boost_regex + NAME + stats_manager_bm + SOURCES + StatsManagerBenchmark.cpp + OBJECTS + $ + $ + $ + LIBRARIES + follybenchmark boost_regex ) diff --git a/src/common/stats/test/StatsManagerTest.cpp b/src/common/stats/test/StatsManagerTest.cpp index fcc9d8e3b23..5ffaf24c182 100644 --- a/src/common/stats/test/StatsManagerTest.cpp +++ b/src/common/stats/test/StatsManagerTest.cpp @@ -7,6 +7,7 @@ #include "base/Base.h" #include #include "stats/StatsManager.h" +#include "thread/GenericWorker.h" namespace nebula { namespace stats { @@ -42,6 +43,30 @@ TEST(StatsManager, StatsTest) { } +TEST(StatsManager, RateTest) { + auto statId = StatsManager::registerStats("ratetest"); + auto thread = std::make_unique(); + ASSERT_TRUE(thread->start()); + + auto task = [=] () { + StatsManager::addValue(statId); + }; + constexpr auto qps = 100L; + thread->addRepeatTask(1 * 1000 / qps, task); + + ::usleep(60 * 1000 * 1000); + + auto actual = StatsManager::readValue("ratetest.rate.60"); + + ASSERT_LT(std::max(qps, actual) - std::min(qps, actual), 10L) << "expected: " << qps + << ", actual: " << actual; + + thread->stop(); + thread->wait(); + thread.reset(); +} + + TEST(StatsManager, HistogramTest) { auto statId = StatsManager::registerHisto("stat02", 1, 1, 100); std::vector threads; diff --git a/src/webservice/test/CMakeLists.txt b/src/webservice/test/CMakeLists.txt index 95b661b7d4f..cd3ec774a07 100644 --- a/src/webservice/test/CMakeLists.txt +++ b/src/webservice/test/CMakeLists.txt @@ -10,6 +10,7 @@ nebula_add_test( $ $ $ + $ LIBRARIES proxygenhttpserver proxygenlib @@ -30,6 +31,7 @@ nebula_add_test( $ $ $ + $ LIBRARIES proxygenhttpserver proxygenlib From 91971ca035dfcda52c678ae063040cfa650a65a3 Mon Sep 17 00:00:00 2001 From: dangleptr <37216992+dangleptr@users.noreply.github.com> Date: Wed, 21 Aug 2019 14:43:50 +0800 Subject: [PATCH 18/18] Extend CAS in Raft (#800) --- src/kvstore/KVStore.h | 6 ++ src/kvstore/NebulaStore.cpp | 13 +++ src/kvstore/NebulaStore.h | 5 ++ src/kvstore/Part.cpp | 13 ++- src/kvstore/Part.h | 4 +- src/kvstore/plugins/hbase/HBaseStore.h | 7 ++ src/kvstore/raftex/RaftPart.cpp | 96 +++++++++++----------- src/kvstore/raftex/RaftPart.h | 46 +++++------ src/kvstore/raftex/test/LogCASTest.cpp | 22 ++--- src/kvstore/raftex/test/LogCommandTest.cpp | 10 +-- src/kvstore/raftex/test/TestShard.cpp | 17 ++-- src/kvstore/raftex/test/TestShard.h | 3 +- 12 files changed, 139 insertions(+), 103 deletions(-) diff --git a/src/kvstore/KVStore.h b/src/kvstore/KVStore.h index 83be9e423e0..308f8626cb0 100644 --- a/src/kvstore/KVStore.h +++ b/src/kvstore/KVStore.h @@ -10,6 +10,7 @@ #include "base/Base.h" #include #include +#include "kvstore/raftex/RaftPart.h" #include "kvstore/Common.h" #include "kvstore/KVIterator.h" #include "kvstore/PartManager.h" @@ -136,6 +137,11 @@ class KVStore { const std::string& prefix, KVCallback cb) = 0; + virtual void asyncAtomicOp(GraphSpaceID spaceId, + PartitionID partId, + raftex::AtomicOp op, + KVCallback cb) = 0; + virtual ResultCode ingest(GraphSpaceID spaceId) = 0; virtual ErrorOr> part(GraphSpaceID spaceId, diff --git a/src/kvstore/NebulaStore.cpp b/src/kvstore/NebulaStore.cpp index ce014088df3..fca74882f82 100644 --- a/src/kvstore/NebulaStore.cpp +++ b/src/kvstore/NebulaStore.cpp @@ -378,6 +378,19 @@ void NebulaStore::asyncRemovePrefix(GraphSpaceID spaceId, part->asyncRemovePrefix(prefix, std::move(cb)); } +void NebulaStore::asyncAtomicOp(GraphSpaceID spaceId, + PartitionID partId, + raftex::AtomicOp op, + KVCallback cb) { + auto ret = part(spaceId, partId); + if (!ok(ret)) { + cb(error(ret)); + return; + } + auto part = nebula::value(ret); + part->asyncAtomicOp(std::move(op), std::move(cb)); +} + ErrorOr> NebulaStore::part(GraphSpaceID spaceId, PartitionID partId) { folly::RWSpinLock::ReadHolder rh(&lock_); diff --git a/src/kvstore/NebulaStore.h b/src/kvstore/NebulaStore.h index 5571a3a4608..478e7510067 100644 --- a/src/kvstore/NebulaStore.h +++ b/src/kvstore/NebulaStore.h @@ -139,6 +139,11 @@ class NebulaStore : public KVStore, public Handler { const std::string& prefix, KVCallback cb) override; + void asyncAtomicOp(GraphSpaceID spaceId, + PartitionID partId, + raftex::AtomicOp op, + KVCallback cb) override; + ErrorOr> part(GraphSpaceID spaceId, PartitionID partId) override; diff --git a/src/kvstore/Part.cpp b/src/kvstore/Part.cpp index f36ee5745c4..74eb2bb0d9d 100644 --- a/src/kvstore/Part.cpp +++ b/src/kvstore/Part.cpp @@ -136,6 +136,12 @@ void Part::asyncRemoveRange(folly::StringPiece start, }); } +void Part::asyncAtomicOp(raftex::AtomicOp op, KVCallback cb) { + atomicOpAsync(std::move(op)).then([callback = std::move(cb)] (AppendLogResult res) mutable { + callback(toResultCode(res)); + }); +} + void Part::asyncAddLearner(const HostAddr& learner, KVCallback cb) { std::string log = encodeLearner(learner); sendCommandAsync(std::move(log)) @@ -153,13 +159,6 @@ void Part::onElected(TermID term) { VLOG(1) << "Being elected as the leader for the term " << term; } - -std::string Part::compareAndSet(const std::string& log) { - UNUSED(log); - LOG(FATAL) << "To be implemented"; -} - - bool Part::commitLogs(std::unique_ptr iter) { auto batch = engine_->startBatchWrite(); LogID lastId = -1; diff --git a/src/kvstore/Part.h b/src/kvstore/Part.h index 87de9543947..a577ea2202f 100644 --- a/src/kvstore/Part.h +++ b/src/kvstore/Part.h @@ -46,6 +46,8 @@ class Part : public raftex::RaftPart { folly::StringPiece end, KVCallback cb); + void asyncAtomicOp(raftex::AtomicOp op, KVCallback cb); + void asyncAddLearner(const HostAddr& learner, KVCallback cb); /** * Methods inherited from RaftPart @@ -56,8 +58,6 @@ class Part : public raftex::RaftPart { void onElected(TermID term) override; - std::string compareAndSet(const std::string& log) override; - bool commitLogs(std::unique_ptr iter) override; bool preProcessLog(LogID logId, diff --git a/src/kvstore/plugins/hbase/HBaseStore.h b/src/kvstore/plugins/hbase/HBaseStore.h index 279df3d365d..c59cd345053 100644 --- a/src/kvstore/plugins/hbase/HBaseStore.h +++ b/src/kvstore/plugins/hbase/HBaseStore.h @@ -126,6 +126,13 @@ class HBaseStore : public KVStore { const std::string& prefix, KVCallback cb) override; + void asyncAtomicOp(GraphSpaceID, + PartitionID, + raftex::AtomicOp, + KVCallback) override { + LOG(FATAL) << "Not supportted yet!"; + } + ResultCode ingest(GraphSpaceID spaceId) override; ErrorOr> part(GraphSpaceID, diff --git a/src/kvstore/raftex/RaftPart.cpp b/src/kvstore/raftex/RaftPart.cpp index f3ee52fd524..bb234973b1b 100644 --- a/src/kvstore/raftex/RaftPart.cpp +++ b/src/kvstore/raftex/RaftPart.cpp @@ -46,15 +46,15 @@ class AppendLogsIterator final : public LogIterator { AppendLogsIterator(LogID firstLogId, TermID termId, RaftPart::LogCache logs, - std::function casCB) + folly::Function opCB) : firstLogId_(firstLogId) , termId_(termId) , logId_(firstLogId) , logs_(std::move(logs)) - , casCB_(std::move(casCB)) { - leadByCAS_ = processCAS(); + , opCB_(std::move(opCB)) { + leadByAtomicOp_ = processAtomicOp(); valid_ = idx_ < logs_.size(); - hasNonCASLogs_ = !leadByCAS_ && valid_; + hasNonAtomicOpLogs_ = !leadByAtomicOp_ && valid_; if (valid_) { currLogType_ = lastLogType_ = logType(); } @@ -66,36 +66,36 @@ class AppendLogsIterator final : public LogIterator { AppendLogsIterator& operator=(const AppendLogsIterator&) = delete; AppendLogsIterator& operator=(AppendLogsIterator&&) = default; - bool leadByCAS() const { - return leadByCAS_; + bool leadByAtomicOp() const { + return leadByAtomicOp_; } - bool hasNonCASLogs() const { - return hasNonCASLogs_; + bool hasNonAtomicOpLogs() const { + return hasNonAtomicOpLogs_; } LogID firstLogId() const { return firstLogId_; } - // Return true if the current log is a CAS, otherwise return false - bool processCAS() { + // Return true if the current log is a AtomicOp, otherwise return false + bool processAtomicOp() { while (idx_ < logs_.size()) { auto& tup = logs_.at(idx_); auto logType = std::get<1>(tup); - if (logType != LogType::CAS) { - // Not a CAS + if (logType != LogType::ATOMIC_OP) { + // Not a AtomicOp return false; } - // Process CAS log - CHECK(!!casCB_); - casResult_ = casCB_(std::get<2>(tup)); - if (casResult_.size() > 0) { - // CAS Succeeded + // Process AtomicOp log + CHECK(!!opCB_); + opResult_ = opCB_(std::move(std::get<3>(tup))); + if (opResult_.size() > 0) { + // AtomicOp Succeeded return true; } else { - // CAS failed, move to the next log, but do not increment the logId_ + // AtomicOp failed, move to the next log, but do not increment the logId_ ++idx_; } } @@ -109,9 +109,9 @@ class AppendLogsIterator final : public LogIterator { ++logId_; if (idx_ < logs_.size()) { currLogType_ = logType(); - valid_ = currLogType_ != LogType::CAS; + valid_ = currLogType_ != LogType::ATOMIC_OP; if (valid_) { - hasNonCASLogs_ = true; + hasNonAtomicOpLogs_ = true; } valid_ = valid_ && lastLogType_ != LogType::COMMAND; lastLogType_ = currLogType_; @@ -122,7 +122,7 @@ class AppendLogsIterator final : public LogIterator { } // The iterator becomes invalid when exhausting the logs - // **OR** running into a CAS log + // **OR** running into a AtomicOp log bool valid() const override { return valid_; } @@ -143,8 +143,8 @@ class AppendLogsIterator final : public LogIterator { folly::StringPiece logMsg() const override { DCHECK(valid()); - if (currLogType_ == LogType::CAS) { - return casResult_; + if (currLogType_ == LogType::ATOMIC_OP) { + return opResult_; } else { return std::get<2>(logs_.at(idx_)); } @@ -159,9 +159,9 @@ class AppendLogsIterator final : public LogIterator { void resume() { CHECK(!valid_); if (!empty()) { - leadByCAS_ = processCAS(); + leadByAtomicOp_ = processAtomicOp(); valid_ = idx_ < logs_.size(); - hasNonCASLogs_ = !leadByCAS_ && valid_; + hasNonAtomicOpLogs_ = !leadByAtomicOp_ && valid_; if (valid_) { currLogType_ = lastLogType_ = logType(); } @@ -174,17 +174,17 @@ class AppendLogsIterator final : public LogIterator { private: size_t idx_{0}; - bool leadByCAS_{false}; - bool hasNonCASLogs_{false}; + bool leadByAtomicOp_{false}; + bool hasNonAtomicOpLogs_{false}; bool valid_{true}; LogType lastLogType_{LogType::NORMAL}; LogType currLogType_{LogType::NORMAL}; - std::string casResult_; + std::string opResult_; LogID firstLogId_; TermID termId_; LogID logId_; RaftPart::LogCache logs_; - std::function casCB_; + folly::Function opCB_; }; @@ -379,8 +379,8 @@ folly::Future RaftPart::appendAsync(ClusterID source, } -folly::Future RaftPart::casAsync(std::string log) { - return appendLogAsync(clusterId_, LogType::CAS, std::move(log)); +folly::Future RaftPart::atomicOpAsync(AtomicOp op) { + return appendLogAsync(clusterId_, LogType::ATOMIC_OP, "", std::move(op)); } folly::Future RaftPart::sendCommandAsync(std::string log) { @@ -389,7 +389,8 @@ folly::Future RaftPart::sendCommandAsync(std::string log) { folly::Future RaftPart::appendLogAsync(ClusterID source, LogType logType, - std::string log) { + std::string log, + AtomicOp op) { LogCache swappedOutLogs; auto retFuture = folly::Future::makeEmpty(); @@ -419,9 +420,9 @@ folly::Future RaftPart::appendLogAsync(ClusterID source, // Append new logs to the buffer DCHECK_GE(source, 0); - logs_.emplace_back(source, logType, std::move(log)); + logs_.emplace_back(source, logType, std::move(log), std::move(op)); switch (logType) { - case LogType::CAS: + case LogType::ATOMIC_OP: retFuture = cachingPromise_.getSingleFuture(); break; case LogType::COMMAND: @@ -474,13 +475,14 @@ folly::Future RaftPart::appendLogAsync(ClusterID source, firstId, termId, std::move(swappedOutLogs), - [this] (const std::string& msg) -> std::string { - auto casRet = compareAndSet(msg); - if (casRet.empty()) { + [this] (AtomicOp opCB) -> std::string { + CHECK(opCB != nullptr); + auto opRet = opCB(); + if (opRet.empty()) { // Failed - sendingPromise_.setOneSingleValue(AppendLogResult::E_CAS_FAILURE); + sendingPromise_.setOneSingleValue(AppendLogResult::E_ATOMIC_OP_FAILURE); } - return casRet; + return opRet; }); appendLogsInternal(std::move(it), termId); @@ -498,7 +500,7 @@ void RaftPart::appendLogsInternal(AppendLogsIterator iter, TermID termId) { << iter.logId() << " (Current term is " << currTerm << ")"; } else { - LOG(ERROR) << idStr_ << "Only happend when CAS failed"; + LOG(ERROR) << idStr_ << "Only happend when Atomic op failed"; replicatingLogs_ = false; return; } @@ -715,10 +717,10 @@ void RaftPart::processAppendLogResponses( return; } // Step 4: Fulfill the promise - if (iter.hasNonCASLogs()) { + if (iter.hasNonAtomicOpLogs()) { sendingPromise_.setOneSharedValue(AppendLogResult::SUCCEEDED); } - if (iter.leadByCAS()) { + if (iter.leadByAtomicOp()) { sendingPromise_.setOneSingleValue(AppendLogResult::SUCCEEDED); } // Step 5: Check whether need to continue @@ -737,14 +739,14 @@ void RaftPart::processAppendLogResponses( firstLogId, currTerm, std::move(logs_), - [this] (const std::string& log) -> std::string { - auto casRet = compareAndSet(log); - if (casRet.empty()) { + [this] (AtomicOp op) -> std::string { + auto opRet = op(); + if (opRet.empty()) { // Failed sendingPromise_.setOneSingleValue( - AppendLogResult::E_CAS_FAILURE); + AppendLogResult::E_ATOMIC_OP_FAILURE); } - return casRet; + return opRet; }); logs_.clear(); bufferOverFlow_ = false; diff --git a/src/kvstore/raftex/RaftPart.h b/src/kvstore/raftex/RaftPart.h index 7fea92d3a0b..96f65dd1ffd 100644 --- a/src/kvstore/raftex/RaftPart.h +++ b/src/kvstore/raftex/RaftPart.h @@ -9,6 +9,7 @@ #include "base/Base.h" #include +#include #include "gen-cpp2/raftex_types.h" #include "time/Duration.h" #include "thread/GenericThreadPool.h" @@ -31,7 +32,7 @@ namespace raftex { enum class AppendLogResult { SUCCEEDED = 0, - E_CAS_FAILURE = -1, + E_ATOMIC_OP_FAILURE = -1, E_NOT_A_LEADER = -2, E_STOPPED = -3, E_NOT_READY = -4, @@ -42,13 +43,13 @@ enum class AppendLogResult { enum class LogType { NORMAL = 0x00, - CAS = 0x01, + ATOMIC_OP = 0x01, /** - COMMAND is similar to CAS, but not the same. There are two differences: - 1. Normal logs after CAS could be committed together. In opposite, Normal logs + COMMAND is similar to AtomicOp, but not the same. There are two differences: + 1. Normal logs after AtomicOp could be committed together. In opposite, Normal logs after COMMAND should be hold until the COMMAND committed, but the logs before COMMAND could be committed together. - 2. CAS maybe failed. So we use SinglePromise for it. But COMMAND not, so it could + 2. AtomicOp maybe failed. So we use SinglePromise for it. But COMMAND not, so it could share one promise with the normal logs before it. * */ COMMAND = 0x02, @@ -57,6 +58,13 @@ enum class LogType { class Host; class AppendLogsIterator; +/** + * The operation will be atomic, if the operation failed, empty string will be returned, + * otherwise it will return the new operation's encoded string whick should be applied atomically. + * You could implement CAS, READ-MODIFY-WRITE operations though it. + * */ +using AtomicOp = folly::Function; + class RaftPart : public std::enable_shared_from_this { friend class AppendLogsIterator; friend class Host; @@ -141,15 +149,17 @@ class RaftPart : public std::enable_shared_from_this { folly::Future appendAsync(ClusterID source, std::string log); /**************************************************************** - * Asynchronously compare and set + * Run the op atomically. ***************************************************************/ - folly::Future casAsync(std::string log); + folly::Future atomicOpAsync(AtomicOp op); /** * Asynchronously send one command. * */ folly::Future sendCommandAsync(std::string log); + + /***************************************************** * * Methods to process incoming raft requests @@ -197,18 +207,6 @@ class RaftPart : public std::enable_shared_from_this { // a new leader virtual void onElected(TermID term) = 0; - // This method is invoked when handling a CAS log. The inherited - // class uses this method to do the comparison and decide whether - // a log should be inserted - // - // The method will be guaranteed to execute in a single-threaded - // manner, so no need for locks - // - // If CAS succeeded, the method should return the correct log content - // that will be applied to the storage. Otherwise it returns an empty - // string - virtual std::string compareAndSet(const std::string& log) = 0; - // The inherited classes need to implement this method to commit // a batch of log messages virtual bool commitLogs(std::unique_ptr iter) = 0; @@ -246,7 +244,8 @@ class RaftPart : public std::enable_shared_from_this { using LogCache = std::vector< std::tuple>; + std::string, + AtomicOp>>; /**************************************************** @@ -296,7 +295,8 @@ class RaftPart : public std::enable_shared_from_this { folly::Future appendLogAsync(ClusterID source, LogType logType, - std::string log); + std::string log, + AtomicOp cb = nullptr); void appendLogsInternal(AppendLogsIterator iter, TermID termId); @@ -395,9 +395,9 @@ class RaftPart : public std::enable_shared_from_this { // Whether the last future was returned from a shared promise bool rollSharedPromise_{true}; - // Promises shared by continuous non-CAS logs + // Promises shared by continuous non atomic op logs std::list> sharedPromises_; - // A list of promises for CAS logs + // A list of promises for atomic op logs std::list> singlePromises_; }; diff --git a/src/kvstore/raftex/test/LogCASTest.cpp b/src/kvstore/raftex/test/LogCASTest.cpp index 09e896ec486..3adfc56ee66 100644 --- a/src/kvstore/raftex/test/LogCASTest.cpp +++ b/src/kvstore/raftex/test/LogCASTest.cpp @@ -31,7 +31,9 @@ TEST_F(LogCASTest, StartWithValidCAS) { // Append logs LOG(INFO) << "=====> Start appending logs"; std::vector msgs; - leader_->casAsync("TCAS Log Message"); + leader_->atomicOpAsync([] () { + return test::compareAndSet("TCAS Log Message"); + }); msgs.emplace_back("CAS Log Message"); appendLogs(1, 9, leader_, msgs); LOG(INFO) << "<===== Finish appending logs"; @@ -44,7 +46,7 @@ TEST_F(LogCASTest, StartWithInvalidCAS) { // Append logs LOG(INFO) << "=====> Start appending logs"; std::vector msgs; - leader_->casAsync("FCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log Message");}); appendLogs(0, 9, leader_, msgs); LOG(INFO) << "<===== Finish appending logs"; @@ -58,7 +60,7 @@ TEST_F(LogCASTest, ValidCASInMiddle) { std::vector msgs; appendLogs(0, 4, leader_, msgs); - leader_->casAsync("TCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("TCAS Log Message");}); msgs.emplace_back("CAS Log Message"); appendLogs(6, 9, leader_, msgs); @@ -74,7 +76,7 @@ TEST_F(LogCASTest, InvalidCASInMiddle) { std::vector msgs; appendLogs(0, 4, leader_, msgs); - leader_->casAsync("FCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log Message");}); appendLogs(5, 9, leader_, msgs); LOG(INFO) << "<===== Finish appending logs"; @@ -89,10 +91,10 @@ TEST_F(LogCASTest, EndWithValidCAS) { std::vector msgs; appendLogs(0, 7, leader_, msgs); - leader_->casAsync("TCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("TCAS Log Message");}); msgs.emplace_back("CAS Log Message"); - auto fut = leader_->casAsync("TCAS Log Message"); + auto fut = leader_->atomicOpAsync([] () { return test::compareAndSet("TCAS Log Message");}); msgs.emplace_back("CAS Log Message"); fut.wait(); LOG(INFO) << "<===== Finish appending logs"; @@ -107,8 +109,8 @@ TEST_F(LogCASTest, EndWithInvalidCAS) { std::vector msgs; appendLogs(0, 7, leader_, msgs); - leader_->casAsync("FCAS Log Message"); - auto fut = leader_->casAsync("FCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log Message");}); + auto fut = leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log Message");}); fut.wait(); LOG(INFO) << "<===== Finish appending logs"; @@ -121,7 +123,7 @@ TEST_F(LogCASTest, AllValidCAS) { LOG(INFO) << "=====> Start appending logs"; std::vector msgs; for (int i = 1; i <= 10; ++i) { - auto fut = leader_->casAsync("TTest CAS Log"); + auto fut = leader_->atomicOpAsync([] () { return test::compareAndSet("TTest CAS Log");}); msgs.emplace_back("Test CAS Log"); if (i == 10) { fut.wait(); @@ -138,7 +140,7 @@ TEST_F(LogCASTest, AllInvalidCAS) { LOG(INFO) << "=====> Start appending logs"; std::vector msgs; for (int i = 1; i <= 10; ++i) { - auto fut = leader_->casAsync("FCAS Log"); + auto fut = leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log");}); if (i == 10) { fut.wait(); } diff --git a/src/kvstore/raftex/test/LogCommandTest.cpp b/src/kvstore/raftex/test/LogCommandTest.cpp index 050dadf98b7..4d266088bf2 100644 --- a/src/kvstore/raftex/test/LogCommandTest.cpp +++ b/src/kvstore/raftex/test/LogCommandTest.cpp @@ -99,16 +99,16 @@ TEST_F(LogCommandTest, MixedLogs) { leader_->sendCommandAsync("Command log 1"); msgs.emplace_back("Command log 1"); - leader_->casAsync("TCAS Log Message 2"); + leader_->atomicOpAsync([] () { return test::compareAndSet("TCAS Log Message 2");}); msgs.emplace_back("CAS Log Message 2"); leader_->appendAsync(0, "Normal log Message 3"); msgs.emplace_back("Normal log Message 3"); - leader_->casAsync("TCAS Log Message 4"); + leader_->atomicOpAsync([] () { return test::compareAndSet("TCAS Log Message 4");}); msgs.emplace_back("CAS Log Message 4"); - leader_->casAsync("TCAS Log Message 5"); + leader_->atomicOpAsync([] () { return test::compareAndSet("TCAS Log Message 5");}); msgs.emplace_back("CAS Log Message 5"); leader_->sendCommandAsync("Command log 6"); @@ -120,7 +120,7 @@ TEST_F(LogCommandTest, MixedLogs) { leader_->appendAsync(0, "Normal log Message 8"); msgs.emplace_back("Normal log Message 8"); - leader_->casAsync("FCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log Message");}); leader_->sendCommandAsync("Command log 9"); msgs.emplace_back("Command log 9"); @@ -128,7 +128,7 @@ TEST_F(LogCommandTest, MixedLogs) { auto f = leader_->appendAsync(0, "Normal log Message 10"); msgs.emplace_back("Normal log Message 10"); - leader_->casAsync("FCAS Log Message"); + leader_->atomicOpAsync([] () { return test::compareAndSet("FCAS Log Message");}); f.wait(); LOG(INFO) << "<===== Finish appending logs"; diff --git a/src/kvstore/raftex/test/TestShard.cpp b/src/kvstore/raftex/test/TestShard.cpp index dcd40c31efc..e48292b0374 100644 --- a/src/kvstore/raftex/test/TestShard.cpp +++ b/src/kvstore/raftex/test/TestShard.cpp @@ -30,6 +30,15 @@ HostAddr decodeLearner(const folly::StringPiece& log) { return learner; } +std::string compareAndSet(const std::string& log) { + switch (log[0]) { + case 'T': + return log.substr(1); + default: + return std::string(); + } +} + TestShard::TestShard(size_t idx, std::shared_ptr svc, PartitionID partId, @@ -70,14 +79,6 @@ void TestShard::onElected(TermID term) { } } -std::string TestShard::compareAndSet(const std::string& log) { - switch (log[0]) { - case 'T': - return log.substr(1); - default: - return std::string(); - } -} bool TestShard::commitLogs(std::unique_ptr iter) { LogID firstId = -1; diff --git a/src/kvstore/raftex/test/TestShard.h b/src/kvstore/raftex/test/TestShard.h index da0305d955a..9d6d666662a 100644 --- a/src/kvstore/raftex/test/TestShard.h +++ b/src/kvstore/raftex/test/TestShard.h @@ -25,6 +25,8 @@ std::string encodeLearner(const HostAddr& addr); HostAddr decodeLearner(const folly::StringPiece& log); +std::string compareAndSet(const std::string& log); + class TestShard : public RaftPart { public: TestShard( @@ -57,7 +59,6 @@ class TestShard : public RaftPart { void onLostLeadership(TermID term) override; void onElected(TermID term) override; - std::string compareAndSet(const std::string& log) override; bool commitLogs(std::unique_ptr iter) override; bool preProcessLog(LogID,