Neo4j-Cypher节点及其关系
我有以下疑问:Neo4j-Cypher节点及其关系,neo4j,cypher,neo4j-apoc,Neo4j,Cypher,Neo4j Apoc,我有以下疑问: MATCH (dg:DecisionGroup)-[:CONTAINS]->(childD:Decision) WHERE dg.id = {decisionGroupId} MATCH (filterCharacteristic1:Characteristic) WHERE filterCharacteristic1.id = 1 WITH dg, filterCharacteristic1 CALL apoc.index.between(childD,'HAS
MATCH (dg:DecisionGroup)-[:CONTAINS]->(childD:Decision)
WHERE dg.id = {decisionGroupId}
MATCH (filterCharacteristic1:Characteristic)
WHERE filterCharacteristic1.id = 1
WITH dg, filterCharacteristic1
CALL apoc.index.between(childD,'HAS_VALUE_ON',filterCharacteristic1,'(value:(10))') YIELD rel
WITH DISTINCT rel, childD, dg
MATCH (childD)-(rel) // here I need to go further only with 'childD' nodes that have relationship with 'rel'(match `apoc.index.between` predicate)
正如您从上面的查询中所看到的,最后我尝试过滤与rel有关系的childD节点,但我不知道如何用Cypher来描述它。像childD-rel或childD-[rel]这样的东西不起作用并导致错误。请帮助您需要查找匹配模式并比较关系:
...
WITH DISTINCT rel, childD, dg
MATCH (childD)-[tmp]-() WHERE tmp = rel
RETURN rel, child, dg
或者您可以直接比较:
...
WITH DISTINCT rel, childD, dg, startNode(rel) AS sRel, endNode(rel) AS eRel
WHERE (childD)--(sRel) OR (childD)--(eRel)
RETURN rel, child, dg