Function distinct()
deduplicates a data column, which should make the data column shorter than before. Those homologous columns will either be affected by the deduplication process when the function is called in a WITH clause, or not be affected when called in a RETURN clause.
Arguments:
- Any value <any>, auto-abstraction: UUID of NODE/EDGE
Returns:
- Deduplicated value <any>
ATTR (Numeric value)
Example: find 10 @transfer
edges, deduplicate the year of transfer time and return results
find().edges({@transfer}) as e
limit 10
return distinct(year(e.time))
ATTR (String)
Example: find 10 nodes, deduplicate their schema and return results
find().nodes([1,2,3,4,5,6,7,8,9,10]) as n
return distinct(n.@)
ATTR (Time)
Example: find cards, deduplicate dates of opening cards and return results
find().nodes({@card}) as n
return distinct(n.open_date)
NODE
Example: find 3-step transfer paths outbound from Card CA001, deduplicate the 3rd transfer edges and return results
n({_id == "CA001"}).re({@transfer})[2].n({@card})
.re({@transfer} as e).n({@card})
return distinct(e)
ARRAY
Example: find 2-step transfer paths outbound from Card CA001, combine the nodes in the path into an array and deduplicate before return results
n({_id == "CA001"}).re({@transfer})[2].n({@card}) as p
return distinct(pnodes(p))