我正在尝试使用 python 在 neo4j 中顺序插入顶点和边。添加边时,无法识别现有节点。无论我使用 py2neo 还是灯泡,我都会收到类似的错误消息。
注意我正在使用:linux64 python2.7bulls0.3 py2neo1.5 neo4j-community1.8.2
带灯泡:
>>> from bulbs.neo4jserver import Graph
>>> g = Graph()
>>> g.vertices.create(name="James")
>>> g.vertices.create(name="Julie")
>>> g.edges.create(james, "knows", julie)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-46-9ba24256218d> in <module>()
----> 1 g.edges.create(james, "knows", julie)
NameError: name 'james' is not defined
使用 py2neo
from py2neo import neo4j
graph=neo4j.GraphDatabaseService()
node=graph.create({"name":'James'},{'name':'Julie'})
rel=graph.create((james,"knows",julie))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-8-591f826cfd05> in <module>()
2 graph=neo4j.GraphDatabaseService()
3 node=graph.create({"name":'James'},{'name':'Julie'})
----> 4 rel=graph.create((james,"knows",julie))
NameError: name 'james' is not defined
bulbs
此外,如果我使用rexster
而不是,我得到了同样的错误neo4j
,即
>>> from bulbs.rexster import Graph
>>> g = Graph()
>>> g.vertices.create(name="James")
>>> g.vertices.create(name="Julie")
>>> g.edges.create(james, "knows", julie)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-2cfb5faa42d1> in <module>()
3 g.vertices.create(name="James")
4 g.vertices.create(name="Julie")
----> 5 g.edges.create((james, "knows", julie))
NameError: name 'james' is not defined
这里有什么问题?
谢谢