spring - 从 Neo4j 接收 JSON 数据到 Spring Boot API
问题描述
我正在尝试将数据从 Neo4J 发送到 Spring boot,并且我想收到这样的 JSON:
{
"name": "Alex Statham",
"people": [
{
"name": "Jason Statham",
"people": [
{
"name": "Lyna Statham"
},
{
"name": "John Statham"
}
]
},
{
"name": "Will Statham",
"people": [
{
"name": "Michael Statham"
}
]
}
]
}
我尝试了很多查询,这可能是最好的查询,它为所有情况返回正确的家谱,但它只返回没有关系的节点,所以我不能把这些数据放到我使用的库中:
MATCH (p1:Person {maBN:3})
CALL apoc.path.subgraphNodes(p1, {
sequence: '>Person,FCHILD,>Person,FCHILD,>Person',
maxLevel: 6
}) YIELD node
RETURN node, p1
这是那个库:https ://www.npmjs.com/package/react-tree-graph
我应该怎么办?我对 Cypher 和 Neo4j 不太了解。
解决方案
您可以使用 apoc.convert.toTree 获取路径列表并创建像您这样的结构。
推荐阅读
- azure-devops - 重命名 Azure DevOps 托管代理
- c++ - 我需要帮助来制作 if (*(char*)
- javascript - 从 API 检索数据时,React 钩子有什么问题
- excel-formula - 根据信息表为公司创建多个 HTML 电子邮件签名
- wordpress - 无法激活 Wordpress 插件:您的网站出现严重错误
- javascript - 如何使用 Jquery 剥离 HTML 元素及其内部文本
- java - 谁在 Spring DynamicRegistrationBean 上调用 onStartup(ServletContext) 方法
- c# - C# Excel.Interop 问题
- dart - 可迭代的飞镖组
- workday-api - Workday 是否有任何 API 可以将任务发送到员工收件箱?