Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j-Cypher节点及其关系_Neo4j_Cypher_Neo4j Apoc - Fatal编程技术网

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