2013-07-04 126 views
0

我打電話給服務方法,我想知道是否有任何節點不存在。我不想運行多個查詢Neo4J Cypher:從部分匹配的索引查詢查詢返回結果

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」是否存在,如果「用戶2」存在,如果存在如下關係。目前,如果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存在?

回答

0

COALESCE(?rec_part.DW_FLAG, 「NULLLLLLLL」) 您可以使用​​3210如下所示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") 
+0

我試過了,它似乎沒有工作,我想知道如果索引查找是問題 –

+0

您可以使用http://console.neo4j.org/創建一個示例 –