我对 Py2neo 的 Neo4j 查询有什么问题?

What is wrong with my Neo4j query for Py2neo?

这是我对 Neo4j 数据库的 Py2neo 的查询

MATCH (u:User),(p:Prize),(ca:Category) CREATE (ch:Challenge {chid:'dassdshhhhasdasda',challenge_title:'Exm 2015', total_question_per_user:200,challenge_status:1,timestamp:'1471516538.4643',date:'2016-08-18'}), (p)-[:BELONG {rank:3}]->(ch),(ca)-[:BELONG {percentage_question:20}]->(ch) WHERE u.username = 'xyz@gmail.com' AND p.pid = 'e766d8cd-26d1-4848-ac97-15c233caa4d4' AND ca.catname = 'nature'

但是当我在 Neo4j 数据库命令行中手动 运行 它时它显示错误

Invalid input 'H': expected 'i/I' (line 1, column 287 (offset: 286))
"MATCH (u:User),(p:Prize),(ca:Category) CREATE (ch:Challenge {chid:'dassdshhhhasdasda',challenge_title:'Exm 2015', total_question_per_user:200,challenge_status:1,timestamp:'1471516538.4643',date:'2016-08-18'}), (p)-[:BELONG {rank:3}]->(ch),(ca)-[:BELONG {percentage_question:20}]->(ch) WHERE u.username = 'xyz@gmail.com' AND p.pid = 'e766d8cd-26d1-4848-ac97-15c233caa4d4' AND ca.catname = 'nature'"

我想使用 WHERE 子句,没有 WHERE 我 运行 这样的查询然后它的工作

MATCH (u:User {username:'xyz@gmail.com'}),(p:Prize{pid:'e766d8cd-26d1-4848-ac97-15c233caa4d4'}),(ca:Category {catname:'nature'}) CREATE (ch:Challenge {chid:'dassdsdjgjasdasdasda',challenge_title:'Exm 2015', total_question_per_user:200,challenge_status:1,timestamp:'1471516538.4643',date:'2016-08-18'}), (p)-[:BELONG {rank:3}]->(ch),(ca)-[:BELONG {percentage_question:20}]->(ch)

您在错误的地方使用了 WHERE 子句。 where 子句需要与 MATCH 语句一起使用,而不是 CREATE.

像这样...

MATCH (u:User),(p:Prize),(ca:Category) 
WHERE u.username = 'xyz@gmail.com' 
AND p.pid = 'e766d8cd-26d1-4848-ac97-15c233caa4d4' 
AND ca.catname = 'nature'
CREATE (ch:Challenge {chid:'dassdshhhhasdasda', 
    challenge_title:'Exm 2015', 
    total_question_per_user:200, 
    challenge_status:1, 
    timestamp:'1471516538.4643', 
    date:'2016-08-18'})
   ,(p)-[:BELONG {rank:3}]->(ch)
   ,(ca)-[:BELONG {percentage_question:20}]->(ch)