Neo4j仅查询子图

时间:2018-08-09 12:55:28

标签: neo4j cypher subgraph

我正在尝试仅查询较大Graph的子图。我想匹配一个在子图中没有关系但在整个图中有关系的特定节点。

Match (a:PlanningGroup{displayname:"PGr6"})-[:input]->(b:PlanningStep)
where not (b)<-[:belongs]-(:ExecutionStep)
with b
Match(b)
where not (b)<-[:next]-()
return b

在示例中,我过滤掉了已经执行的所有步骤。然后,我尝试给出一个带有“ with”语句的子图,并匹配尚未执行的第一步。在子图中表示没有传入的下一个关系。但是查看完整的图形,它会从已经执行的步骤中产生一个传入的下一个关系。 有什么办法只能查询此子图而忽略整个图的关系吗?

编辑

CREATE
(aps9 :PlanningStep {id:9, type:"seperating" ,workInstructions:"relation to instruction node", displayname:"PS9", modeltype:"planning", ResponsibleApp:"CPTool"}) ,
(aps10 :PlanningStep {id:10, type:"process" ,workInstructions:"relation to instruction node", displayname:"PS10", modeltype:"planning", ResponsibleApp:"CPTool"}) ,
(aps11 :PlanningStep {id:11, type:"process" ,workInstructions:"relation to instruction node", displayname:"PS11", modeltype:"planning", ResponsibleApp:"CPTool"}) ,
(aps12 :PlanningStep {id:12, type:"process" ,workInstructions:"relation to instruction node", displayname:"PS12", modeltype:"planning", ResponsibleApp:"CPTool"}) ,
(aps13 :PlanningStep {id:13, type:"process" ,workInstructions:"relation to instruction node", displayname:"PS13", modeltype:"planning", ResponsibleApp:"CPTool"}) ,


(pg5 :PlanningGroup {id:5, MaterialCount:"1", MaterialType:"module", workInstructions:"relation to instruction node", displayname:"PGr6", modeltype:"planning", ResponsibleApp:"CPTool"}) ,

(aps9)-[:`next` {modeltype:"planning", ResponsibleApp:"CPTool"}]->(aps10),
(aps10)-[:`next` {modeltype:"planning", ResponsibleApp:"CPTool"}]->(aps11),
(aps11)-[:`next` {modeltype:"planning", ResponsibleApp:"CPTool"}]->(aps12),
(aps12)-[:`next` {modeltype:"planning", ResponsibleApp:"CPTool"}]->(aps13),

(opr1 :ExecutionStep {id:1,dateTime:'2016-11-12 10:02:02',modeltype:"execution", type:"seperating", displayname:"ES-9", ResponsibleApp:"MaterialTracker"}) ,
(opr1)-[:`belongs` {modeltype:"execution", ResponsibleApp:"MaterialTracker"}]->(a)

我省略了输入关系,但是我认为这与这里的情况无关。所以基本上我想找到没有附加Executionsep的第一步。

0 个答案:

没有答案