【问题标题】:Sending parameters to APOC in Cypher Neo4J在 Cypher Neo4J 中向 APOC 发送参数
【发布时间】:2019-01-25 21:06:44
【问题描述】:

我需要在我的 Neo4J Cypher 请求中向 APOC 函数发送多个关系 ID:

PROFILE UNWIND $contexts as cons 
WITH cons 
CALL apoc.index.relationships('TO','context:cons') 
YIELD rel, start, end 
WITH DISTINCT rel, start, end 
WHERE rel.user='15229100-b20e-11e3-80d3-6150cb20a1b9' 
RETURN DISTINCT start.uid AS source_id, start.name AS source_name, end.uid AS target_id, end.name AS target_name, rel.uid AS edge_id, rel.context AS context_id, rel.statement AS statement_id, rel.weight AS weight;

我的参数如下:

{
 "contexts": [
 "09a73400-20ab-11e9-a5b3-9fb3da66a7cb",
 "0113a5c0-1f8f-11e9-9ff3-8379606e6d34",
 "3fb1d040-1f85-11e9-964f-7dc221bb473c",
 "1d0d8ed0-1f85-11e9-964f-7dc221bb473c"
 ]
}

当我像这样发送它们时

 CALL apoc.index.relationships('TO','context:09a73400-20ab-11e9-a5b3-9fb3da66a7cb 0113a5c0-1f8f-11e9-9ff3-8379606e6d34 3fb1d040-1f85-11e9-964f-7dc221bb473c 1d0d8ed0-1f85-11e9-964f-7dc221bb473c')

有效...

如何重写我的上述请求,以便将 id 传递到 APOC 函数中?

【问题讨论】:

    标签: neo4j cypher neo4j-apoc


    【解决方案1】:

    这是一个 Lucene 查询字符串,因此您必须构建它或将其作为参数发送:

    WITH 'context:('+apoc.text.join($contexts,' ')+')' as query
    WITH cons 
    CALL apoc.index.relationships('TO',query) 
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多