Neo4j Rest Cypher Qyery匹配节点:错误

时间:2016-01-09 01:01:27

标签: rest cypher

我正在使用REST API发送密码查询,如下所示:

MATCH (user:Profile)-[:HAS_SEARCHED]-(term{name:"TV"}) 
WITH [x in collect(user)| id(x) ] AS userIDs 
MATCH(user:Profile) where id(user) in userIDs 
MATCH (user)-[r:HAS_SEARCHED]->(term:SearchTerm) 
return term.name

虽然查询在服务器上直接运行时运行良好,但在eclipse中给出以下错误:

{"results":[],"errors":[{"code":"Neo.ClientError.Request.InvalidFormat",
"message":"Unable to deserialize request: 
Unexpected character ('T' (code 84)): was expecting comma to separate OBJECT entries\n at 
[Source: HttpInputOverHTTP@2543f0f2; line: 1, column: 85]"}]}

请帮忙!!感谢

1 个答案:

答案 0 :(得分:0)

关于您的查询,您不需要将用户匹配两次:

MATCH (user:Profile)-[:HAS_SEARCHED]-(term:SearchTerm {name:"TV"}) 
WITH distinct user
MATCH (user)-[r:HAS_SEARCHED]->(term:SearchTerm) 
RETURN term.name, count(*) as freq

甚至:

MATCH (term:SearchTerm {name:"TV"})<-[:HAS_SEARCHED]-(:Profile)-[:HAS_SEARCHED]->(term:SearchTerm) 
RETURN term.name, count(*) as freq