Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.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,我有下面的图表 如您所见,该图显示了以下关系: (u::4)-[添加的资源]->(:资源)(u::3) 我使用APOC遍历图形,如下所示: MATCH (u:user {id:"u::1"} CALL apoc.path.expandConfig(u,{minLevel:1,maxLevel:6,bfs:true,uniqueness:"NODE_PATH",labelFilter:">resource"}) YIELD path with u, path, filter(n in no

我有下面的图表

如您所见,该图显示了以下关系:

  • (u::4)-[添加的资源]->(:资源)(u::3)

  • 我使用APOC遍历图形,如下所示:

    MATCH (u:user {id:"u::1"}
    CALL apoc.path.expandConfig(u,{minLevel:1,maxLevel:6,bfs:true,uniqueness:"NODE_PATH",labelFilter:">resource"}) YIELD path
    with u, path, filter(n in nodes(path) where n:resource) as resources
    unwind resources as resource
    MATCH (rus:user)-[]->(resource)
    RETURN distinct rus.id
    
    这将返回通过其相关资源与节点
    u::1
    相关的所有
    u::X
    节点

    由于
    u::4
    u::3
    未链接,我希望遍历忽略该连接,而不返回与
    u::3
    相关的子图。因此,它不应该返回
    u::4,u::3,u::2,u::5
    ,而应该只返回
    u::4


    有没有办法告诉APOC在遍历时忽略它们之间具有某种关系的节点?

    我认为APOC.path.expandConfig不允许您忽略关系类型列表,但它将遵循正向表达的关系类型。它还可以选择使用
    说明订单

    MATCH (u:user {id:"u::1"}
    CALL apoc.path.expandConfig(u
      {
        minLevel:1,
        maxLevel:6,
        bfs:true,
        uniqueness:"NODE_PATH",
        labelFilter:">resource",
    
        // add relationship filter to folow only relationships that are included
        relationshipFilter: 'ADDED_RESOURCE|OTHER_TYPE|...'
    }) YIELD path
    with u, path, filter(n in nodes(path) where n:resource) as resources
    UNWIND resources as resource
    MATCH (rus:user)-[]->(resource)
    RETURN distinct rus.id
    

    谢谢,但是如果我想同时维护
    取消链接
    添加的资源
    链接,我会遇到问题。无论
    取消链接
    关系如何,它仍将返回所有已连接的用户。