在neo4j上,我有这样一种错误:预期的路径是集合<;路径>;?
我目前正在使用neo4j。我正试图通过neo4j研究图形数据库。为了我的学习,我需要执行一些查询。我对这个问题有个疑问:在neo4j上,我有这样一种错误:预期的路径是集合<;路径>;?,neo4j,cypher,Neo4j,Cypher,我目前正在使用neo4j。我正试图通过neo4j研究图形数据库。为了我的学习,我需要执行一些查询。我对这个问题有个疑问: Match path = (a:Node)-[:Rel1|Rel2*7..8]-(b:Node), (c:Node) Where (a:Node)-[:Rel1|Rel2*7..8]-(b:Node) and (a:Node)-[:Rel1|Rel2*7..8]-(c:Node) and (b:Node)-[:Rel1|Rel2*7..8]-(c:Node) With a
Match path = (a:Node)-[:Rel1|Rel2*7..8]-(b:Node), (c:Node)
Where (a:Node)-[:Rel1|Rel2*7..8]-(b:Node) and (a:Node)-[:Rel1|Rel2*7..8]-(c:Node) and (b:Node)-[:Rel1|Rel2*7..8]-(c:Node)
With a as aa, b as bb, c as cc, (a:Node)-[:Rel1|Rel2*7..8]-(b:Node) as path1,
(a:Node)-[:Rel1|Rel2*7..8]-(c:Node) as path2, (c:Node)-[:Rel1|Rel2*7..8]-(b:Node) as path3
Limit 1
With a as aa, b as bb, c as cc,
path1 as path1, path2 as path2, path3 as path3, Extract(rel in relationships(path1) | rel.id) as relIDs1, Extract(rel in relationships(path2) | rel.id) as relIDs2, Extract(rel in relationships(path3) | rel.id) as relIDs3
Return path1, path2, path3
我对第二条有问题,neo4j在注释这一行时确实返回一条路径(我只需要1条路径“Limit 1”),但当我尝试执行预期路径时,却在摘录上被收集。我如何处理这个问题,我试着查看文档,但我不知道
非常感谢 Neo4j的行为是将数据作为集合返回,即使只有一项。如果返回类型不一致,则会更加混乱,因此这确实是一件好事。只需从集合中获取第一个元素,将其存储在
Path
type变量中,然后继续