#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 damian <damian@C-DZ-E5500>
#
# Distributed under terms of the MIT license.

"""
Sample application to insert data into neo4j database
"""

from py2neo import Graph, Node, Relationship

if __name__ == "__main__":
    graph = Graph("http://localhost:7474", user="neo4j", password="damian")
    graph.delete_all()

    alice = Node("Person", name="0x75142F9C", type="GenericListTopHighlightWidget")
    bob = Node("Person", name="0x75142F9D", type="GenericListTopHighlightDataModel")

    alice_knows_bob = Relationship(alice, "mDataManager", bob)
    graph.create(alice_knows_bob)

    alice2 = Node("Person", name="0x85142F9C", type="GenericListTopHighlightWidget")
    bob2 = Node("Person", name="0x85142F9D", type="GenericListTopHighlightDataModel")

    alice2_knows_bob2 = Relationship(alice2, "mDataManager", bob2)
    graph.create(alice2_knows_bob2)


@@ -427,38 +427,22 @@
 me=%22
-0x75142F9C%22, type=%22GenericList
+alice%22, type=%22
 TopH
@@ -493,38 +493,20 @@
 me=%22
-0x75142F9D%22, type=%22GenericList
+bob%22, type=%22
 TopH
@@ -569,28 +569,21 @@
 alice, %22
-mDataManager
+knows
 %22, bob)%0A
@@ -655,38 +655,23 @@
 me=%22
-0x85142F9C%22, type=%22GenericList
+alice2%22, type=%22
 TopH
@@ -723,38 +723,21 @@
 me=%22
-0x85142F9D%22, type=%22GenericList
+bob2%22, type=%22
 TopH
@@ -807,20 +807,13 @@
 2, %22
-mDataManager
+knows
 %22, b
@@ -854,8 +854,158 @@
 _bob2)%0A%0A
+    bob3 = Node(%22Person%22, name=%22bob3%22, type=%22AnotherType%22)%0A    bob2_knows_bob3 = Relationship(bob2, %22knows%22, bob3)%0A    graph.create(bob2_knows_bob3)%0A%0A

add neo4j sample