python调用Neo4j构建知识图谱
from neo4j import GraphDatabase
import pandas as pd
与neo4j建立连接
driver = GraphDatabase.driver("bolt://192.168.133.133:6666", auth=("neo4j", "neo4j"))
添加节点属性
def add_person_attribute(tx,df):
"""
本体:人
属性:姓名、年龄
"""
for line in df.values:
person_name = line[0]
person_age = line[1]
tx.run("MERGE (:person {name: $person_name , "
"age: $person_age }) ",
person_name = person_name ,
p
共有 0 条评论