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用户添加新图?