本文整理汇总了Python中py2neo.Node.properties['pointsTo']方法的典型用法代码示例。如果您正苦于以下问题:Python Node.properties['pointsTo']方法的具体用法?Python Node.properties['pointsTo']怎么用?Python Node.properties['pointsTo']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py2neo.Node
的用法示例。
在下文中一共展示了Node.properties['pointsTo']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_nodes
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties['pointsTo'] [as 别名]
def add_nodes(xml_blob):
''' Add each Scappe "note" as a neo4j node '''
node = Node('item', uid=int(xml_blob.get('ID')))
for item in xml_blob.getchildren():
if item.tag == 'String':
node.properties['text'] = item.text
elif item.tag == 'PointsToNoteIDs':
# format is either '1, 2, 3' or '1-3'
link_range = item.text.split(', ')
links = []
for value in link_range:
if '-' in value:
value = value.split('-')
links += range(int(value[0]), int(value[1])+1)
else:
links.append(int(value))
node.properties['pointsTo'] = links
GRAPH.create(node)
示例2: add_nodes
# 需要导入模块: from py2neo import Node [as 别名]
# 或者: from py2neo.Node import properties['pointsTo'] [as 别名]
def add_nodes(xml_blob):
''' Add each Scapple "note" as a neo4j node '''
label = 'option'
node = Node(label, uid=int(xml_blob.get('ID')))
for item in xml_blob.getchildren():
if item.tag == 'Appearance' and len(item.findall('Border')):
node.set_labels('turn')
elif item.tag == 'String':
node.properties['text'] = item.text
elif item.tag == 'PointsToNoteIDs':
# format is either '1, 2, 3' or '1-3'
link_range = item.text.split(', ')
links = []
for value in link_range:
if '-' in value:
value = value.split('-')
links += range(int(value[0]), int(value[1])+1)
else:
links.append(int(value))
if len(links) > 1:
node.set_labels('prompt')
node.properties['pointsTo'] = links
GRAPH.create(node)