-
Notifications
You must be signed in to change notification settings - Fork 2
docs: refactor docs of loader & client for new version(1.7.0) #4
Changes from 1 commit
07213c0
17af21d
86ab30f
d412916
0fc05c9
db852d6
cf8d674
5c53fcd
13ef946
acbfac9
952f68b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,8 @@ HugeGraph-Client 是操作 graph 的总入口,用户必须先创建出 HugeGra | |
| ```java | ||
| // HugeGraphServer 地址:"http://localhost:8080" | ||
| // 图的名称:"hugegraph" | ||
| HugeClient hugeClient = HugeClient.builder("http://localhost:8080", "hugegraph") | ||
| HugeClient hugeClient = HugeClient.builder("http://localhost:8080", | ||
| "DEFAULT", "hugegraph") | ||
sadwitdastreetz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
sadwitdastreetz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .configTimeout(20) // 默认 20s 超时 | ||
| .configUser("**", "**") // 默认未开启用户权限 | ||
| .build(); | ||
|
|
@@ -455,6 +456,63 @@ Edge knows1 = marko.addEdge("knows", vadas, "city", "Beijing"); | |
|
|
||
| **注意:当 frequency 为 multiple 时必须要设置 sortKeys 对应属性类型的值。** | ||
|
|
||
| ### 4 简单示例 | ||
| ### 4 图空间(GraphSpace) | ||
| client支持一个物理部署中多个 GraphSpace,每个 GraphSpace 下可以含多个图(graph)。 | ||
| - 兼容:不指定 GraphSpace 时,默认使用 "DEFAULT" 空间 | ||
|
|
||
| 简单示例见[HugeGraph-Client](/cn/docs/quickstart/client/hugegraph-client) | ||
| #### 4.1 创建GraphSpace | ||
|
|
||
| ```java | ||
| GraphSpaceManager spaceManager = hugeClient.graphSpace(); | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 创建 GraphSpace 的示例代码过于简化: GraphSpaceManager spaceManager = hugeClient.graphSpace();
GraphSpace graphSpace = new GraphSpace();
graphSpace.setName("myGraphSpace");
spaceManager.createGraphSpace(graphSpace);问题:
建议补充完整示例: try {
GraphSpaceManager spaceManager = hugeClient.graphSpace();
// 检查是否已存在
if (spaceManager.getGraphSpace("myGraphSpace") != null) {
System.out.println("GraphSpace already exists");
return;
}
GraphSpace graphSpace = new GraphSpace();
graphSpace.setName("myGraphSpace");
graphSpace.setDescription("Business data graph space");
graphSpace.setMaxGraphNumber(10);
graphSpace.setMaxRoleNumber(100);
spaceManager.createGraphSpace(graphSpace);
System.out.println("GraphSpace created successfully");
} catch (Exception e) {
System.err.println("Failed to create GraphSpace: " + e.getMessage());
}
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这部分有些冗余了,没有必要吧 |
||
| // 定义 GraphSpace 配置 | ||
| GraphSpace graphSpace = new GraphSpace(); | ||
| graphSpace.setName("myGraphSpace"); | ||
| graphSpace.setDescription("Business data graph space"); | ||
| graphSpace.setMaxGraphNumber(10); // 最大图数量 | ||
| graphSpace.setMaxRoleNumber(100); // 最大角色数量 | ||
|
|
||
| // 创建 GraphSpace | ||
| spaceManager.createGraphSpace(graphSpace); | ||
| ``` | ||
| **GraphSpace 接口汇总** | ||
|
|
||
sadwitdastreetz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| | category | interface | description | | ||
| |----------|------------------------|------------------------------------------| | ||
| | 查询 | listGraphSpaces() | 获取所有 GraphSpace 列表 | | ||
| | | getGraphSpace(String name) | 获取指定 GraphSpace | | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | | space.getName() | 获取 GraphSpace 名称 | | ||
| | | space.getDescription() | 获取 GraphSpace 描述信息 | | ||
| | | space.getGraphNumber() | 获取 GraphSpace 下图的数量 | | ||
| | 更新 | getGraphSpace(String name) | 获取指定 GraphSpace | | ||
| | | space.setDescription(String description) | 修改 GraphSpace 描述信息 | | ||
| | | space.setMaxGraphNumber(int maxNumbe) | 设置 GraphSpace 最大图数量 | | ||
| | | updateGraphSpace(String name, GraphSpace space) | 更新 GraphSpace 配置 | | ||
| | 删除 | removeGraphSpace(String name) | 删除指定 GraphSpace | | ||
| | | removeGraphSpace(String name, boolean forc) | 强制删除 GraphSpace(包含所有图数据) | | ||
|
|
||
| #### 4.2 GraphSpace 中的图管理 | ||
|
|
||
| 在 GraphSpace 中,可以管理多个图: | ||
|
|
||
| ```java | ||
| // 在指定的 GraphSpace 中创建图 | ||
| GraphsManager graphsManager = hugeClient.graphs(); | ||
| Graph graph = new Graph(); | ||
| graph.setName("businessGraph"); | ||
| graph.setDescription("Business relationship graph"); | ||
| graphsManager.createGraph("myGraphSpace", graph); | ||
|
|
||
| // 获取 GraphSpace 中的所有图 | ||
| List<Graph> graphs = graphsManager.listGraphs("myGraphSpace"); | ||
|
|
||
|
Comment on lines
+482
to
+491
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 接口表方法名不一致且表格不完整 第 481 行显示
另外,为提高表格清晰度,建议在 GraphSpace 对象方法行中补全 getter 方法列表,并确保所有在示例中出现过的方法都被文档化。 建议修正为: -| Manager - 查询 | listGraphSpace() | 获取所有 GraphSpace 列表 |
+| Manager - 查询 | listGraphSpaces() | 获取所有 GraphSpace 列表 |
| | getGraphSpace(String name) | 获取指定 GraphSpace |
| Manager - 创建/更新 | createGraphSpace(GraphSpace) | 创建 GraphSpace |
| | updateGraphSpace(String, GraphSpace) | 更新配置 |
| Manager - 删除 | removeGraphSpace(String) | 删除指定 GraphSpace |
+| | removeGraphSpace(String name, boolean force) | 强制删除 GraphSpace(包含所有图数据) |
| GraphSpace - 属性 | getName() / getDescription() | 获取名称/描述 |
| | getGraphNumber() | 获取图数量 |
+| | getMaxGraphNumber() / getMaxRoleNumber() | 获取最大图/角色数量 |
| GraphSpace - 配置 | setDescription(String) | 设置描述 |
| | setMaxGraphNumber(int) | 设置最大图数量 |
+| | setMaxRoleNumber(int) | 设置最大角色数量 | |
||
| // 获取指定图 | ||
| Graph businessGraph = graphsManager.getGraph("myGraphSpace", "businessGraph"); | ||
|
|
||
| // 删除图 | ||
| graphsManager.removeGraph("myGraphSpace", "businessGraph"); | ||
| ``` | ||
|
|
||
| ### 5 简单示例 | ||
|
|
||
| 简单示例见[HugeGraph-Client](/cn/docs/quickstart/client/hugegraph-client) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ weight: 1 | |
| <groupId>org.apache.hugegraph</groupId> | ||
| <artifactId>hugegraph-client</artifactId> | ||
| <!-- Update to the latest release version --> | ||
| <version>1.5.0</version> | ||
| <version>1.7.0</version> | ||
| </dependency> | ||
| </dependencies> | ||
| ``` | ||
|
|
@@ -78,7 +78,8 @@ public class SingleExample { | |
|
|
||
| public static void main(String[] args) throws IOException { | ||
| // If connect failed will throw a exception. | ||
| HugeClient hugeClient = HugeClient.builder("http://localhost:8080", | ||
| HugeClient hugeClient = HugeClient.builder("http://127.0.0.1:8080", | ||
| "DEFAULT", | ||
| "hugegraph") | ||
sadwitdastreetz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .build(); | ||
sadwitdastreetz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
@@ -224,8 +225,8 @@ public class BatchExample { | |
| public static void main(String[] args) { | ||
| // If connect failed will throw a exception. | ||
| HugeClient hugeClient = HugeClient.builder("http://localhost:8080", | ||
| "hugegraph") | ||
| .build(); | ||
| "DEFAULT", | ||
| "hugegraph").build(); | ||
sadwitdastreetz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| SchemaManager schema = hugeClient.schema(); | ||
|
|
||
|
|
@@ -348,12 +349,12 @@ public class BatchExample { | |
| } | ||
| ``` | ||
|
|
||
| ### 4.4 运行 Example | ||
| #### 4.4 运行 Example | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Minor: 标题层级调整不一致 在 quickstart 文档中:
问题: 建议:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 为了和之前小节的等级保持一致 |
||
|
|
||
| 运行 Example 之前需要启动 Server, | ||
| 启动过程见[HugeGraph-Server Quick Start](/cn/docs/quickstart/hugegraph-server) | ||
|
|
||
| ### 4.5 详细 API 说明 | ||
| #### 4.5 详细 API 说明 | ||
|
|
||
| 示例说明见[HugeGraph-Client 基本 API 介绍](/cn/docs/clients/hugegraph-client) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在
HugeClient.builder()中新增了 GraphSpace 参数,从:变更为:
问题:
建议: