def store(self):
        """
        The object graph mapping store available as a property.

        Note: The property will use these configuration variables
        ``CONNECTION_RETRY``
        ``RETRY_INTERVAL``

        :return: the object graph mapping store property
        """
        store = ogm.Store(self.gdb)
        return store
Esempio n. 2
0
    def test_can_execute_example_code(self):
        class Person(object):
            def __init__(self, email=None, name=None, age=None):
                self.email = email
                self.name = name
                self.age = age

            def __str__(self):
                return self.name

        graph = neo4j.GraphDatabaseService()
        store = ogm.Store(graph)

        alice = Person("*****@*****.**", "Alice", 34)
        store.save_unique("People", "email", alice.email, alice)

        bob = Person("*****@*****.**", "Bob", 66)
        carol = Person("*****@*****.**", "Carol", 42)
        store.relate(alice, "LIKES", bob)
        store.relate(alice, "LIKES", carol)
        store.save(alice)

        friends = store.load_related(alice, "LIKES", Person)
        print("Alice likes {0}".format(" and ".join(str(f) for f in friends)))
Esempio n. 3
0
 def setup(self, legacy_graph):
     self.graph = legacy_graph
     self.store = ogm.Store(self.graph)