Exemplo n.º 1
0
def add_node(label):
    ''' create a new item '''
    node_data = request.json
    params = node_data['properties']
    data = graph.add_node(label, params)

    if 'relatedNode' in node_data:
        graph.relate_nodes(node_data['relatedNode'], data[0][0]._id, node_data['relationship'])

    return success(data)
Exemplo n.º 2
0
def add_relationship(item1_id, item2_id):
    ''' connect two related nodes '''
    rel_name = request.json['relationship']
    graph.relate_nodes(item1_id, item2_id, rel_name)
    return success()