0
我用py2neo V3連接的Neo4j數據庫關聯的節點到現有節點py2neo OGM
我OGM模式:
class User(GraphObject):
__primarykey__ = "username"
username = Property()
password = Property()
ppi_graph = RelatedTo(Graph, "PPI_Graph")
class Graph(GraphObject):
__primarykey__ = "name"
name = Property()
date = Property()
node = RelatedTo(Node)
user = RelatedFrom(User,"PPI_Graph")
class Node(GraphObject):
__primarykey__ = "name"
name = Property()
ppigraph = RelatedFrom(Graph, "HAVE_NODE")
related = Related(Node, "Related")
第一種方法:
查找用戶,創建新圖,加用戶對圖graph.user.add()
graph #connection to neo4j db
user = User.select(graph, username).first()
gr = Graph()
gr.name = "graph"
gr.date = "today"
gr.user.add(user)
graph.push(gr)
t他的方法將數據推送到數據庫
第二種方法:
查找用戶,創建新的圖形,當用戶添加ppi_graph添加圖形用戶user.graph.add()
graph #connection to neo4j db
user = User.select(graph, username).first()
gr = Graph()
gr.name = "graph"
gr.date = "today"
user.ppi_graph.add(us)
graph.push(us)
此方法引發錯誤:
related_object = self.related_class.wrap(node)
AttributeError: type object 'Graph' has no attribute 'wrap'
爲什麼我不能爲finder用戶添加新圖?