group by - Neo4J: Query to return nodes grouped by relation attributes? -
In my case, nodes are associated with one or more of the relation type Question: 1) What's the query to return the following different groups : 2) Is it possible to write the value of the relationship properties without prior knowledge of this query? what you want to achieve, I suggest that you use the label Can be populated: You can create nodes with label X, Y, Q, P, S and T. You can group results from the following query: for the results. similar in this regard The two attributes are
fldName and
value . For example:
(x) - [r: same {fldName: 'e-mail', value: 'name @ xycom'}] - & gt; (y) (x) - [R: same {fldName: 'phone', value: '123-45-67'}] - & gt; (y) (q) - [r: identical {fldName: 'e-mail', value: 'other @ xycom'}] - gt; (p) (q) - [r: same {fldName: 'phone', value: '891-23-45'}] - & gt; (P) (S) - [R: Like: {FDLNname: 'E-MAIL', Value: 'NEW @xcom'}] - & gt; (T)
group 1: x, y; Number of Relationships: 2 Group 2: Q, P; Number of relationships: 2 group 3: s, t; Number of relationships: 1
merge (: x) - [: same {fldName: 'e-mail', value: 'name @ xycom'}] -> (: y) merge ( : X) - [: same {fldName: 'phone', value: '123-45-67'}] - & gt; (: Y) merge (: q) - [: same {fldName: 'e-mail', value: 'other @xcom'}] - & gt; (: P) Merge (: Q) - [: Same {fldName: 'phone', Value: '891-23-45'}] - & gt; (: P) Merge (: S) - [: Same {FDLNname: 'E-mail', Value: 'neo @ xycom'}] - & gt; (: T)
MATCH x) - [R: identical] -> (Y) Return labels (x), labels (y), count (r) as relCount
Comments
Post a Comment