2013-10-03 79 views
0

我更新了與屬性Expirydate的關係。我想排除遍歷路徑中的所有過期關係。查詢條件是通過路徑中的所有關係檢查Expirydate。我得到的錯誤:Neo4j Cypher查詢多個關係的屬性

==> SyntaxException: ==> ==> Think we should have better error message here? Help us by sending this query to [email protected]

下面是該查詢:

START sNode=node(530) 
MATCH sNode-[r:hasRegisteredPlate|inHouseHoldWith*1..2]->eNode 
WHERE eNode.NodeType = "Plate" and (rel in r:(not has(rel.ExpiryDate) or 
    (has(rel.ExpiryDate) and (rel.ExpiryDate<>'' or rel.ExpiryDate >'2013-10-04')))) 
RETURN eNode LIMIT 20 

任何幫助深表感謝

回答

0

你可以嘗試使用謂詞all

START sNode=node(530) 
MATCH sNode-[r:hasRegisteredPlate|inHouseHoldWith*1..2]->eNode 
WHERE eNode.NodeType = "Plate" and all(rel in r 
    WHERE (not(has(rel.ExpiryDate)) or (has(rel.ExpiryDate) and (rel.ExpiryDate<>'' or rel.ExpiryDate>'2013-10-04'))) 
) 
RETURN eNode LIMIT 20 

您也可以嘗試反向

WHERE eNode.NodeType = "Plate" and none(rel in r 
    WHERE (has(rel.ExpiryDate) and rel.ExpiryDate<'2013-10-04') 
) 

請注意,我沒有嘗試過這些,如果他們不也許你可以設置在neo4j console樣本圖工作。