英文:
Invalid input F
问题
我正在4.1版本中运行以下Cypher查询,但是我无法理解为什么它会产生错误消息“无效输入'F':预期空格、注释、IF或ON”对于查询CREATE CONSTRAINT n_tester FOR (n:Test) REQUIRE n.Tester IS UNIQUE
。
Cypher查询是否必须分行?我添加了一些\n,但仍然出错了 - 不过这可能是php的json_encode
做了一些奇怪的事情。这个查询的格式有什么问题?
英文:
I am running the following Cypher query in 4.1 and cannot see for the life of me why it is producing the error Invalid input 'F': expected whitespace, comment, IF or ON
for the query CREATE CONSTRAINT n_tester FOR (n:Test) REQUIRE n.Tester IS UNIQUE
.
Do Cypher queries have to be line separated? I added a couple of \n and it still errored - however that could well be php's json_encode
doing something odd. What is wrong with the format of this query?
答案1
得分: 1
版本之间的语法有所变化。对于4.3版本:
CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE
对于4.1版本,文档甚至没有显示约束条件,所以可能在那个版本中不可用。
https://neo4j.com/docs/cypher-manual/4.3/constraints/syntax/
英文:
The syntax changes between versions. For 4.3:
CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE
For 4.1, the documentation doesn't even show constraints, so maybe that's not even available for that version.
https://neo4j.com/docs/cypher-manual/4.3/constraints/syntax/
答案2
得分: 1
注意:Neo4j 4.1 已经在一段时间前达到了生命周期终点,请升级!
一般来说,你可以在这里找到旧版本的文档。
对于 4.1 版本,约束创建语法(根据你的示例进行了调整)如下所示:
CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE
英文:
Note: Neo4j 4.1 has reached End Of Life a while ago, please upgrade!
Generally speaking, you can find documentation for older versions here.
For 4.1, the constraint creation syntax (adapted to your example) is as follows:
CREATE CONSTRAINT n_tester ON (n:Test) ASSERT n.Tester IS UNIQUE
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论