Skip to content

Commit

Permalink
add English quick start && polish some docs of chinese version (vesof…
Browse files Browse the repository at this point in the history
…t-inc#167)

* added manage schema (english)

* added english quick start && polished the chinese version

* updated toc

* updated

* fixed comments

* Add version info && update limitations (vesoft-inc#166)

* added version info into operation docs and fixed errors

* updated

* added version info into operation docs and fixed errors

* updated

* updated

* fixed comments

* added view subgraph (vesoft-inc#169)

* added manage schema (english)

* added english quick start && polished the chinese version

* updated toc

* updated

* fixed comments

* fixed comments
  • Loading branch information
oldLady344 authored Nov 9, 2020
1 parent 815132c commit 296fd0e
Show file tree
Hide file tree
Showing 16 changed files with 168 additions and 11 deletions.
5 changes: 1 addition & 4 deletions docs/cn/quick-start/st-ug-create-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,4 @@ DESCRIBE EDGE action; -- 查看每种标签和边类型的结构是否正确

## 后续操作

创建 Schema 后,您可能需要执行以下操作:

- 根据业务需要,您可以为标签和边类型创建索引。详细信息,参考 [Nebula Graph 的 Schema 索引](https://docs.nebula-graph.com.cn/manual-CN/2.query-language/4.statement-syntax/1.data-definition-statements/ "点击前往 Nebula Graph 网站")
- [导入数据](st-ug-import-data.md)
创建 Schema 后,您可以开始 [导入数据](st-ug-import-data.md)
2 changes: 0 additions & 2 deletions docs/cn/quick-start/st-ug-explore.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@

***图探索** 页面:点击 **开始探索** 按钮,在 **指定VID** 对话框中,输入 **"History of Chinese Women Through Time"**,在 **VID预处理** 选择 **Hash**,再点击 **添加** 按钮。**图探索** 画板里会显示这个点,将鼠标移到点上,您能看到这个点所有属性信息,如下图所示。
![可视化显示 History of Chinese Women Through Time 课程的信息](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-013.png "按 VID 查询得到点的信息")

更多操作的详细信息,参考 [操作指南](../use-studio/st-ug-use-overview.md)
58 changes: 58 additions & 0 deletions docs/en/quick-start/st-ug-create-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Create a schema

To bulk import data into a Nebula Graph database, you must have a schema. You can create a schema with the **Console** module or the **Schema** module of Studio.

> **NOTE**: You can use nebula-console to create a schema. For more information, see [Deploy Nebula Graph with Docker Compose
](https://github.com/vesoft-inc/nebula-docker-compose/blob/master/README.md "Click to go to GitHub website") and [Get started with Nebula Graph](https://docs.nebula-graph.io/manual-EN/1.overview/2.quick-start/1.get-started/ "Click to go to Nebula Graph website").

## Prerequisites

To create a schema on Studio, you must do a check of these:

- Studio is connected to Nebula Graph.
- Your account has the privileges of GOD, ADMIN, or DBA. For more information, see [Nebula Graph roles](https://docs.nebula-graph.io/manual-EN/3.build-develop-and-administration/4.account-management-statements/built-in-roles/ "Click to go to Nebula Graph website").
- The schema is designed.
- A graph space is created.
> **NOTE**: If no graph space exists, and your account has GOD privileges, you can create a graph space with **Console** or **Schema**.
## Create a schema with Schema

To create a schema on the **Schema** page, make sure that the version of Studio is v1.2.0-beta or later then follow these steps:

1. Create tags. For more information, see [Operate tags](../manage-schema/st-ug-crud-tag.md).
2. Create edge types. For more information, see [Operate edge types](../manage-schema/st-ug-crud-edge-type.md).

## Create a schema with Console

To create a schema on the **Console** page, follow these steps:

1. In the toolbar, click the **Console** tab.
2. In the **Current Graph Space** field, choose a graph space name. In this example, **mooc_actions** is used.

![Choose a graph space name for the Current Graph Space field](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-031.png "Choose a graph space")

3. In the input box, enter these statements one by one and click the ![Icon of Run](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-008.png "Run") icon.

```nGQL
nebula> CREATE TAG user (userId int); -- To create a tag named "user", with one property
nebula> CREATE TAG course (courseId int, courseName string); -- To create a tag named "course", with two properties
nebula> CREATE EDGE action (actionId int, duration double, label bool, feature0 double, feature1 double, feature2 double, feature3 double); -- To create an edge type named "action", with seven properties
```
If the preceding statements are executed successfully, the schema is created. You can run the statements as follows to view the schema.
```nGQL
nebula> SHOW TAGS; -- To list all the tags in the current graph space
nebula> SHOW EDGES; -- To list all the edge types in the current graph space
nebula> DESCRIBE TAG user;
nebula> DESCRIBE TAG course;
nebula> DESCRIBE EDGE action; -- To view the definition of the tags and edge types
```

If the schema is created successfully, in the result window, you can see the definition of the tags and edge types. For example, this figure shows the result of the `DESCRIBE EDGE action` statement.

![The result window shows the definition of the action edge](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-048.png "Result of the DESCRIBE EDGE action statement")

## Next to do

When a schema is created, you can [import data](st-ug-import-data.md).
10 changes: 10 additions & 0 deletions docs/en/quick-start/st-ug-explore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Query graph data

When data is imported, you can use **Console** or **Explore** to query graph data.

For example, if you want to query the properties of the course named _History of Chinese Women Through Time_, you can perform these optional operations:

* On the **Console** tab: Run `FETCH PROP ON * hash("History of Chinese Women Through Time");`. The result window shows all the property information of this vertex. When the result returns, click the **Open in Explore** button and then you can view the vertex information in a visualized way.
![The information retrieved with Console](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-036.png "Retrieve data information ")

* On the **Explore** tab: Click the **Start with Vertices** button. In the dialog box, enter **"History of Chinese Women Through Time"**, choose **Hash** to pre-process the VID, and then click the **Add** button. On the board, you can see the vertex. Move your mouse pointer on the vertex to see the vertex details, as shown in the preceding figure.
52 changes: 52 additions & 0 deletions docs/en/quick-start/st-ug-import-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Import data

After CSV files of data and a schema are created, you can use the **Import** page to bulk import vertex and edge data into a Nebula Graph database for graph exploration and data analysis.

## Prerequisites

To bulk import data, do a check of these:

- Studio is connected to Nebula Graph.
- A schema is created.
- CSV files for vertex and edge data separately are created.
- Your account has privileges of GOD, ADMIN, DBA, or USER.

## Procedure

To bulk import data, follow these steps:

1. In the toolbar, click the **Import** tab.
2. On the **Select Space** page, choose a graph space name. In this example, **mooc_actions** is used. And then click the **Next** button.
3. On the **Upload Files** page, click the **Upload Files** button and then choose CSV files. In this example, `user.csv`, `course.csv`, and `actions.csv` are chosen.
> **NOTE**: You can choose multiple CSV files at the same time.
4. On the **Select Files** page, do a check of the file size and click **Preview** or **Delete** in the **Operations** column to make sure that all source data is correct. And then click the **Next** button.
5. On the **Map Vertices** page, click the **+ Bind Datasource** button, and in the dialog box, choose a CSV file. In this example, `user.csv` or `course.csv` is chosen.
6. In the **DataSource X** tab, click the **+ Tag** button.
7. In the **vertexId** section, do these operations:
a. In the **CSV Index** column, click **Mapping**.
![Click "Mapping** in the CSV Index column](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-032.png "Choose the source for vertexId")
b. In the dialog box, choose a column from the CSV file. In this example, the only one cloumn of `user.csv` is chosen to generate VIDs representing users and the `courseName` column of `course.csv` is chosen to generate VIDs representing courses.

> **NOTE**: VIDs are unique in one graph space. For more information about VIDs, see [Vertex Identifier and Partition](https://docs.nebula-graph.io/manual-EN/5.appendix/vid-partition/ "Click to go to Nebula Graph website").
c. In the **ID Hash** column, choose how to generate VIDs. If the source data is of the `int` type, choose **Original ID**. If the source data is of the `string`, `double`, or `bool` type, choose **Hash**.

8. In the **TAG 1** section, do these operations:
a. In the **TAG** drop-down list, choose a tag name. In this example, **user** is used for the `user.csv` file, and **course** is used for the `course.csv` file.
b. In the property list, click **Mapping** to choose a data column from the CSV file as the value of a property. In this example, the only column of the `user.csv` file is chosen to be the value of the `userId` property of the `user` tag. For the **course** tag, choose **Column 0** for the `courseId` property and set its type to **int**, then choose **Column 1** for the `courseName` property and set its type to **string**.
![Data source for the course vertices](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-033.png "Choose data source for tag properties")
9. (Optional) If necessary, repeat Step 5 through Step 8 for more tags.
10. When the configuration is done, click the **Next** button.
When **Config validation was successful** prompts, data mapping for the vertices is successful.
11. On the **Map Edges** page, click the **+ Bind Datasource** button, and in the dialog box, choose a CSV file. In this example, the `actions.csv` file is chosen.
12. In the **Type** drop-down list, choose an edge type name. In this example, **action** is chosen.
13. In the property list, click **Mapping** to choose a column from the `actions.csv` file as values of a property for the edges. **srcId** and **dstId** are the VIDs of the source vertex and destination vertex of an edge. The VID processing must be the same as that of the tag settings. In this example, **srcId** must be set to the VIDs of the users and **dstId** must be set to the VIDs of the courses. **rank** is optional.
![Data source for the action edges](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-034.png "Choose data source for the edge type properties")

14. When the configuration is done, click the **Next** button.
15. On the **Import** page, click the **Start Import** button. On the **log** window, you can see the import progress. The consumed time is related to the data volume. During data import, you can click the **Stop Import** button to stop data import. When the **log** window shows information as follows, the data import is done.
![The log window shows the time, imported rows, and operated lines](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-005.png "Information shown in the log window")

## Next to do

When the data are imported to Nebula Graph, you can [query graph data](st-ug-explore.md).
22 changes: 22 additions & 0 deletions docs/en/quick-start/st-ug-plan-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Design a schema

To operate graph data in a Nebula Graph database with Nebula Graph Studio, you must have a graph schema. This article introduces how to design a graph schema for a Nebula Graph database.

A graph schema for Nebula Graph database must have these essential elements:

- Tags (namely vertex types) and their properties.
- Edge types and their properties

In this article, the [Social Network: MOOC User Action Dataset](https://snap.stanford.edu/data/act-mooc.html "Click to go to Stanford Network Analysis Platform (SNAP) website") and 97 distinct course names are used to introduce how to design a schema.

This table gives all the essential elements of the schema.

| Element | Name | Property name (Data type) | Description |
| :--- | :--- | :--- | :--- |
| Tag | **user** | `userId` (`int`). The `userId` values are used to generate VIDs of user vertices. | Represents users of the specified MOOC platform. |
| Tag | **course** | `courseId` (`int`) and `courseName` (`string`). The `courseName` values are processed by the `Hash()` function to generate VIDs of course vertices. In Nebula Graph, VIDs must be distinct through a graph space. But in the source dataset, some `courseId` values are duplicate with some `userId` values, so the `courseId` values cannot be used to generate the VIDs of course vertices. | Represents the courses on the specified MOOC platform. |
| Edge type | **action** | - `actionId` (`int`) <br /> - `duration` (`double`): Represents the duration of an action measured in seconds from the beginning. Its values are equal to the `timestamp` values in the data source. <br /> - `label` (`bool`): Represents whether a user drops out after an action. `TRUE` indicates a drop-out action, `FALSE` otherwise. <br /> - `feature0` (`double`) <br /> - `feature1` (`double`) <br /> - `feature2` (`double`) <br /> - `feature3` (`double`) | Represents actions taken by users on the specified MOOC platform. An action links a user and a course and the direction is from a user to a course. It has four features. |

This figure shows the relationship (**action**) between a **user** and a **course** on the MOOC platform.

![Users take actions on a MOOC platform](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-006.png "Relationship between users and courses in the example dataset")
20 changes: 20 additions & 0 deletions docs/en/quick-start/st-ug-prepare-csv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Prepare CSV files

With Studio, you can bulk import vertex and edge data into a Nebula Graph database. Currently, only CSV files without headers are supported. Each file represents vertex or edge data of one type.

To create applicable CSV files, process the source data as follows:

1. Generate CSV files for vertex and edge data:

- `user.csv`: Contains the vertices representing users with the `userId` property.
- `course.csv`: Contains the vertices representing courses with the `courseId` and `courseName` properties.
- `actions.csv` contains:
- The edges representing actions with the `actionId`, `label`, `duration`, `feature0`, `feature1`, `feature2`, and `feature3` properties. For the `label` column, 1 is replaced with `TRUE` and 0 is replaced with `FALSE`.
- The `userId` column representing the source vertices of the edges.
- The `courseName` column representing the destination vertices of the edges.

This figure shows an example of a CSV file with the header.

![The actions.csv file contains the actionId, userId, courseName, duration, feature0, feature1, feature2, feature3, and label columns](https://docs-cdn.nebula-graph.com.cn/nebula-studio-docs/st-ug-035.png "actions.csv file with a header")

2. Delete all the headers from the CSV files.
10 changes: 5 additions & 5 deletions docs/en/st-ug-toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
- [Connect to Nebula Graph](../nebula-graph-studio-user-guide-en.md)
- [Clear connection] [TODO]
- Quick start
- [Design a schema] [TODO]
- [Prepare CSV files] [TODO]
- [Create a schema](../nebula-graph-studio-user-guide-en.md)
- [Import data](../nebula-graph-studio-user-guide-en.md)
- [Query data] [TODO]
- [Design a schema](quick-start/st-ug-create-schema.md)
- [Prepare CSV files](quick-start/st-ug-prepare-csv.md)
- [Create a schema](quick-start/st-ug-create-schema.md)
- [Import data](quick-start/st-ug-import-data.md)
- [Query graph data](quick-start/st-ug-explore.md)
- Operation guide
- Use Schema
- [Operate graph spaces](manage-schema/st-ug-crud-space.md)
Expand Down
Binary file modified docs/figs/st-ug-006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-031.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-032.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-033.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-034.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-035.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-036.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/figs/st-ug-048.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 296fd0e

Please sign in to comment.