版本

# 图更新接口


# 接口列表

# 1、图实体更新:

# 2、图定义更新:

# 3、基于文件导入


# 添加节点

# 方法

POST

# URL

/api/graph/node/add

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
node_type string 节点类型 * "use"
node_props_list list<map<string,string>> 节点属性 * [{"name":"ezoo"}]

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return add_node_response 添加节点响应结果 * * add_node_response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/add -d '{"db_name":"modelroom1_v3","node_type":"person","node_props_list":[{"reliability":10,"identity":1,"sex":1,"name":"aa","age":10}]}'

# 测试结果

"cost_time" : 0.0018762500000000001,
"fail_index" : 1,
"id_list" :
[
	19
],
"message" : "OK.",
"status" : 0

# 通过节点id删除节点

# 方法

POST

# URL

/api/graph/node/remove

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
id int32_t 节点ID 0 0

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 删除节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/remove -d '{"db_name":"modelroom1_v3","id":19}'

# 测试结果(仅供参考)

"cost_time" : 0.0042541660000000002,
"message" : "OK.",
"status" : 0

# 通过节点id修改节点

# 方法

POST

# URL

/api/graph/node/update

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
id int32_t 节点ID * 0
node_props map<string,string> 节点属性 * {"name":"ezoo"}

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return update_node_response 修改节点响应结果 * * update_node_response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/update -d '{"db_name":"modelroom1_v3","id":20,"node_props":{"sex":1}}'

# 测试结果(仅供参考)

"cost_time" : 0.0024739580000000001,
"id" : 20,
"message" : "OK.",
"status" : 0

# 添加边

# 方法

POST

# URL

/api/graph/edge/add

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_type string 边类型 * "eat"
src_node_id_list vector<node_id> 起点ID * * node_id
dest_node_id_list vector<node_id> 终点ID * * node_id
edge_props_list vector<map<string,string>> 边属性 * [{"name":"name"}]

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return add_edge_response 添加边响应结果 * * add_edge_response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/add -d '{"db_name":"modelroom1_v3",
"edge_type":"use","src_node_id_list":[{"node_type":"person","node_index_props":{"identity":2}}],"dest_node_id_list":[{"node_type":"person","node_index_props":{"identity":3}}],"edge_props_list":[{"lasttime":1}]}'

# 测试结果(仅供参考)

"cost_time" : 0.01517275,
"fail_index" : 1,
"id_list" :
[
	{
		"dest_node_id" : 21,
		"edge_id" : 0,
		"edge_type" : "use",
		"src_node_id" : 20
	}
],
"message" : "OK.",
"status" : 0

# 通过边id删除边

# 方法

POST

# URL

/api/graph/edge/remove

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_id edge_basic_id 边的基础信息 * * edge_basic_id

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 删除边响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/remove -d '{"db_name":"modelroom1_v3","edge_id":{"dest_node_id" : 21,"edge_id": 0,"edge_type" : "use","src_node_id" : 20}}'

# 测试结果(仅供参考)

"cost_time" : 0.012741083,
"message" : "OK.",
"status" : 0

# 删除起终点之间的所有边

# 方法

POST

# URL

/api/graph/edge/remove/all

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
src_node_id int32_t 起始节点ID * 1
dest_node_id int32_t 终点节点ID * 2
type string 边类型 * "use"

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 删除边响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/remove/all -d '{"db_name":"modelroom1_v3","src_node_id":20,"dest_node_id":21,"type":"use"}'

# 测试结果(仅供参考)

"cost_time" : 0.0126975,
"message" : "OK.",
"status" : 0

# 通过边id修改边

# 方法

POST

# URL

/api/graph/edge/update

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_id edge_basic_id 边的基础信息 * * edge_basic_id
node_props map<string,string> 边属性 * {"name":"ezoo"}

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return update_edge_response 修改边响应结果 * * update_edge_response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/update -d '{"db_name":"modelroom1_v3","edge_id":{"dest_node_id" : 21,"edge_id": 0,"edge_type" : "use","src_node_id" : 20},"edge_props":{"lasttime":2}}'

# 测试结果(仅供参考)

"cost_time" : 0.01101775,
"id" :
{
	"dest_node_id" : 21,
	"edge_id" : 0,
	"edge_type" : "use",
	"src_node_id" : 20
},
"message" : "OK.",
"status" : 0

# 添加节点定义属性

# 方法

POST

# URL

/api/graph/node/add/property

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
node_type string 节点类型 * "user"
name string 属性名称 * "age"
type string 属性类型 * "int" 数据类型说明
default_value string 默认值 * "0"
cache_level int32_t 是否启用内存加速 * 0

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/add/property -d '{"db_name":"modelroom1_v3","node_type":"person","name":"character","type":"string","default_value":"cheerful","cache_level":0}'

# 测试结果(仅供参考)

"cost_time" : 0.51193429199999996,
"message" : "OK.",
"status" : 0

# 删除节点定义属性

# 方法

POST

# URL

/api/graph/node/remove/property

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
node_type string 节点类型 * "user"
name string 属性名称 * "age"

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/remove/property -d '{"db_name":"modelroom1_v3","node_type":"person","name":"character"}'

# 测试结果(仅供参考)

"cost_time" : 0.54063483300000004,
"message" : "OK.",
"status" : 0

# 添加边定义属性

# 方法

POST

# URL

/api/graph/edge/add/property

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_type string 边类型 * "eat"
name string 属性名称 * "age"
type string 属性类型 * "int" 数据类型说明
default_value string 默认值 * "0"
cache_level int32_t 是否启用内存加速 * 0

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/add/property -d '{"db_name":"modelroom1_v3","edge_type":"use","name":"category","type":"string","default_value":"c","cache_level":0}'

# 测试结果(仅供参考)

"cost_time" : 0.59336970899999997,
"message" : "OK.",
"status" : 0

# 删除边定义属性

# 方法

POST

# URL

/api/graph/edge/remove/property

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_type string 边类型 * "eat"
name string 属性名称 * "food"

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/remove/property -d '{"db_name":"modelroom1_v3","edge_type":"use","name":"category"}'

# 测试结果(仅供参考)

"cost_time" : 0.58973562499999999,
"message" : "OK.",
"status" : 0

# 新增节点类型

# 方法

POST

# URL

/api/graph/node/add/type

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
node_type string 节点类型 * "person"
indexes vector<index> 唯一索引 * * index
props vector<map<string,string>> 节点属性 * [{"name":"identity", "type":"string"}]

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/add/type -d '{"db_name":"modelroom1_v3","node_type":"wifi_1", "indexes": [{ "name": "mac","type": "unique","props": ["mac"]}],"props": [{"name": "mac","type": "string","default_value": "","cache_level": 0},{"name": "reliability","type": "int","default_value": "30","cache_level": 1},{"name": "category","type": "string","default_value": "","cache_level": 1}]}'

# 测试结果(仅供参考)

"cost_time" : 1.9767995,
"message" : "OK.",
"status" : 0

# 新增边类型

# 方法

POST

# URL

/api/graph/edge/add/type

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_type string 边类型 * "eat"
indexes vector<index> 唯一索引 * * index
props vector<map<string,string>> 边属性 * [{"name":"lasttime", "type":"int"}]

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/add/type -d '{"db_name":"modelroom1_v3","edge_type":"belong_1", "indexes": [{"name": "lasttime","type": "unique","props": ["lasttime"]}],"props": [{"name": "lasttime","type": "int","default_value": "0","cache_level": 1}]}'

# 测试结果(仅供参考)

"cost_time" : 1.062473292,
"message" : "OK.",
"status" : 0

# 删除节点类型及相关数据

# 方法

POST

# URL

/api/graph/node/remove/type

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
node_type string 节点类型 * "eat"

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/remove/type -d '{"db_name":"modelroom1_v3","node_type":"wifi_1"}'

# 测试结果(仅供参考)

"cost_time" : 2.0819810419999998,
"message" : "OK.",
"status" : 0

# 删除边类型及相关数据

# 方法

POST

# URL

/api/graph/edge/remove/type

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 * "ezoo"
edge_type string 边类型 * "use"

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 修改节点响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/remove/type -d '{"db_name":"modelroom1_v3","edge_type":"belong_1"}'

# 测试结果(仅供参考)

"cost_time" : 0.98003720800000005,
"message" : "OK.",
"status" : 0

# 通过文件导入节点信息

# 方法

POST

# URL

/api/graph/node/import/file

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 "" "ezoo"
node_type string 节点类型 "" "person"
props vector<map<string,string>> 属性 [] [{"name": "name", "column": 0}]
path string 数据文件路径 "" "./person.csv"
file_type string 文件格式 "" "csv"

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 获取数据库状态响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/node/import/file -d '{"db_name":"modelroom1_v3","node_type":"person","props": [{"name": "reliability","column": 5},{"name": "name","column": 0},{"name": "sex","column": 1},{"name": "age","column": 2},{"name": "identity","column": 4}],"path":"/Users/data/loadtest/person.csv","file_type":"csv"}'

# 测试结果(仅供参考)

"cost_time" : 0.39253220799999999,
"message" : "OK.",
"status" : 0

# 通过文件导入边的信息

# 方法

POST

# URL

/api/graph/edge/import/file

# 参数

参数列表 类型 描述 是否可空 默认值 示例 备注
db_name string 数据库名称 "" "ezoo"
edge_type string 边类型 "" "use"
props vector<map<string,string>> 属性 [] [{"name": "name", "column": 0}]
path string 数据文件路径 "" "./use.csv"
file_type string 文件格式 "" "csv"
start_node unique_node 起点ID对应的文件列 * * unique_node
end_node unique_node 终点ID对应的文件列 * * unique_node

# 返回值

参数列表 类型 描述 是否可空 默认值 示例 备注
_return Response 获取数据库状态响应结果 * * Response

# 测试用例

curl -X POST -H "Content-Type: application/json" 127.0.0.1:9898/api/graph/edge/import/file -d '{"db_name":"modelroom1_v3","edge_type":"use","props": [{"name": "lasttime","column": 0}],"path":"/Users/data/loadtest/use.csv","file_type":"csv","start_node":{"type":"person","unique":[{"name":"identity","column":1}]},"end_node":{"type":"person","unique":[{"name":"identity","column":2}]}}'

# 测试结果(仅供参考)

"cost_time" : 0.196264459,
"message" : "OK.",
"status" : 0

最近一次更新时间: 9/15/2022, 3:46:39 AM