def ReadTest2(self):

        startTime = datetime.datetime.now()

        num_nodes = 1000000
        num_labels = 10000

        print ""
        print "---------------------------------------------"
        print "Reading labeled nodes"
        print "---------------------------------------------"
        print ""

        cnt = 0
        rbatch = neo4j.ReadBatch(self.gdb)
        for index in range(0, num_labels):
            print "+ reading label_%d" % index
            rbatch.append_cypher(self._getReadLabeledNodesCypher('label_%d' % index))
            cnt += 1
            if cnt == MAX_QUERIES_IN_RBATCH:
                rbatch.submit()
                cnt = 0
                rbatch.clear()

        endTime = datetime.datetime.now()
        
        print "Done"
        print endTime - startTime
 def _getNodeByGenid_batch(self, label, genid_list):
     query_text = "match (n:" + label + ") where n.identifier = { genid } return n;"
     rbatch = neo4j.ReadBatch(self.gdb)
     for g in genid_list:
         rbatch.append_cypher(query_text, {'genid': g})
     res = rbatch.submit()
     return dict(zip(genid_list, res))
Exemple #3
0
 def find_elements_by_name(self, element_name):
     """
     find element list by names
     return node reference
     """
     batch = neo4j.ReadBatch(self.graph_db)
     batch.get_indexed_nodes('ElementName', 'NAME', element_name)
     return batch.submit()
Exemple #4
0
 def test_can_retrieve_multiple_indexed_nodes(self):
     people = self.graph_db.get_or_create_index(neo4j.Node, "People")
     alice, bob, carol, dave, eve = self.graph_db.create(
         {"name": "Alice Smith"},
         {"name": "Bob Smith"},
         {"name": "Carol Smith"},
         {"name": "Dave Jones"},
         {"name": "Eve Jones"},
     )
     people.add("family_name", "Smith", alice)
     people.add("family_name", "Smith", bob)
     people.add("family_name", "Smith", carol)
     people.add("family_name", "Jones", dave)
     people.add("family_name", "Jones", eve)
     batch = neo4j.ReadBatch(self.graph_db)
     batch.get_indexed_nodes("People", "family_name", "Smith")
     batch.get_indexed_nodes("People", "family_name", "Jones")
     data = batch.submit()
     smiths = data[0]
     joneses = data[1]
     assert smiths == [alice, bob, carol]
     assert joneses == [dave, eve]