I have write this query (I'm using Movie DBMS)
MATCH (p) WITH labels(p) as label, count(*) as nCount with collect({label:label, count: nCount}) as nodes
call{
MATCH ()-[relationship]->()
with type(relationship) as r, COUNT(relationship) as rCount
order by rCount desc
return collect({label:r, count: rCount}) as relationships
}
return nodes, relationships
which return this result
[{
"count": 229,
"label": [
"Movie"
]
},
{
"count": 803,
"label": [
"Person"
]
}
]
----------------------------
[{
"count": 1036,
"label": "ACTED_IN"
}
,
{
"count": 266,
"label": "DIRECTED"
}
,
{
"count": 90,
"label": "PRODUCED"
}
,
{
"count": 59,
"label": "WROTE"
}
,
{
"count": 53,
"label": "REVIEWED"
}
,
{
"count": 18,
"label": "FOLLOWS"
}
]
I want to show high level structural view now my requirement is to return source and target
[{
"count": 1036,
"type": "ACTED_IN",
"nodes": [{
"source" : "Movies", // or Can I add id instead of name of the node like "source": "0"
"target" : "Person"
}]
}]
so is there any way I can achieve in cypher query or it is best practices to do in cypher