代码拉取完成,页面将自动刷新
#Graph新增数据,入库
#如何安装参考官网https://neo4j.com/
#运行这段代码需要先安装neo4j数据库
from py2neo import Graph
from py2neo import Node, Relationship, Graph
# graph_1 = Graph()
# graph_2 = Graph(host="localhost")
# graph_3 = Graph("http://localhost:7474/db/data/")
# a = Node('Person', name='Alice')
# b = Node('Person', name='Bob')
# r = Relationship(a, 'KNOWS', b)
# s = a | b | r
# graph = Graph(password='asdfasdfa')
# graph.create(s)
#单独添加单个 Node 或 Relationship
graph = Graph(password='asdfasdfa')
a = Node('Person', name='小江')
graph.create(a)
b = Node('Person', name='许慧')
ab = Relationship(a, 'KNOWS', b)
graph.create(ab)
# graph = Graph(password='asdfasdfa')
a = Node('Person', name='hh', age='33')
graph.create(a)
b = Node('Person', name='yy', age='30')
ab = Relationship(a, 'KNOWS', b)
graph.create(ab)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。