Neo4j Cypher-如何使用Cypher有效地计算多个属性值并正确分页
我正在努力获得正确的密码,既有效又允许通过跳过和限制分页Neo4j Cypher-如何使用Cypher有效地计算多个属性值并正确分页,neo4j,cypher,Neo4j,Cypher,我正在努力获得正确的密码,既有效又允许通过跳过和限制分页 下面是一个简单的场景:我有相关的节点(公司),您可以将与和聚合一起使用,还可以选择映射结果 match (c:Company {id: 'MY.co'})<-[:type_of]-(s:Set)<-[:job_for]-(j:Job) with s, j.Status as Status,count(*) as StatusCount return s.Description, collect([Status,StatusC
下面是一个简单的场景:我有相关的节点(公司),您可以将
与
和聚合一起使用,还可以选择映射结果
match (c:Company {id: 'MY.co'})<-[:type_of]-(s:Set)<-[:job_for]-(j:Job)
with s, j.Status as Status,count(*) as StatusCount
return s.Description, collect([Status,StatusCount]);
match(c:Company{id:'MY.co'})这非常有效!谢谢我曾试图找出如何以这种方式使用collect,但没有成功。这仍然是有效的,并允许对集合进行分页。
s.Description j.Status StatusCount
-------------------+--------------+----------------
Set 1 | Unassigned | 10
Set 1 | Completed | 2
Set 2 | Unassigned | 3
Set 1 | Reviewed | 10
Set 3 | Completed | 4
Set 2 | Reviewed | 7
s.Description Unassigned Completed Reviewed
-------------------+--------------+-------------+----------
Set 1 | 10 | 2 | 10
Set 2 | 3 | 0 | 7
Set 3 | 0 | 4 | 0
match (c:Company {id: 'MY.co'})<-[:type_of]-(s:Set)<-[:job_for]-(j:Job)
with s, j.Status as Status,count(*) as StatusCount
return s.Description, collect({Status:Status,StatusCount:StatusCount]) as StatusCounts;
List<Object> statusMaps = (List<Object>) row.get("StatusCounts");
for(Object statusEntry : statusMaps ) {
Map<String,Object> statusMap = (Map<String,Object>) statusEntry;
String status = (String) statusMap.get("Status");
Number count = statusMap.get("StatusCount");
}
match (c:Company {id: 'MY.co'})<-[:type_of]-(s:Set)<-[:job_for]-(j:Job)
with s, j.Status as Status,count(*) as StatusCount
return s.Description, collect([Status,StatusCount]);
match (c:Company {id: 'MY.co'})<-[:type_of]-(s:Set)<-[:job_for]-(j:Job)
with s, j.Status as Status,count(*) as StatusCount
return s.Description, collect({Status:Status,StatusCount:StatusCount]);