我在Neo4J中有以下脚本
CREATE (PaperA:Paper {title:'User Experience of Mobile Augmented
Reality: A Review of Studies'}) CREATE (Irshad:Autor {name:'S.
Irshad'}) CREATE (Rambli:Autor {name:'D. Rohaya Bt Awang Rambli'})
CREATE(PaperB:Paper {title:'Quality of Experience in the Multimedia
Internet of Things: definition and practical use cases'})
CREATE(Floris:Autor {name:'A. Floris'}) CREATE(Atzori:Autor {name:'L.
Atzori'})
CREATE(PaperC:Paper {title:'What Changes from Ubiquitous Computing to
Internet of Things in Interaction Evaluation?'}) CREATE(Andrade:Autor
{name:'Andrade, R. M.'}) CREATE(Carvalho:Autor {name:'Carvalho, R.
M.'}) CREATE(deAraújo:Autor {name:'de Araújo, I. L.'})
CREATE(Oliveira:Autor {name:'Oliveira, K. M.'}) CREATE(Maia:Autor
{name:'Maia, M. E'})
CREATE(PaperD:Paper {title:'A QoE-aware Approach for Smart Home Energy
Management'}) CREATE(Meloni:Autor {name:'Meloni, A'})
CREATE(Pilloni:Autor {name:'Pilloni, V.'})
(Irshad)-[:IS_AUTHOR]->(PaperA), (Rambli)-[:IS_AUTHOR]->(PaperA),
(Floris)-[:IS_AUTHOR]->(PaperB), (Floris)- [:IS_AUTHOR] -> (PaperD),
(Floris)- [:IS_AUTHOR] -> (PaperH), (Atzori)-[:IS_AUTHOR]->(PaperB),
(Atzori)- [:IS_AUTHOR] -> (PaperD), (Atzori)- [:IS_AUTHOR] ->
(PaperH), (Meloni)-[:IS_AUTHOR]->(PaperD),
(Pilloni)-[:IS_AUTHOR]->(PaperD), (Andrade)-[:IS_AUTHOR]->(PaperC),
(Carvalho)-[:IS_AUTHOR]->(PaperC), (deAraújo)-[:IS_AUTHOR]->(PaperC),
(Oliveira)-[:IS_AUTHOR]->(PaperC), (Maia)-[:IS_AUTHOR]->(PaperC),我想要一个剧本,以返回作者更多已发表的论文,在本例中是弗洛里斯和阿佐里。我使用的是Neo4J 3.0.8版本。
非常感谢。
发布于 2017-10-03 16:28:06
编辑:
编辑以正确回答问题的要求:
// First step: getting the greatest number of publications by author
MATCH(author:Autor)-[r:IS_AUTHOR]->(:Paper)
WITH author, count(r) as count
ORDER BY count DESC LIMIT 1
// Second step: getting all author who have number
// of publications equals to `count`
MATCH (a:Autor)-[r:IS_AUTHOR]->(p:Paper)
WITH a, count, count(r) AS r WHERE r = count
RETURN a产出如下:
╒════════════════════╕
│"a" │
╞════════════════════╡
│{"name":"A. Floris"}│
├────────────────────┤
│{"name":"L. Atzori"}│
└────────────────────┘https://stackoverflow.com/questions/46549104
复制相似问题