You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2023/05/11 17:04:01 UTC
[incubator-hugegraph-doc] branch master updated: Branch fix load example (#213)
This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-doc.git
The following commit(s) were added to refs/heads/master by this push:
new be712b40 Branch fix load example (#213)
be712b40 is described below
commit be712b40cead4c00a9d44f8edc56f95a3403a917
Author: zhenyuT <94...@qq.com>
AuthorDate: Fri May 12 01:03:56 2023 +0800
Branch fix load example (#213)
* Update hugegraph-loader.md
---------
Co-authored-by: imbajin <ji...@apache.org>
---
content/cn/docs/quickstart/hugegraph-loader.md | 43 +++++++++++++-------------
content/en/docs/quickstart/hugegraph-loader.md | 43 +++++++++++++-------------
2 files changed, 44 insertions(+), 42 deletions(-)
diff --git a/content/cn/docs/quickstart/hugegraph-loader.md b/content/cn/docs/quickstart/hugegraph-loader.md
index 357109a6..52d6f018 100644
--- a/content/cn/docs/quickstart/hugegraph-loader.md
+++ b/content/cn/docs/quickstart/hugegraph-loader.md
@@ -795,7 +795,7 @@ bin/hugegraph-loader -g {GRAPH_NAME} -f ${INPUT_DESC_FILE} -s ${SCHEMA_FILE} -h
### 4 完整示例
-下面给出的是 hugegraph-loader 包中 example 目录下的例子。
+下面给出的是 hugegraph-loader 包中 example 目录下的例子。([GitHub 地址](https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader/assembly/static/example/file))
#### 4.1 准备数据
@@ -849,7 +849,6 @@ schema.propertyKey("price").asDouble().ifNotExist().create();
schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create();
schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").ifNotExist().create();
-schema.indexLabel("personByName").onV("person").by("name").secondary().ifNotExist().create();
schema.indexLabel("personByAge").onV("person").by("age").range().ifNotExist().create();
schema.indexLabel("personByCity").onV("person").by("city").secondary().ifNotExist().create();
schema.indexLabel("personByAgeAndCity").onV("person").by("age", "city").secondary().ifNotExist().create();
@@ -872,26 +871,27 @@ schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist(
"label": "person",
"input": {
"type": "file",
- "path": "example/vertex_person.csv",
+ "path": "example/file/vertex_person.csv",
"format": "CSV",
"header": ["name", "age", "city"],
- "charset": "UTF-8"
+ "charset": "UTF-8",
+ "skipped_line": {
+ "regex": "(^#|^//).*"
+ }
},
- "mapping": {
- "name": "name",
- "age": "age",
- "city": "city"
- }
+ "null_values": ["NULL", "null", ""]
},
{
"label": "software",
"input": {
"type": "file",
- "path": "example/vertex_software.text",
+ "path": "example/file/vertex_software.txt",
"format": "TEXT",
"delimiter": "|",
"charset": "GBK"
- }
+ },
+ "id": "id",
+ "ignored": ["ISBN"]
}
],
"edges": [
@@ -901,26 +901,27 @@ schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist(
"target": ["target_name"],
"input": {
"type": "file",
- "path": "example/edge_knows.json",
- "format": "JSON"
+ "path": "example/file/edge_knows.json",
+ "format": "JSON",
+ "date_format": "yyyyMMdd"
},
- "mapping": {
+ "field_mapping": {
"source_name": "name",
"target_name": "name"
}
},
{
"label": "created",
- "source": ["aname"],
- "target": ["bname"],
+ "source": ["source_name"],
+ "target": ["target_id"],
"input": {
"type": "file",
- "path": "example/edge_created.json",
- "format": "JSON"
+ "path": "example/file/edge_created.json",
+ "format": "JSON",
+ "date_format": "yyyy-MM-dd"
},
- "mapping": {
- "aname": "name",
- "bname": "name"
+ "field_mapping": {
+ "source_name": "name"
}
}
]
diff --git a/content/en/docs/quickstart/hugegraph-loader.md b/content/en/docs/quickstart/hugegraph-loader.md
index 313110f8..2455e727 100644
--- a/content/en/docs/quickstart/hugegraph-loader.md
+++ b/content/en/docs/quickstart/hugegraph-loader.md
@@ -791,7 +791,7 @@ bin/hugegraph-loader -g {GRAPH_NAME} -f ${INPUT_DESC_FILE} -s ${SCHEMA_FILE} -h
### 4 Complete example
-Given below is an example in the example directory of the hugegraph-loader package.
+Given below is an example in the example directory of the hugegraph-loader package.([GitHub address](https://github.com/apache/hugegraph-toolchain/tree/master/hugegraph-loader/assembly/static/example/file))
#### 4.1 Prepare data
@@ -845,7 +845,6 @@ schema.propertyKey("price").asDouble().ifNotExist().create();
schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create();
schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").ifNotExist().create();
-schema.indexLabel("personByName").onV("person").by("name").secondary().ifNotExist().create();
schema.indexLabel("personByAge").onV("person").by("age").range().ifNotExist().create();
schema.indexLabel("personByCity").onV("person").by("city").secondary().ifNotExist().create();
schema.indexLabel("personByAgeAndCity").onV("person").by("age", "city").secondary().ifNotExist().create();
@@ -868,26 +867,27 @@ schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist(
"label": "person",
"input": {
"type": "file",
- "path": "example/vertex_person.csv",
+ "path": "example/file/vertex_person.csv",
"format": "CSV",
"header": ["name", "age", "city"],
- "charset": "UTF-8"
+ "charset": "UTF-8",
+ "skipped_line": {
+ "regex": "(^#|^//).*"
+ }
},
- "mapping": {
- "name": "name",
- "age": "age",
- "city": "city"
- }
+ "null_values": ["NULL", "null", ""]
},
{
"label": "software",
"input": {
"type": "file",
- "path": "example/vertex_software.text",
+ "path": "example/file/vertex_software.txt",
"format": "TEXT",
"delimiter": "|",
"charset": "GBK"
- }
+ },
+ "id": "id",
+ "ignored": ["ISBN"]
}
],
"edges": [
@@ -897,26 +897,27 @@ schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist(
"target": ["target_name"],
"input": {
"type": "file",
- "path": "example/edge_knows.json",
- "format": "JSON"
+ "path": "example/file/edge_knows.json",
+ "format": "JSON",
+ "date_format": "yyyyMMdd"
},
- "mapping": {
+ "field_mapping": {
"source_name": "name",
"target_name": "name"
}
},
{
"label": "created",
- "source": ["aname"],
- "target": ["bname"],
+ "source": ["source_name"],
+ "target": ["target_id"],
"input": {
"type": "file",
- "path": "example/edge_created.json",
- "format": "JSON"
+ "path": "example/file/edge_created.json",
+ "format": "JSON",
+ "date_format": "yyyy-MM-dd"
},
- "mapping": {
- "aname": "name",
- "bname": "name"
+ "field_mapping": {
+ "source_name": "name"
}
}
]