diff --git a/docs-2.0/14.client/3.nebula-cpp-client.md b/docs-2.0/14.client/3.nebula-cpp-client.md index 99abdf86365..b65d4199875 100644 --- a/docs-2.0/14.client/3.nebula-cpp-client.md +++ b/docs-2.0/14.client/3.nebula-cpp-client.md @@ -24,7 +24,7 @@ - (Recommended) To install a specific version of Nebula CPP, use the Git option `--branch` to specify the branch. For example, to install v{{ cpp.release }}, run the following command: ```bash - $ git clone --branch v{{ cpp.release }} https://github.com/vesoft-inc/nebula-cpp.git + $ git clone --branch {{cpp.branch}} https://github.com/vesoft-inc/nebula-cpp.git ``` - To install the daily development version, run the following command to download the source code from the `master` branch: @@ -103,23 +103,4 @@ Compile the CPP file to an executable file, then you can use it. The following s ### Core of the example code -This sub-section shows the core of the example code. For all the code, see [SessionExample](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp). - -```C++ -nebula::init(&argc, &argv); -auto address = "192.168.xx.1:9669"; -nebula::ConnectionPool pool; -pool.init({address}, nebula::Config{}); -auto session = pool.getSession("root", "nebula"); - -auto result = session.execute("SHOW HOSTS"); -std::cout << *result.data; - -std::atomic_bool complete{false}; -session.asyncExecute("SHOW HOSTS", [&complete](nebula::ExecutionResponse&& cbResult) { - std::cout << *cbResult.data; - complete.store(true); -}); -session.release(); -``` - +This sub-section shows the core of the example code. For all the code, see [SessionExample](https://github.com/vesoft-inc/nebula-cpp/blob/{{cpp.branch}}/examples/SessionExample.cpp). diff --git a/docs-2.0/14.client/4.nebula-java-client.md b/docs-2.0/14.client/4.nebula-java-client.md index 99d09944644..23ee7cc55da 100644 --- a/docs-2.0/14.client/4.nebula-java-client.md +++ b/docs-2.0/14.client/4.nebula-java-client.md @@ -20,7 +20,7 @@ You have installed Java 8.0 or later versions. - (Recommended) To install a specific version of Nebula Java, use the Git option `--branch` to specify the branch. For example, to install v{{ java.release }}, run the following command: ```bash - $ git clone --branch v{{ java.release }} https://github.com/vesoft-inc/nebula-java.git + $ git clone --branch {{java.branch}} https://github.com/vesoft-inc/nebula-java.git ``` - To install the daily development version, run the following command to download the source code from the `master` branch: @@ -39,13 +39,13 @@ When importing a Maven project with tools such as IDEA, set the following depend !!! note - `2.0.0-SNAPSHOT` indicates the daily development version that may have unknown issues. We recommend that you replace `2.0.0-SNAPSHOT` with a released version number to use a table version. + `3.0.0-SNAPSHOT` indicates the daily development version that may have unknown issues. We recommend that you replace `3.0.0-SNAPSHOT` with a released version number to use a table version. ```bash com.vesoft client - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT ``` @@ -64,50 +64,5 @@ If there is no Maven to manage the project, manually download the [JAR file](htt ### Core of the example code -This sub-section shows the core of the example code. For all the code, see [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(); -Session session = null; -try { - NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig(); - nebulaPoolConfig.setMaxConnSize(100); - List addresses = Arrays.asList(new HostAddress("192.168.xx.1", 9669), - new HostAddress("192.168.xx.2", 9670)); - pool.init(addresses, nebulaPoolConfig); - session = pool.getSession("root", "nebula", false); - - //create space - String space = "test"; - 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)"; - ResultSet resp = session.execute(createSchema); - - //insert vertex - String insertVertexes = "INSERT VERTEX person(name, age) VALUES " + "'Bob':('Bob', 10), " - + "'Lily':('Lily', 9), " + "'Tom':('Tom', 10), " + "'Jerry':('Jerry', 13), " - + "'John':('John', 11);"; - ResultSet resp = session.execute(insertVertexes); - - // inert edge - String insertEdges = "INSERT EDGE like(likeness) VALUES " + "'Bob'->'Lily':(80.0), " - + "'Bob'->'Tom':(70.0), " + "'Lily'->'Jerry':(84.0), " + "'Tom'->'Jerry':(68.3), " - + "'Bob'->'John':(97.2);"; - ResultSet resp = session.execute(insertEdges); - - // query - String query = "GO FROM \"Bob\" OVER like " + "YIELD properties($$).name, properties($$).age, properties(edge).likeness"; - ResultSet resp = session.execute(query); - printResult(resp); -}finally { - if (session != null) { - session.release(); - } - pool.close(); -} -``` +This sub-section shows the core of the example code. For all the code, see [GraphClientExample](https://github.com/vesoft-inc/nebula-java/blob/{{java.branch}}/examples/src/main/java/com/vesoft/nebula/examples/GraphClientExample.java). + diff --git a/docs-2.0/14.client/5.nebula-python-client.md b/docs-2.0/14.client/5.nebula-python-client.md index b0f4ad20c28..ff957d5cdc4 100644 --- a/docs-2.0/14.client/5.nebula-python-client.md +++ b/docs-2.0/14.client/5.nebula-python-client.md @@ -20,7 +20,7 @@ You have installed Python 3.6 or later versions. ### Install Nebula Python with pip ```bash -$ pip install nebula2-python== +$ pip install nebula3-python== ``` ### Install Nebula Python from the source code @@ -30,7 +30,7 @@ $ pip install nebula2-python== - (Recommended) To install a specific version of Nebula Python, use the Git option `--branch` to specify the branch. For example, to install v{{ python.release }}, run the following command: ```bash - $ git clone --branch v{{ python.release }} https://github.com/vesoft-inc/nebula-python.git + $ git clone --branch {{python.branch}} https://github.com/vesoft-inc/nebula-python.git ``` - To install the daily development version, run the following command to download the source code from the `master` branch: @@ -53,66 +53,4 @@ $ pip install nebula2-python== ## Core of the example code -This section shows the core of the example code. For all the code, see [Example](https://github.com/vesoft-inc/nebula-python/tree/master/example). - -### Connect to the Graph Service - -```python -# Customize configurations. -config = Config() -config.max_connection_pool_size = 10 -# Initialize the connection pool. -connection_pool = ConnectionPool() -# Returns true if the server is healthy, false otherwise. -ok = connection_pool.init([('192.168.xx.1', 9669)], config) - -# Method 1: Manually specify when to release the session. -# Get the session from the connection pool. -session = connection_pool.get_session('root', 'nebula') - -# Select a graph space. -session.execute('USE basketballplayer') - -# Run the SHOW TAGS statement. -result = session.execute('SHOW TAGS') -print(result) - -# Release the session. -session.release() - -# Method 2: Use session_context to automatically release the session. -with connection_pool.session_context('root', 'nebula') as session: - session.execute('USE basketballplayer;') - result = session.execute('SHOW TAGS;') - print(result) - -# Close the connection pool. -connection_pool.close() -``` - -### Connect to the Storage Server - -```python -# Set the IP addresses of all Meta servers. -meta_cache = MetaCache([('192.168.xx.1', 9559), - ('192.168.xx.2', 9559), - ('192.168.xx.3', 9559)], - 50000) -graph_storage_client = GraphStorageClient(meta_cache) - -resp = graph_storage_client.scan_vertex( - space_name='ScanSpace', - tag_name='person') -while resp.has_next(): - result = resp.next() - for vertex_data in result: - print(vertex_data) - -resp = graph_storage_client.scan_edge( - space_name='ScanSpace', - edge_name='friend') -while resp.has_next(): - result = resp.next() - for edge_data in result: - print(edge_data) -``` +This section shows the core of the example code. For all the code, see [Example](https://github.com/vesoft-inc/nebula-python/tree/{{python.branch}}/example). diff --git a/docs-2.0/14.client/6.nebula-go-client.md b/docs-2.0/14.client/6.nebula-go-client.md index 8a8b15cda2b..3d732e863d5 100644 --- a/docs-2.0/14.client/6.nebula-go-client.md +++ b/docs-2.0/14.client/6.nebula-go-client.md @@ -19,7 +19,7 @@ You have installed Golang 1.13 or later versions. - (Recommended) To install a specific version of Nebula Go, use the Git option `--branch` to specify the branch. For example, to install v{{ go.release }}, run the following command: ```bash - $ git clone --branch v{{ go.release }} https://github.com/vesoft-inc/nebula-go.git + $ git clone --branch {{go.branch}} https://github.com/vesoft-inc/nebula-go.git ``` - To install the daily development version, run the following command to download the source code from the `master` branch: @@ -36,43 +36,8 @@ Run the following command to install or update Nebula Go: $ go get -u -v github.com/vesoft-inc/nebula-go@ ``` -`tag`: Specify the branch, such as `master` or `v{{ go.release }}`. +`tag`: Specify the branch, such as `master` or `{{go.branch}}`. ## Core of the example code -This section shows the core of the example code. For all the code, see [graph_client_basic_example](https://github.com/vesoft-inc/nebula-go/blob/master/basic_example/graph_client_basic_example.go) and [graph_client_goroutines_example](https://github.com/vesoft-inc/nebula-go/blob/master/gorountines_example/graph_client_goroutines_example.go). - -```bash -const ( - address = "192.168.xx.1" - port = 9669 - username = "root" - password = "nebula" -) - -func main() { - hostAddress := nebula.HostAddress{Host: address, Port: port} - hostList := []nebula.HostAddress{hostAddress} - testPoolConfig := nebula.GetDefaultConf() - pool, err := nebula.NewConnectionPool(hostList, testPoolConfig, log) - defer pool.Close() - session, err := pool.GetSession(username, password) - defer session.Release() - - checkResultSet := func(prefix string, res *nebula.ResultSet) { - if !res.IsSucceed() { - log.Fatal(fmt.Sprintf("%s, ErrorCode: %v, ErrorMsg: %s", prefix, res.GetErrorCode(), res.GetErrorMsg())) - } - } - { - createSchema := "CREATE SPACE IF NOT EXISTS basic_example_space(vid_type=FIXED_STRING(20)); " + - "USE basic_example_space;" + - "CREATE TAG IF NOT EXISTS person(name string, age int);" + - "CREATE EDGE IF NOT EXISTS like(likeness double)" - resultSet, err := session.Execute(createSchema) - checkResultSet(createSchema, resultSet) - } - fmt.Print("\n") - log.Info("Nebula Go Client Basic Example Finished") -} -``` +This section shows the core of the example code. For all the code, see [graph_client_basic_example](https://github.com/vesoft-inc/nebula-go/blob/{{go.branch}}/basic_example/graph_client_basic_example.go) and [graph_client_goroutines_example](https://github.com/vesoft-inc/nebula-go/blob/{{go.branch}}/gorountines_example/graph_client_goroutines_example.go). diff --git a/docs-2.0/nebula-exchange/ex-ug-FAQ.md b/docs-2.0/nebula-exchange/ex-ug-FAQ.md index e842297da98..521a1937249 100644 --- a/docs-2.0/nebula-exchange/ex-ug-FAQ.md +++ b/docs-2.0/nebula-exchange/ex-ug-FAQ.md @@ -56,7 +56,7 @@ $SPARK_HOME/bin/spark-submit --class com.vesoft.nebula.exchange.Exchange \ --files application.conf \ --conf spark.driver.extraClassPath=./ \ --conf spark.executor.extraClassPath=./ \ -nebula-exchange-2.0.0.jar \ +nebula-exchange-3.0.0.jar \ -c application.conf ``` @@ -123,7 +123,7 @@ Namely: --conf spark.driver.extraJavaOptions=-Dfile.encoding=utf-8 \ --conf spark.executor.extraJavaOptions=-Dfile.encoding=utf-8 \ --class com.vesoft.nebula.exchange.Exchange \ - -c + -c ``` In YARN, use the following command: @@ -137,7 +137,7 @@ In YARN, use the following command: --conf spark.executor.extraClassPath=./ \ --conf spark.driver.extraJavaOptions=-Dfile.encoding=utf-8 \ --conf spark.executor.extraJavaOptions=-Dfile.encoding=utf-8 \ - \ + \ -c application.conf ``` diff --git a/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md b/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md index 955a2554cf8..b605c2f0a51 100644 --- a/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md +++ b/docs-2.0/nebula-exchange/use-exchange/ex-ug-import-from-sst.md @@ -168,7 +168,7 @@ After Exchange is compiled, copy the conf file `target/classes/application.conf` # Spark configuration spark: { app: { - name: Nebula Exchange 2.0 + name: Nebula Exchange {{exchange.release}} } master:local