密码:从集合中提取唯一值 [英] Cypher: Extract unique values from collection
本文介绍了密码:从集合中提取唯一值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有
MATCH (x)-[rels*]->(y)
RETURN extract( r in rels | r.property) as collected
其中,collected
是路径上所有关系的属性的集合,例如[null, 4, null, 4]
或[1, 3, 3, 1]
.
where collected
is a collection of properties of all relationships along the path, such as [null, 4, null, 4]
or [1, 3, 3, 1]
.
如何进一步从collected
中仅提取其唯一值?
例如,[null, 4, null, 4]
会变成[null, 4]
How can I further extract from collected
only its unique values?
For example, [null, 4, null, 4]
would change into [null, 4]
推荐答案
请尝试以下操作:
MATCH (x)-[rels*]->(y)
UNWIND rels AS rel
RETURN COLLECT( distinct rel.property) AS collected
这篇关于密码:从集合中提取唯一值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文