本文整理汇总了Python中py2neo.Node.properties[property_name]方法的典型用法代码示例。如果您正苦于以下问题:Python Node.properties[property_name]方法的具体用法?Python Node.properties[property_name]怎么用?Python Node.properties[property_name]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py2neo.Node
的用法示例。
在下文中一共展示了Node.properties[property_name]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_node
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties[property_name] [as 别名]
def make_node(nodetype,uid,name,properties=None,property_key="id"):
node = None
if graph.find_one(nodetype,property_key='id', property_value=uid) == None:
print("Creating %s:%s, %s" %(nodetype,name,uid))
timestamp = graph.cypher.execute("RETURN timestamp()").one
node = Node(nodetype, name=name,id=uid,creation_time=timestamp,last_updated=timestamp)
graph.create(node)
if properties != None:
for property_name in properties.keys():
node.properties[property_name] = properties[property_name]
node.push()
return node
示例2: create
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties[property_name] [as 别名]
def create(self,name,properties=None,property_key="id"):
'''create will create a new node of nodetype with unique id uid, and properties
:param uid: the unique identifier
:param name: the name of the node
:param properties: a dictionary of properties with {field:value} for the node
'''
node = None
uid = generate_uid(self.name) # creation also checks for existence of uid
if graph.find_one(self.name,property_key='id',property_value=uid) == None:
timestamp = graph.cypher.execute("RETURN timestamp()").one
node = NeoNode(self.name, name=name,id=uid,creation_time=timestamp,last_updated=timestamp)
graph.create(node)
if properties != None:
for property_name in properties.keys():
node.properties[property_name] = properties[property_name]
node.push()
return node