Neo4j 将多个apoc.path.expand调用合并为一个

Neo4j 将多个apoc.path.expand调用合并为一个,neo4j,cypher,Neo4j,Cypher,我有几个密码调用,返回连接到我的节点的特定类型(a、B或C)的节点计数 MATCH (n {{ID:"{id}"}}) call apoc.path.expand(n, "<", ">A", 1, 10) yield path as p return count(distinct nodes(p)[-1]) MATCH (n {{ID:"{id}"}}) call apoc.path.expand(n, "<", ">B",

我有几个密码调用,返回连接到我的节点的特定类型(
a
B
C
)的节点计数

MATCH (n {{ID:"{id}"}})
        call apoc.path.expand(n, "<", ">A", 1, 10) yield path as p
        return count(distinct nodes(p)[-1])
MATCH (n {{ID:"{id}"}})
        call apoc.path.expand(n, "<", ">B", 1, 10) yield path as p
        return count(distinct nodes(p)[-1])
MATCH (n {{ID:"{id}"}})
        call apoc.path.expand(n, "<", ">C", 1, 10) yield path as p
        return count(distinct nodes(p)[-1])
MATCH(n{{ID:{ID}})
将(n,“A”,1,10)屈服路径称为p
返回计数(不同节点(p)[-1])
匹配(n{ID:{ID}})
将(n,“B”,1,10)屈服路径称为p
返回计数(不同节点(p)[-1])
匹配(n{ID:{ID}})
将apoc.path.expand(n,“C”,1,10)屈服路径称为p
返回计数(不同节点(p)[-1])

三次打这些电话是浪费时间的,我想知道我是否可以把它们合并成一个,但仍然可以得到所有三个电话的不同计数。像这样的事情能帮你完成吗

MATCH (n {{ID:"{id}"}})
CALL apoc.path.expand(n, "<", ">A,>B,>C", 1, 10) yield path as p
RETURN labels(last(nodes(p)))[0] AS label, count(distinct nodes(p)[-1])
MATCH(n{{ID:{ID}})
将(n,“A,>B,>C”,1,10)的屈服路径扩展为p
返回标签(最后一个(节点(p)))[0]作为标签,计数(不同的节点(p)[-1])