本文整理汇总了Python中py2neo.Node.properties[i]方法的典型用法代码示例。如果您正苦于以下问题:Python Node.properties[i]方法的具体用法?Python Node.properties[i]怎么用?Python Node.properties[i]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py2neo.Node
的用法示例。
在下文中一共展示了Node.properties[i]方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveComponent
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties[i] [as 别名]
def saveComponent(properties, label, price, voorraad,link, winkel):
graph = Graph("http://localhost:7484/db/data/")
modelID = properties['ModelID']
if bool(graph.cypher.execute_one('match (n) where n.ModelID = "{}" return n'.format(modelID))):
cn = graph.cypher.execute_one('match (n) where n.ModelID = "{}" return n'.format(modelID))
else:
cn = Node(label)
for i in properties:
cn.properties[i] = properties[i]
graph.create(cn)
cn.add_labels('Component')
cn.push()
rel = Relationship(cn, 'SOLD_AT', winkel, Price=price, inStock=voorraad, productUrl=link)
graph.create(rel)
saveMetaData(winkel.properties['Name'], properties['Name'], modelID, price, properties['Merk'],'www.Informatique.nl', label)
time.sleep(3)
示例2: construct_node
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties[i] [as 别名]
def construct_node(self, push_namespace, relationship, label, name, properties):
namespace = self.get_namespace(name)
self.check_duplicates(label, name=namespace)
node = Node(label)
node.properties["namespace"] = namespace
node.properties["name"] = name
for i in properties.keys():
node.properties[i] = properties[i]
self.graph.create(node)
if len(self.parent_node) != 0:
relation_enity = Relationship(self.get_parent_node(), relationship, node)
self.graph.create(relation_enity)
if push_namespace == True:
self.namespace.append(name)
self.parent_node.append(node)
示例3: construct_merge_node
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties[i] [as 别名]
def construct_merge_node(self, push_namespace, relationship, label, name, new_properties):
namespace = self.get_namespace(name)
node = self.graph.find_one(label, property_key="name", property_value=name)
if self.graph.find_one(label, property_key="name", property_value=name) != None:
for i in properties.keys():
node.properties[i] = properties[i]
node.push()
return node
else:
node = Node(label)
node.properties["namespace"] = namespace
node.properties["name"] = name
for i in properties.keys():
node.properties[i] = properties[i]
self.graph.create(node)
if len(self.namespace) != 0:
relation_enity = Relationship(self.get_namespace_node(), relationship, node)
self.graph.create(relation_enity)
if push_namespace == True:
self.namespace.append(name)
self.namespace.append(node)
return node
示例4: saveComponent
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties[i] [as 别名]
def saveComponent(properties, label, price, voorraad, link):
modelID = properties['ModelID']
if bool(neo4j_db.cypher.execute_one('match (n) where n.ModelID = "{}" return n'.format(modelID))):
cn = neo4j_db.cypher.execute_one('match (n) where n.ModelID = "{}" return n'.format(modelID))
else:
cn = Node(label)
for i in properties:
cn.properties[i] = properties[i]
neo4j_db.create(cn)
cn.add_labels('Component')
cn.push()
rel = Relationship(cn, 'SOLD_AT', store, Price=price, InStock=voorraad, productUrl=link)
neo4j_db.create(rel)
number = float(price)
# MongoDB
now = datetime.now()
post = {'ModelID': properties['ModelID'],
'Name': properties['Name'],
'Price': number,
'Brand': properties['Merk'],
'Type': label,
'Timestamp': int(time.mktime(now.timetuple()))}
if label == 'CPU': mongodb.CPU.insert(post)
elif label == 'Motherboard': mongodb.Motherboard.insert(post)
elif label == 'CPUFan': mongodb.CPUFan.insert(post)
elif label == 'GraphicsCard': mongodb.GraphicsCard.insert(post)
elif label == 'RAM': mongodb.RAM.insert(post)
elif label == 'Case': mongodb.Case.insert(post)
elif label == 'PSU': mongodb.PSU.insert(post)
elif label == 'Barebones': mongodb.Barebones.insert(post)
elif label == 'Storage-HDD': mongodb.HDD.insert(post)
elif label == 'Storage-SSD': mongodb.SSD.insert(post)
else: mongodb.MISC.insert(post)