简体   繁体   English

Neo4j:语法错误

[英]Neo4j : Syntax Error

Neo4j query for movie database NOT in Query Neo4j - NOT IN query Neo4j查询电影数据库不在查询Neo4j-不查询

MATCH (actor:Actor {name:"Tom Hanks"} )-[:ACTED_IN]->(movies)<-[:ACTED_IN]-(coactor)
WITH collect(distinct coactor) as coactors
MATCH (actor:Actor)
WHERE actor NOT IN coactors
RETURN actor

While running this query I got Error: 运行此查询时出现错误:

Invalid input 'N': expected whitespace, comment, node labels, MapLiteral, a parameter, a relationship pattern, '(', '.', '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, RETURN, UNION, ';' or end of input (line 4, column 13 (offset: 160)) "WHERE actor NOT IN coactors" 输入'N'无效:预期的空格,注释,节点标签,MapLiteral,参数,关系模式,'(','。','[',“ =〜”,IN,STARTS,ENDS,CONTAINS,IS, '^','*','/','%','+','-','=',“ <>”,“!=”,'<','>',“ <=” ,“> =”,AND,XOR或OR,加载CSV,START,MATCH,UNWIND,MERGE,CREATE,SET,DELETE,EXMOVE,FOREACH,WITH,RETURN,UNION,“;”或输入结尾(第4行,第13栏(偏移量:160))“ WHERE actor NOT in coactors”

I believe that's a small mistake in their example query. 我相信这是他们示例查询中的一个小错误。

WHERE actor NOT IN ...

is incorrect syntax (though I wouldn't mind a Cypher update to allow it). 是不正确的语法(尽管我不介意进行Cypher更新)。 It should be 它应该是

WHERE NOT actor IN ...

InverseFalcon has the correct answer, but note that the parser tells you exactly where the error is: line 4, column 13. InverseFalcon的答案正确,但是请注意,解析器会准确告诉您错误出在哪里:第4行,第13列。

WHERE actor NOT IN coactors
            ^

It also tells you what can be expected at that point (including IN ), and that doesn't include NOT . 它还告诉您那时可以期待什么(包括IN ),而其中不包括NOT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM