1

我正在开发一个原型,我将所有电影细节存储在 neo4j 上。我使用 python 作为我的编程语言。

现在,我想找出我在特定级别(比如 10.0)对哪些电影进行了评分。为此,我编写了以下 Cypher 查询:

START me=node(1) 
MATCH me-[r:likes]-> movies 
WHERE has(r.Ratings) and r.Ratings = '10.0' 
RETURN movies

这在 neo4j 网络管理员上运行良好。但是,当我使用 python 运行相同时:

myMovies = db.query("START me=node({id}) MATCH me-[r:likes]-> movies WHERE has(r.Ratings) and r.Ratings = '10.0' RETURN movies",id=user["nodeID"])

我收到以下错误:

Traceback (most recent call last):
  File "GraphTest.py", line 228, in <module>
    test.findTaste("Paritosh Kumar")
  File "GraphTest.py", line 31, in findTaste
    taste = self.BuildTasteForUser(user)
  File "GraphTest.py", line 52, in BuildTasteForUser
    myMovies = db.query("START me=node({id}) MATCH me-[r:likes]-> movies WHERE has(r.Ratings) and r.Ratings = '10.0' RETURN movies",id=user["nodeID"])
  File "/usr/local/lib/python2.7/dist-packages/neo4j/__init__.py", line 155, in query
    return self._cypher_engine.execute(query, **params)
  File "/usr/local/lib/python2.7/dist-packages/neo4j/cypher.py", line 31, in execute
    return ExecutionResult(self._engine.execute(query,to_java(params)))
  File "/usr/local/lib/python2.7/dist-packages/neo4j/_backend.py", line 156, in decorator
    return fn(*args, **kwargs)
jpype._jexception.CypherExceptionPyRaisable: unknown function
"START me=node({id}) MATCH me-[r:likes]-> movies WHERE has(r.Ratings) and r.Ratings = '10.0' RETURN movies"

我是 Cypher 和 neo4j 的新手,我不确定为什么会这样。有人可以帮我吗?

Regds,帕里托什

4

1 回答 1

0

使用 !( 15.11.9 ) 运算符:

START me=node(1) 
MATCH me-[r:likes]-> movies 
WHERE r.Ratings! = '10.0' 
RETURN movies
于 2013-03-05T13:08:01.873 回答