Fetch the repository succeeded.
from py2neo.ogm import GraphObject, Property, RelatedFrom, RelatedTo
from py2neo import Graph
class Movie(GraphObject):
__primarykey__ = "title"
title = Property()
tag_line = Property("tagline")
released = Property()
actors = RelatedFrom("Person", "ACTED_IN")
directors = RelatedFrom("Person", "DIRECTED")
producers = RelatedFrom("Person", "PRODUCED")
class Person(GraphObject):
__primarykey__ = "name"
name = Property()
born = Property()
acted_in = RelatedTo(Movie)
directed = RelatedTo(Movie)
produced = RelatedTo(Movie)
graph = Graph(password='asdfasdfa')
# keanu=Person()
# keanu.name='keanu'
# keanu.born = 1956
# bill_and_ted = Movie()
# bill_and_ted.title = "Bill & Ted's Excellent Adventure"
# bill_and_ted.released = '哥伦比亚电影公司'
# keanu.acted_in.add(bill_and_ted)
# graph.push(keanu)
keanu = Person.match(graph, "keanu").first()
keanu.born = 1957 #更新
bill_and_ted = Movie.match(graph, "Bill & Ted's Excellent Adventure").first()
bill_and_ted.released = '中国电影公司'
bill_and_ted.tag_line = 'yyy'
keanu.acted_in.add(bill_and_ted)
graph.push(bill_and_ted)
graph.push(keanu)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。