Esempio n. 1
0
 def create(self, key, value, abstract):
     """ Create and index a new node or relationship using the abstract
     provided.
     """
     batch = LegacyWriteBatch(self.graph)
     if self._content_type is Node:
         batch.create(abstract)
         batch.add_to_index(Node, self, key, value, 0)
     elif self._content_type is Relationship:
         batch.create(abstract)
         batch.add_to_index(Relationship, self, key, value, 0)
     else:
         raise TypeError(self._content_type)
     entity, index_entry = batch.submit()
     return entity
Esempio n. 2
0
 def create(self, key, value, abstract):
     """ Create and index a new node or relationship using the abstract
     provided.
     """
     batch = LegacyWriteBatch(self.graph)
     if self._content_type is Node:
         batch.create(abstract)
         batch.add_to_index(Node, self, key, value, 0)
     elif self._content_type is Relationship:
         batch.create(abstract)
         batch.add_to_index(Relationship, self, key, value, 0)
     else:
         raise TypeError(self._content_type)
     entity, index_entry = batch.submit()
     return entity