def __init__(self, root_uri=REXSTER_URI): self.config = Config(root_uri) self.resource = RexsterResource(self.config) self.gremlin = Gremlin(self.resource) self.indices = IndexProxy(RexsterIndex, resource) self.vertices = VertexProxy(Vertex, self.resource) self.vertices.index = self.indices.get("vertices", Vertex) self.edges = EdgeProxy(Edge, self.resource) self.edges.index = self.indices.get("edges", Edge)
class Graph(object): def __init__(self, root_uri=REXSTER_URI): self.config = Config(root_uri) self.resource = RexsterResource(self.config) self.gremlin = Gremlin(self.resource) self.indices = IndexProxy(RexsterIndex, resource) self.vertices = VertexProxy(Vertex, self.resource) self.vertices.index = self.indices.get("vertices", Vertex) self.edges = EdgeProxy(Edge, self.resource) self.edges.index = self.indices.get("edges", Edge) def load_graphml(self, uri): """Loads a GraphML file into the database and returns the response.""" script = self.resource.scripts.get('load_graphml') params = dict(uri=uri) return self.gremlin.execute(script, params) def save_graphml(self): """Returns a GraphML file representing the entire database.""" script = self.resource.scripts.get('save_graphml') results = self.gremlin.execute(script, params=None) return results[0] def clear(self): """ Deletes all the elements in the graph. Example:: >>> g = Graph() >>> g.clear() .. admonition:: WARNING g.clear() will delete all your data! """ return self.resource.clear()
class Graph(object): def __init__(self, root_uri=REXSTER_URI): self.config = Config(root_uri) self.resource = RexsterResource(self.config) self.gremlin = Gremlin(self.resource) self.indices = IndexProxy(RexsterIndex, resource) self.vertices = VertexProxy(Vertex, self.resource) self.vertices.index = self.indices.get("vertices", Vertex) self.edges = EdgeProxy(Edge, self.resource) self.edges.index = self.indices.get("edges", Edge) def load_graphml(self, uri): """Loads a GraphML file into the database and returns the response.""" script = self.resource.scripts.get("load_graphml") params = dict(uri=uri) return self.gremlin.execute(script, params) def save_graphml(self): """Returns a GraphML file representing the entire database.""" script = self.resource.scripts.get("save_graphml") results = self.gremlin.execute(script, params=None) return results[0] def clear(self): """ Deletes all the elements in the graph. Example:: >>> g = Graph() >>> g.clear() .. admonition:: WARNING g.clear() will delete all your data! """ return self.resource.clear()
def __init__(self, db_url=config.DATABASE_URL): self.resource = Resource(db_url) self.vertices = VertexProxy(self.resource) self.edges = EdgeProxy(self.resource) self.indices = IndexProxy(self.resource) self.gremlin = Gremlin(self.resource)
def _get_index_proxy(self): """Returns the index's proxy class.""" return IndexProxy(self.resource, self)