Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add whitespace #1253

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs-2.0/14.client/1.nebula-client.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# 客户端介绍

Nebula Graph提供多种类型客户端,便于用户连接、管理Nebula Graph图数据库
Nebula Graph 提供多种类型客户端,便于用户连接、管理 Nebula Graph 图数据库

- [Nebula Console](../2.quick-start/3.connect-to-nebula-graph.md):原生CLI客户端
- [Nebula Console](../2.quick-start/3.connect-to-nebula-graph.md):原生 CLI 客户端

- [Nebula CPP](3.nebula-cpp-client.md):C++客户端

- [Nebula Java](4.nebula-java-client.md):Java客户端
- [Nebula Java](4.nebula-java-client.md):Java 客户端

- [Nebula Python](5.nebula-python-client.md):Python客户端
- [Nebula Python](5.nebula-python-client.md):Python 客户端

- [Nebula Go](6.nebula-go-client.md):Go客户端
- [Nebula Go](6.nebula-go-client.md):Go 客户端

!!! note

除Nebula Java之外,其他客户端暂不支持线程安全(thread-safe)。
除 Nebula Java 之外,其他客户端暂不支持线程安全(thread-safe)。
39 changes: 19 additions & 20 deletions docs-2.0/14.client/3.nebula-cpp-client.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Nebula CPP

[Nebula CPP](https://github.com/vesoft-inc/nebula-cpp/tree/{{cpp.branch}})是一款C++语言的客户端,可以连接、管理Nebula Graph图数据库
[Nebula CPP](https://github.com/vesoft-inc/nebula-cpp/tree/{{cpp.branch}}) 是一款 C++语言的客户端,可以连接、管理 Nebula Graph 图数据库

## 前提条件

- 已安装C++,GCC版本为4.8及以上
- 已安装 C++,GCC 版本为 4.8 及以上

- 编译安装需要准备正确的编译环境,详情请参见[软硬件要求和安装三方库依赖包](../4.deployment-and-installation/1.resource-preparations.md)。
- 编译安装需要准备正确的编译环境,详情请参见 [软硬件要求和安装三方库依赖包](../4.deployment-and-installation/1.resource-preparations.md)。

## 版本对照表

|Nebula Graph版本|Nebula CPP版本|
|Nebula Graph 版本|Nebula CPP 版本|
|:---|:---|
|{{ nebula.release }}|{{cpp.release}}|
|2.0.1|2.0.0|
|2.0.0|2.0.0|

## 安装Nebula CPP
## 安装 Nebula CPP

1. 克隆Nebula CPP源码到机器
1. 克隆 Nebula CPP 源码到机器

- (推荐)如果需要安装指定版本的Nebula CPP,请使用选项`--branch`指定分支。例如安装v{{ cpp.release }}发布版本,请执行如下命令:
- (推荐)如果需要安装指定版本的 Nebula CPP,请使用选项`--branch`指定分支。例如安装 v{{ cpp.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ cpp.release }} https://github.com/vesoft-inc/nebula-cpp.git
Expand All @@ -32,19 +32,19 @@
$ git clone https://github.com/vesoft-inc/nebula-cpp.git
```

2. 进入目录nebula-cpp。
2. 进入目录 nebula-cpp。

```bash
$ cd nebula-cpp
```

3. 创建目录build并进入该目录
3. 创建目录 build 并进入该目录

```bash
$ mkdir build && cd build
```

4. 使用CMake生成makefile文件
4. 使用 CMake 生成 makefile 文件

!!! Note

Expand All @@ -56,17 +56,17 @@

!!! note

如果g++不支持c++11,请添加选项`-DDISABLE_CXX11_ABI=ON`。
如果 g++不支持 c++11,请添加选项`-DDISABLE_CXX11_ABI=ON`。

5. 编译Nebula CPP。
5. 编译 Nebula CPP。

为了适当地加快编译速度,可以使用选项`-j`并行编译。并行数量`N`建议为$\min(\text{CPU}核数,\frac{内存(GB)}{2})$。
为了适当地加快编译速度,可以使用选项`-j`并行编译。并行数量`N`建议为$\min(\text{CPU}核数\frac{内存 (GB)}{2})$。

```bash
$ make -j{N}
```

6. 安装Nebula CPP。
6. 安装 Nebula CPP。

```bash
$ sudo make install
Expand All @@ -80,19 +80,19 @@

## 使用方法

将CPP文件编译为可执行文件即可。接下来以`SessionExample.cpp`为例,介绍如何操作。
将 CPP 文件编译为可执行文件即可。接下来以`SessionExample.cpp`为例,介绍如何操作。

1. 使用[示例代码](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp)创建`SessionExample.cpp`文件。
1. 使用 [示例代码](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp) 创建`SessionExample.cpp`文件。

2. 编译文件,命令如下:

```bash
$ LIBRARY_PATH=<library_folder_path>:$LIBRARY_PATH g++ -std=c++11 SessionExample.cpp -I<include_folder_path> -lnebula_graph_client -o session_example
```

- `library_folder_path`:Nebula Graph动态库文件存储路径,默认为`/usr/local/nebula/lib64`。
- `library_folder_path`:Nebula Graph 动态库文件存储路径,默认为`/usr/local/nebula/lib64`。

- `include_folder_path`:Nebula Graph头文件存储路径,默认为`/usr/local/nebula/include`。
- `include_folder_path`:Nebula Graph 头文件存储路径,默认为`/usr/local/nebula/include`。

示例:

Expand All @@ -102,7 +102,7 @@

### 核心代码

详细示例请参见[SessionExample](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp)。
详细示例请参见 [SessionExample](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp)。

```C++
nebula::init(&argc, &argv);
Expand All @@ -121,4 +121,3 @@ session.asyncExecute("SHOW HOSTS", [&complete](nebula::ExecutionResponse&& cbRes
});
session.release();
```

21 changes: 10 additions & 11 deletions docs-2.0/14.client/4.nebula-java-client.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Nebula Java

[Nebula Java](https://github.com/vesoft-inc/nebula-java/tree/{{ java.branch }})是一款Java语言的客户端,可以连接、管理Nebula Graph图数据库
[Nebula Java](https://github.com/vesoft-inc/nebula-java/tree/{{ java.branch }}) 是一款 Java 语言的客户端,可以连接、管理 Nebula Graph 图数据库

## 前提条件

已安装Java,版本为8.0及以上
已安装 Java,版本为 8.0 及以上

## 版本对照表

|Nebula Graph版本|Nebula Java版本|
|Nebula Graph 版本|Nebula Java 版本|
|:---|:---|
|{{ nebula.release }}|{{java.release}}|
|2.0.1|2.0.0|
|2.0.0|2.0.0|
|2.0.0-rc1|2.0.0-rc1|

## 下载Nebula Java
## 下载 Nebula Java

- (推荐)如果需要使用指定版本的Nebula Java,请使用选项`--branch`指定分支。例如使用v{{ java.release }}发布版本,请执行如下命令:
- (推荐)如果需要使用指定版本的 Nebula Java,请使用选项`--branch`指定分支。例如使用 v{{ java.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ java.release }} https://github.com/vesoft-inc/nebula-java.git
Expand All @@ -35,11 +35,11 @@

建议一个线程使用一个会话,如果多个线程使用同一个会话,会降低效率。

使用IDEA等工具导入Maven项目,请在`pom.xml`中添加如下依赖:
使用 IDEA 等工具导入 Maven 项目,请在`pom.xml`中添加如下依赖:

!!! note

`2.0.0-SNAPSHOT`为日常研发版本,可能存在未知问题,建议使用release版本号替换`2.0.0-SNAPSHOT`。
`2.0.0-SNAPSHOT`为日常研发版本,可能存在未知问题,建议使用 release 版本号替换`2.0.0-SNAPSHOT`。

```bash
<dependency>
Expand All @@ -49,7 +49,7 @@
</dependency>
```

如果无法下载日常研发版本的依赖,请在`pom.xml`中添加如下内容(release版本不需要添加):
如果无法下载日常研发版本的依赖,请在`pom.xml`中添加如下内容(release 版本不需要添加):

```bash
<repositories>
Expand All @@ -60,11 +60,11 @@
</repositories>
```

如果没有Maven管理项目,请手动[下载JAR包](https://repo1.maven.org/maven2/com/vesoft/)进行安装。
如果没有 Maven 管理项目,请手动 [下载 JAR 包](https://repo1.maven.org/maven2/com/vesoft/) 进行安装。

### 核心代码

详细示例请参见[GraphClientExample](https://github.com/vesoft-inc/nebula-java/blob/master/examples/src/main/java/com/vesoft/nebula/examples/GraphClientExample.java)。
详细示例请参见 [GraphClientExample](https://github.com/vesoft-inc/nebula-java/blob/master/examples/src/main/java/com/vesoft/nebula/examples/GraphClientExample.java)。

```java
NebulaPool pool = new NebulaPool();
Expand All @@ -82,7 +82,6 @@ try {
String createSpace = "CREATE SPACE IF NOT EXISTS " + space + " (partition_num=15, replica_factor=1, vid_type=fixed_string(30)); ";
ResultSet resp = session.execute(createSpace);


//create schema
String createSchema = "USE " + space + "; CREATE TAG IF NOT EXISTS person(name string, age int);"
+ "CREATE EDGE IF NOT EXISTS like(likeness double)";
Expand Down
32 changes: 16 additions & 16 deletions docs-2.0/14.client/5.nebula-python-client.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Nebula Python

[Nebula Python](https://github.com/vesoft-inc/nebula-python)是一款Python语言的客户端,可以连接、管理Nebula Graph图数据库
[Nebula Python](https://github.com/vesoft-inc/nebula-python) 是一款 Python 语言的客户端,可以连接、管理 Nebula Graph 图数据库

## 前提条件

已安装Python,版本为3.5及以上
已安装 Python,版本为 3.5 及以上

## 版本对照表

|Nebula Graph版本|Nebula Python版本|
|Nebula Graph 版本|Nebula Python 版本|
|:---|:---|
|{{ nebula.release }}|{{python.release}}|
|2.0.1|2.0.0|
|2.0.0|2.0.0|
|2.0.0-rc1|2.0.0rc1|

## 安装Nebula Python
## 安装 Nebula Python

### pip安装
### pip 安装

```bash
$ pip install nebula2-python==<version>
```

### 克隆源码安装

1. 克隆Nebula Python源码到机器
1. 克隆 Nebula Python 源码到机器

- (推荐)如果需要安装指定版本的Nebula Python,请使用选项`--branch`指定分支。例如安装v{{ python.release }}发布版本,请执行如下命令:
- (推荐)如果需要安装指定版本的 Nebula Python,请使用选项`--branch`指定分支。例如安装 v{{ python.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ python.release }} https://github.com/vesoft-inc/nebula-python.git
Expand All @@ -39,7 +39,7 @@ $ pip install nebula2-python==<version>
$ git clone https://github.com/vesoft-inc/nebula-python.git
```

2. 进入目录nebula-python。
2. 进入目录 nebula-python。

```bash
$ cd nebula-python
Expand All @@ -53,34 +53,34 @@ $ pip install nebula2-python==<version>

## 核心代码

详细示例请参见[Example](https://github.com/vesoft-inc/nebula-python/tree/master/example)。
详细示例请参见 [Example](https://github.com/vesoft-inc/nebula-python/tree/master/example)。

### 连接Graph服务
### 连接 Graph 服务

```python
# 定义配置
config = Config()
config.max_connection_pool_size = 10
# 初始化连接池
connection_pool = ConnectionPool()
# 如果给定的服务器正常,则返回true,否则返回false
# 如果给定的服务器正常,则返回 true,否则返回 false
ok = connection_pool.init([('192.168.xx.1', 9669)], config)

# 方法1:控制连接自行释放。
# 方法 1:控制连接自行释放。
# 从连接池中获取会话
session = connection_pool.get_session('root', 'nebula')

# 选择图空间
session.execute('USE basketballplayer')

# 执行查看TAG命令
# 执行查看 TAG 命令
result = session.execute('SHOW TAGS')
print(result)

# 释放会话
session.release()

# 方法2:使用session_context,会话将被自动释放。
# 方法 2:使用 session_context,会话将被自动释放。
with connection_pool.session_context('root', 'nebula') as session:
session.execute('USE basketballplayer;')
result = session.execute('SHOW TAGS;')
Expand All @@ -90,10 +90,10 @@ with connection_pool.session_context('root', 'nebula') as session:
connection_pool.close()
```

### 连接Storage服务
### 连接 Storage 服务

```python
# 设置所有Meta服务地址
# 设置所有 Meta 服务地址
meta_cache = MetaCache([('192.168.xx.1', 9559),
('192.168.xx.2', 9559),
('192.168.xx.3', 9559)],
Expand Down
12 changes: 6 additions & 6 deletions docs-2.0/14.client/6.nebula-go-client.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Nebula Go

[Nebula Go](https://github.com/vesoft-inc/nebula-go/tree/{{go.branch}})是一款Go语言的客户端,可以连接、管理Nebula Graph图数据库
[Nebula Go](https://github.com/vesoft-inc/nebula-go/tree/{{go.branch}}) 是一款 Go 语言的客户端,可以连接、管理 Nebula Graph 图数据库

## 前提条件

已安装Go,版本为1.13及以上
已安装 Go,版本为 1.13 及以上

## 版本对照表

|Nebula Graph版本|Nebula Go版本|
|Nebula Graph 版本|Nebula Go 版本|
|:---|:---|
|{{ nebula.release }}|{{go.release}}|
|2.0.1|2.0.0-GA|
|2.0.0|2.0.0-GA|

## 下载Nebula Go
## 下载 Nebula Go

- (推荐)如果需要下载指定版本的Nebula Go,请使用选项`--branch`指定分支。例如安装v{{ go.release }}发布版本,请执行如下命令:
- (推荐)如果需要下载指定版本的 Nebula Go,请使用选项`--branch`指定分支。例如安装 v{{ go.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ go.release }} https://github.com/vesoft-inc/nebula-go.git
Expand All @@ -40,7 +40,7 @@ $ go get -u -v github.com/vesoft-inc/nebula-go@<tag>

## 核心代码

详细示例请参见[graph_client_basic_example](https://github.com/vesoft-inc/nebula-go/blob/master/basic_example/graph_client_basic_example.go)[graph_client_goroutines_example](https://github.com/vesoft-inc/nebula-go/blob/master/gorountines_example/graph_client_goroutines_example.go)。
详细示例请参见 [graph_client_basic_example](https://github.com/vesoft-inc/nebula-go/blob/master/basic_example/graph_client_basic_example.go)[graph_client_goroutines_example](https://github.com/vesoft-inc/nebula-go/blob/master/gorountines_example/graph_client_goroutines_example.go)。

```bash
const (
Expand Down
Loading