python 操作neo4j

 
from py2neo import Graph,Node,Relationship

test_graph = Graph(
"http://192.168.33.56:7474",
username="neo4j",
password="neo4jtest"
)
test_node_1 = Node("py",name = "test_node_1")
test_node_2 = Node("py",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_1_call_node_2['count'] = 1
# node_2_call_node_1 = Relationship(test_node_2,'CALL',test_node_1)
# node_2_call_node_1['count'] = 2
# test_graph.create(node_1_call_node_2)
# test_graph.create(node_2_call_node_1)


# node_1_call_node_2['count']+=1
# test_graph.push(node_1_call_node_2)

find_code_1 = test_graph.find_one(
label="py",
property_key="name",
property_value="test_node_1"
)
print find_code_1['name']

match_relation = test_graph.match(start_node=find_code_1,bidirectional=True)
for i in match_relation:
print i
i['count']+=1
test_graph.push(i)
 
 
 
 
 

 

您可以选择一种方式赞助本站