[英]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。 commentGroups
, weightedCriteria
和valuedCharacteristics
不为null,并且仅包含sortValue89686.value
不为null的记录的值。
我希望在上面的屏幕截图中使用NULL(而不是NULL),即使sortValue89686.value
为null,也valuedCharacteristics
为行使用value(for commentGroups
, weightedCriteria
和valuedCharacteristics
)。
我在做什么错以及如何解决?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.