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 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)   

Question:

1) What's the query to return the following different groups :

  group 1: x, y; Number of Relationships: 2 Group 2: Q, P; Number of relationships: 2 group 3: s, t; Number of relationships: 1   

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:

  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)   

You can create nodes with label X, Y, Q, P, S and T.

You can group results from the following query:

  MATCH x) - [R: identical] -> (Y) Return labels (x), labels (y), count (r) as relCount   

for the results.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -