Neo4j 在cypher中将连续的匹配链接在一起

Neo4j 在cypher中将连续的匹配链接在一起,neo4j,cypher,Neo4j,Cypher,我有一组作者和一组文章。它们使用[:writed]关系进行关联。一篇文章可以有一个或多个作者,一个作者可以写一篇或多篇文章 我想知道在前十名的文章中,有多少篇文章的作者是最有效率的作者 我可以使用 MATCH (author:Author)-[:WROTE]->(article:Article) WITH author, COUNT(article) as numberofarticles, collect(article) as articles ORDER BY numberofar

我有一组作者和一组文章。它们使用[:writed]关系进行关联。一篇文章可以有一个或多个作者,一个作者可以写一篇或多篇文章

我想知道在前十名的文章中,有多少篇文章的作者是最有效率的作者

我可以使用

MATCH (author:Author)-[:WROTE]->(article:Article) 
WITH author, COUNT(article) as numberofarticles, collect(article) as articles
ORDER BY numberofarticles DESC LIMIT 1
RETURN author, numberofarticles, EXTRACT(n in articles | n.title) AS extracted
同样地,我可以找到作者使用的前10篇文章

MATCH (author:Author)-[:WROTE]->(article:Article) 
WITH article, COUNT(author) as numberofauthors
ORDER BY numberofauthors DESC LIMIT 10
RETURN article.title, numberofauthors
然而,我被困在这里。因为匹配是一样的,我想创建两个集合,作者集合和文章集合

MATCH (author:Author)-[:WROTE]->(article:Article)
WITH collect(author) as authors, COUNT(author) as numberofauthors, collect(article) as toparticles, COUNT(article) as numberofarticles
但现在,我一直在整理收藏,按作者数和文章数分别查找前10名和前10名。我尝试了很多不同的方法,但我没有更进一步。任何帮助都将不胜感激

尊敬的Richard我想这会有用的:

MATCH (author:Author)-[:WROTE]->(article:Article)
WITH author, count(article) ORDER BY count(article) DESC
WITH collect(author)[0] AS top_author

MATCH (article:Article)<-[:WROTE]-(author:Author)
WITH top_author, article, count(author) ORDER BY count(author) DESC
WITH top_author, collect(article)[0..10] AS top_10_article

MATCH top_author-[rel:WROTE]->top_10_article
RETURN count(rel)
匹配(作者:作者)-[:编写]->(文章:文章)
对于作者,按计数(文章)描述计数(文章)顺序
以collect(author)[0]作为顶级作者
匹配(文章:文章)排名前10的文章
返回计数(rel)

很遗憾,它不起作用<代码>匹配(文章:文章)