apoc.path.subgraphAll 不返回图形 [英] apoc.path.subgraphAll Doesn't Return a Graph

查看:46
本文介绍了apoc.path.subgraphAll 不返回图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据重复模式可视化图形,而 apoc.path.subgraphAll 似乎是要使用的东西.

I'm trying to visualise a graph based on a repeated pattern and apoc.path.subgraphAll seems to be the thing to use.

随着查询:

MATCH (av:Architecture_View {`view identifier`:'SV-01'})
//pattern is (Architecture_View)-[:SUPPLIES]->(Architecture_Description_Tuple)-[:`SUPPLIED TO`]->(Architecture_View)
CALL apoc.path.subgraphAll(av,{
beginSequenceAtStart: true,
sequence: "`SUPPLIES`>,Architecture_Description_Tuple,`SUPPLIED TO`>,Architecture_View"})
YIELD nodes, relationships
RETURN nodes, relationships;

我只是得到了返回的起始节点 (av).不会返回任何错误.

I simply get the start node (av) returned. No errors are returned.

如果我只是手动运行一个查询来迭代这个模式一次

If I simply manually run a query to iterate this pattern once

MATCH r=(av:Architecture_View {`view identifier`:'SV-01'})-[:SUPPLIES]-(adt:Architecture_Description_Tuple)-[:`SUPPLIED TO`]->(av2:Architecture_View)
RETURN r

我得到了预期的图表.

返回 apoc.path.subgraphAll 结果或序列定义的语句中的方式是否有问题?

Is there somethng wrong with the way in the statement which returns the apoc.path.subgraphAll result or the sequence definition?

推荐答案

如果您指定 beginSequenceAtStart,则您提供的序列模式必须包含起始节点.在您的情况下,起始模式从起始节点外的第一个关系开始.

If you're specifying beginSequenceAtStart, the sequence pattern that you supply must include the starting node. In your case, the starting pattern begins from the first relationship out of the starting node.

例如,给定以下测试数据:

For example, given the following test data:

MERGE (a: View { id: 1 })-[:SUPPLIES]->(b: DescriptionTuple { desc: 'description' })-[:SUPPLIED_TO]->(a2: View {id: 2 })

以下两个查询都将返回连接 aa2 的子图 - 注意 beginSequenceAtStart 和序列字符串的初始块是如何不同的在两种情况下:

The following two queries will both return subgraph connecting a to a2 - notice how beginSequenceAtStart and the initial chunk of the sequence string are different in the two cases:

// beginSequenceAtStart false, start with the first relationship type
MATCH (a: View { id: 1 })
CALL apoc.path.subgraphAll(a, {
  beginSequenceAtStart: false,
  sequence: "SUPPLIES>,DescriptionTuple,SUPPLIED_TO>,View"
})
YIELD nodes, relationships
RETURN nodes, relationships

// beginSequenceAtStart true, begin with the first node label
MATCH (a: View { id: 1 })
CALL apoc.path.subgraphAll(a, {
  beginSequenceAtStart: true,
  sequence: "View,SUPPLIES>,DescriptionTuple,SUPPLIED_TO>,View"
})
YIELD nodes, relationships
RETURN nodes, relationships

这篇关于apoc.path.subgraphAll 不返回图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆