Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j:为什么我不能在python中通过find_one找到一个特定的节点?_Python_Neo4j - Fatal编程技术网

Neo4j:为什么我不能在python中通过find_one找到一个特定的节点?

Neo4j:为什么我不能在python中通过find_one找到一个特定的节点?,python,neo4j,Python,Neo4j,我是python2.7中使用Neo4j的新手。现在我尝试了一个关于Neo4j的简单测试,但是在数据库中找不到特定的节点。节点存在,但返回结果为“无”。 这是我的密码: from py2neo import Graph,Node,Relationship test_graph = Graph( "http://localhost:7474", username="neo4j", password="******" ) test_node_1 = Node(label =

我是python2.7中使用Neo4j的新手。现在我尝试了一个关于Neo4j的简单测试,但是在数据库中找不到特定的节点。节点存在,但返回结果为“无”。 这是我的密码:

from py2neo import Graph,Node,Relationship
test_graph = Graph(
    "http://localhost:7474", 
    username="neo4j", 
    password="******"
)
test_node_1 = Node(label = "Person",name = "test_node_1")
test_node_2 = Node(label = "Person",name = "test_node_2")
test_graph.create(test_node_1)
test_graph.create(test_node_2)

node_1_call_node_2 = Relationship(test_node_1,'CALL',test_node_2)
node_2_call_node_1 = Relationship(test_node_2,'CALL',test_node_1)
test_graph.create(node_1_call_node_2)
test_graph.create(node_2_call_node_1)

find_code_1 = test_graph.find_one(
  label="Person",
  property_key="name",
  property_value="test_node_1"
)
print (find_code_1)

问题是节点的语法有点不正确。您正在使用Person值设置名为label的属性,而不是创建Person节点

下面是语法应该是什么样的:

test_node_1 = Node("Person",name = "test_node_1")
test_node_2 = Node("Person",name = "test_node_2")
希望这有帮助

问候,, 汤姆