本文整理汇总了Python中py2neo.Node.properties['live']方法的典型用法代码示例。如果您正苦于以下问题:Python Node.properties['live']方法的具体用法?Python Node.properties['live']怎么用?Python Node.properties['live']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py2neo.Node
的用法示例。
在下文中一共展示了Node.properties['live']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_TwoNodes
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties['live'] [as 别名]
def test_TwoNodes(graph):
#create nodes
first = Node("Politician","Person",name="Narendra Modi",age="56")
second = Node("Party","Organization",name="BJP")
create_with_cp(graph,first,second)
#add props
first.pull()
second.pull()
first['live']='true'
second['live']='true'
push_with_cp(graph,first,second)
#add labels
first.pull()
second.pull()
first.labels.add('IndianPrimeMinister')
first['address']='Gujarat'
second.labels.add('PoliticalParty')
second['address']='Delhi'
push_with_cp(graph,first,second)
#add a label and remove a label in both nodes
first.pull()
first.labels.add('ChiefMinister')
first.labels.remove('IndianPrimeMinister')
second.pull()
second.labels.add('NationalParty')
second.labels.remove('PoliticalParty')
push_with_cp(graph,first,second)
#change a prop
first.pull()
first['name']='Narendra Damodar Modi'
second.pull()
second['name']='Bhartiya Janta Party'
push_with_cp(graph,first,second)
#remove a property
first.pull()
first.properties['live']=None
second.properties['live']=None
push_with_cp(graph,first,second)
#delete both nodes
delete_with_cp(graph,first,second)
示例2: test_TwoNodesOneRelation
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties['live'] [as 别名]
def test_TwoNodesOneRelation(graph):
#create nodes
first = Node("Politician","Person",name="Narendra Modi",age="56")
second = Node("Party","Organization",name="BJP")
employee = Relationship(first,"EmployeeOf",second)
create_with_cp(graph,first,second,employee)
#add props
first.pull()
second.pull()
employee.pull()
first['live']='true'
second['live']='true'
employee['current']='true'
push_with_cp(graph,first,second,employee)
#add labels, you cannot add another type or delete the previous type of a relation in neo4j
first.pull()
second.pull()
employee.pull()
first.labels.add('IndianPrimeMinister')
first['address']='Gujarat'
second.labels.add('PoliticalParty')
second['address']='Delhi'
employee['workingaddress']='CP'
push_with_cp(graph,first,second,employee)
#add a label and remove a label in both nodes
first.pull()
first.labels.add('ChiefMinister')
first.labels.remove('IndianPrimeMinister')
second.pull()
second.labels.add('NationalParty')
second.labels.remove('PoliticalParty')
#doing no chnage to the relationship to see if nodes are updated and the relation old
push_with_cp(graph,first,second)
#change a prop
first.pull()
first['name']='Narendra Damodar Modi'
second.pull()
second['name']='Bhartiya Janta Party'
employee.pull()
employee['workingaddress']='Connaught Palace'
push_with_cp(graph,first,second,employee)
#remove a property
first.pull()
first.properties['live']=None
second.pull()
second.properties['live']=None
employee.pull()
employee.properties['current']=None
push_with_cp(graph,first,second,employee)
#delete both nodes and rels
##EVEN BEFORE DELETING A RELATION, you will have to pull
##this we can fix : TODO in delete method
employee.pull()
delete_with_cp(graph,first,second,employee)
third=Node("Person",name="Abhishek Agarwal")
create_with_cp(graph,third)