Exemple #1
0
 def test_graph_reinit(self):
     gdb1 = neo.init_graph(db_file)
     gdb2 = neo.init_graph(db_file+"1")
     
     self.assert_(not gdb1)
     self.assertEqual(gdb2.store_dir, db_file+"1")
     
     gdb2.shutdown()
Exemple #2
0
 def setUp(self):
     self.gdb = gdb = neo.init_graph(db_file)
     tx, created = gdb.get_tx()
     self.plant_root = gdb.node(name="plant")
     self.lifeform_root = gdb.node(name="lifeform")
     self.lifeform_nodes = {}
     self.endangered_root = gdb.node(name="endangered")
     
     for n in (self.plant_root, self.lifeform_root, self.endangered_root):
         gdb.reference_node.CHILD(n)
     
     for plant in rare_plants:
         n = gdb.node(name=plant.common_names[0], scientific_name=plant.scientific_name)
         n.IS_A(self.plant_root, endangered=plant.endangered)
         
         lf = plant.lifeform.lower()
         if lf not in self.lifeform_nodes:
             self.lifeform_nodes[lf] = lf_node = gdb.node(name=plant.lifeform)
             lf_node.IS_A(self.lifeform_root)
         else:
             lf_node = self.lifeform_nodes[lf]
             
         n.IS_A(lf_node)
         
         if plant.endangered:
             n.IS(self.endangered_root)
         
     
     tx.finish(True)
     self.tx, created = gdb.get_tx()
Exemple #3
0
 def test_global_graph_db(self):
     gdb = neo.init_graph(db_file)
     self.assert_(gdb is not None)
     gdb = neo.get_graph()
     self.assert_(gdb is not None)
     
     gdb.shutdown()
     self.assert_(not gdb)
Exemple #4
0
 def setUp(self):
     self.gdb = gdb = neo.init_graph(db_file)
     self.tx, created = gdb.get_tx()
     
     self.node_idx = gdb.node_indices.create("plant node index")
     self.rel_idx = gdb.rel_indices.create("plant relation index")
     self.fulltext_idx = gdb.node_indices.create("plant common name", fulltext=True)
     
     self.plant_root = self.gdb.node(name="plant")
     for plant in rare_plants:
         n = self.gdb.node(common_name=plant.common_names[0], sciname=plant.scientific_name, endangered=plant.endangered)
         r = n.IS_A(self.plant_root, lifeform=plant.lifeform)
         self.node_idx['sciname', plant.scientific_name] = n
         self.rel_idx['lifeform', plant.lifeform] = r
         
         self.fulltext_idx['lifeform', plant.lifeform] = n
         for name in plant.common_names:
             self.fulltext_idx['name', name] = n
             
     self.tx.finish(True)            # commit and start new
     self.tx, created = gdb.get_tx()
Exemple #5
0
 def setUp(self):
     self.gdb = neo.init_graph(db_file)
Exemple #6
0
 def setUp(self):
     self.gdb = neo.init_graph(db_file)
     self.tx, created = self.gdb.get_tx()