簡體   English   中英

Neo4j Cypher排序和模式理解

[英]Neo4j Cypher sorting and pattern comprehension

我有以下Cypher查詢:

MATCH (parentD)-[:CONTAINS]->(childD:Decision)-[ru:CREATED_BY]->(u:User) 
WHERE id(parentD) = 89592 
OPTIONAL MATCH (childD)<-[:SET_FOR]->(sortValue89686:Value)-[:SET_ON]->(sortCharacteristic89686:Characteristic) 
WHERE id(sortCharacteristic89686) = 89686 
WITH ru, u, childD , sortValue89686 
ORDER BY sortValue89686.value ASC, childD.name DESC 
SKIP 0 LIMIT 100 
RETURN ru, u, childD AS decision, 
[ (parentD)<-[:DEFINED_BY]-(entity)<-[:COMMENTED_ON]-(comg:CommentGroup)-[:COMMENTED_FOR]->(childD) | {entityId: id(entity),  types: labels(entity), totalComments: toInt(comg.totalComments)} ] AS commentGroups, 
[ (parentD)<-[:DEFINED_BY]-(c1:Criterion)<-[:VOTED_ON]-(vg1:VoteGroup)-[:VOTED_FOR]->(childD) | {criterionId: id(c1),  weight: vg1.avgVotesWeight, totalVotes: toInt(vg1.totalVotes)} ] AS weightedCriteria, 
[ (parentD)<-[:DEFINED_BY]-(ch1:Characteristic)<-[:SET_ON]-(v1:Value)-[:SET_FOR]->(childD) | {characteristicId: id(ch1),  value: v1.value, valueType: ch1.valueType, visualMode: ch1.visualMode} ] AS valuedCharacteristics

現在,此查詢中的以下部分:

OPTIONAL MATCH (childD)<-[:SET_FOR]->(sortValue89686:Value)-[:SET_ON]->(sortCharacteristic89686:Characteristic) 
WHERE id(sortCharacteristic89686) = 89686 

為return語句中的所有模式理解產生null。 commentGroupsweightedCriteriavaluedCharacteristics不為null,並且僅包含sortValue89686.value不為null的記錄的值。

在此處輸入圖片說明

我希望在上面的屏幕截圖中使用NULL(而不是NULL),即使sortValue89686.value為null,也valuedCharacteristics為行使用value(for commentGroupsweightedCriteriavaluedCharacteristics )。

我在做什么錯以及如何解決?

這似乎是影響Neo4j 3.1.1及以下版本的錯誤的結果(可能是錯誤,或至少與有關)。

我可以使用Neo4j 3.1.1重現您的結果,但不能在Neo4j 3.1.2中重現(無null,結果看起來不錯)。

嘗試升級到3.1.2(尚未將其設置為默認的最新版本,因此請從此處獲取)並嘗試一下。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM