当前位置: 首页>>代码示例>>Python>>正文


Python Node.properties['pointsTo']方法代码示例

本文整理汇总了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)
开发者ID:mouse-reeve,项目名称:scapple4j,代码行数:21,代码来源:BuildDatabase.py

示例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)
开发者ID:mouse-reeve,项目名称:texter-adventure,代码行数:26,代码来源:BuildFromScapple.py


注:本文中的py2neo.Node.properties['pointsTo']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。