Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检索具有更多作者且在Neo4j中发表论文的节点_Neo4j_Cypher - Fatal编程技术网

检索具有更多作者且在Neo4j中发表论文的节点

检索具有更多作者且在Neo4j中发表论文的节点,neo4j,cypher,Neo4j,Cypher,我在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

我在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),
我想要一个脚本,它能让作者返回更多发表的论文,在这个例子中是Floris和Atzori。我使用的是Neo4J 3.0.8版本

非常感谢。

编辑:

编辑以正确回答问题的要求:

// 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"}│
└────────────────────┘

你好@gPxl。我已经编辑了我的答案,删除了一个不必要的
WITH
子句。您好,@BrunoPeres,我仍然有一条消息:在创建和匹配之间需要WITH(第156行,第1列(偏移量:6405))“匹配(a:Autor)-[r:is_AUTHOR]>(:Paper)”^我已经编辑了我的答案。请看一看。谢谢,但我有以下消息“在创建和匹配(第155行,第1列(偏移量:6404))”匹配(作者:Autor)-[r:is_author]->(:Paper)“^”@gPxl这是因为您在创建初始数据集的同一脚本中运行查询。如果您单独运行此答案中发布的查询,所有操作都将有效。非常感谢!它起作用了!为什么我要把这些问题分开?@gPxl我想你是在另一个脚本的末尾处理并粘贴这里回答的问题。我可以根据发生错误的那一行(第156行)来假设这一点。这与密码语法的规则有关。如果您真的需要在创建示例数据集的脚本之后运行此查询,您可以使用*MATCH(author:Autor)-[r:IS\u author]->(:Paper)返回author,通过count DESC LIMIT 1将(r)计数为计数顺序,也就是说:在
匹配之前放置一个带*