【问题标题】:Neo4J Cypher: Returning results from partially matched indexed lookup queriesNeo4J Cypher:从部分匹配的索引查找查询返回结果
【发布时间】:2013-07-04 11:32:29
【问题描述】:

我正在调用服务方法,我想知道是否有任何节点不存在。我不想运行多个查询

START l=node:node_auto_index(UserIdentifier = 'USER1'), f=node:node_auto_index(UserIdentifier = 'USER2')
CREATE UNIQUE f-[fo:FOLLOWS]->l
RETURN l, f, fo;

我想向客户端返回有意义的错误消息,告知“USER1”是否存在、“USER2”是否存在以及是否存在以下关系。目前,如果 USER1 或 USER2 不存在,此查询将不返回任何内容。如果他们都这样做,结果很好。如何返回

l = USER1
f = NULL (or equivalent value that will tell me the user doesn't exist)
fo = NULL (or equivalent value that will tell me the user doesn't exist)

如果只有 USER1 存在?

【问题讨论】:

    标签: neo4j cypher


    【解决方案1】:

    合并(rec_part.DW_FLAG?,"NULLLLLLLL") 您可以使用coalesce,如下所示functions-coalesce

    所以,如果你想将它与String 值一起使用,它可能是这样的:

    START l=node:node_auto_index(UserIdentifier = 'USER1'), f=node:node_auto_index(UserIdentifier = 'USER2')
    CREATE UNIQUE f-[fo:FOLLOWS]->l
    RETURN coalesce(l.SOMETHING,"Value doesn't exist")
    

    【讨论】:

    • 这个我试过了,好像不行,我想知道是不是索引查找的问题
    猜你喜欢
    • 2016-04-15
    • 2015-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多