nebula插件
# 引入依赖
<dependency>
<groupId>org.ssssssss</groupId>
<artifactId>magic-api-plugin-nebula</artifactId>
<version>magic-api-lastest-version</version>
</dependency>
# 配置
nebula:
hostAddress: ${NEBULA_HOSTADDRESS:localhost:9669}
userName: ${NEBULA_USERNAME:root}
password: ${NEBULA_PASSWORD:nebula}
# 使用
import nebula;
var ngsl =
""""
USE db_name;MATCH p_=(p:`assignee`)-[*3]-(p2:`transferor`) where id(p2) == "阿里巴巴" or id(p)== "阿里巴巴" RETURN p_ limit 1000'
"""
var resultJson = nebula.executeJson(ngsl)
nebula.convert(resultJson)
nebula.executeNebulaModel(ngsl)
其他支持的方法不太常用, 这里不再一一列举, 可参考源码
org.ssssssss.magicapi.nebula.NebulaModule
# 返回的数据格式为:
该结构的数据可被很多前端组件库支持进行可视化展示
{
"code": 0,
"message": "success",
"data": {
"nodes": [
{
"edgeSize": 1,
"assignee.name": "",
"type": "vertex",
"assignee.addr": "",
"assignee.legal_person": "周勇",
"registrant.addr": "",
"registrant.name": "",
"id": "",
"assignee.type": ""
},
{
"edgeSize": 15,
"type": "vertex",
"transferor.name": "",
"transferor.legal_person": "",
"transferor.type": "企业",
"transferor.addr": "",
"registrant.addr": "",
"registrant.name": "",
"id": ""
}, ...
],
"edges": [
{
"dst": "",
"src": "",
"source": "",
"label": "trans_with",
"type": "edge",
"target": "",
"name": "trans_with",
"ranking": 0,
"value": 0
},...
]
},
"timestamp": 1692149280167,
"requestTime": 1692149280143,
"executeTime": 24
}
上次更新: 2023-10-08 07:29:41