Commits

Lynn Rees committed 7c6bc40

- experiment

Comments (0)

Files changed (3)

graphalchemy/backends/apps.py

             link = 'graphalchemy.backends.neo4jbe.LinkWrite'
             node = 'graphalchemy.backends.neo4jbe.NodeWrite'
 
+    class pytables(Namespace):
+        embedded = 'graphalchemy.backends.pytablesbe.hdf5'
+
+        class read(Namespace):
+            link = 'graphalchemy.backends.pytablesbe.LinkRead'
+            node = 'graphalchemy.backends.pytablesbe.NodeRead'
+
+        class write(Namespace):
+            link = 'graphalchemy.backends.pytablesbe.LinkWrite'
+            node = 'graphalchemy.backends.pytablesbe.NodeWrite'
+
 
 appconf = Appconf.build()
 

graphalchemy/backends/pytables.py

-# -*- coding: utf-8 -*-
-#pylint: disable-msg=w0221
-'''neo4j backends'''
-
-from __future__ import absolute_import
-
-import atexit
-import logging
-
-from lucenequerybuilder import Q
-from stuf.utils import get_or_default, getter
-
-from graphalchemy.core import Backend
-
-from .utils import BackendRead
-
-
-def embedded(url):
-    '''
-    neo4j embedded database loader
-
-    @param url: path to database on file system
-    '''
-    from neo4j import GraphDatabase
-    db = GraphDatabase(url)
-
-    def _close_db():
-        try:
-            db.shutdown()  # pylint: disable-msg=e1101
-        except NameError:
-            logging.error('No shutdown. Is database open in another process?')
-
-    # register database to close at exit...hopefully
-    atexit.register(_close_db)
-    return db
-
-
-class Read(BackendRead):
-
-    '''neo4j reader base'''
-
-    @property
-    def root(self):
-        '''get root graph element'''
-        return self._db.reference_node
-
-    @staticmethod
-    def ands(**kw):
-        '''
-        "AND" lucene query builder
-
-        see https://github.com/scholrly/lucene-querybuilder
-        '''
-        def R(k, v):
-            return Q(k, v, wildcard=True)
-        qs = None
-        for k, v in kw.iteritems():
-            qs = qs & R(k, v) if qs is not None else R(k, v)
-        return qs
-
-    @staticmethod
-    def and_nots(**kw):
-        '''
-        "AND NOT" lucene query builder
-
-        see https://github.com/scholrly/lucene-querybuilder
-        '''
-        def R(k, v):
-            return -Q(k, v, wildcard=True)
-        qs = None
-        for k, v in kw.iteritems():
-            qs = qs & R(k, v) if qs is not None else R(k, v)
-        return qs
-
-    def filter(self, index, queries, model=None):
-        '''
-        full text search using index
-
-        @param index: name of index
-        @param queries: queries build with query builder
-        @param model: element model (default: None)
-        '''
-        return self.one_or_all(self.index(index).query(queries), model)
-
-    def filter_by(self, index, key, value, callback=None):
-        '''
-        fetch graph elements filtered by keywords
-
-        @param index: index name
-        @param key: keyword in index
-        @param value: value in index (or second key)
-        @param callback: filter callback function (default: None)
-        '''
-        return self.one_or_all_and_close(
-            self.index(index)[key][value], callback,
-        )
-
-    def id(self, element):
-        '''
-        graph element identifier
-
-        @param element: a graph element
-        '''
-        return get_or_default(element, 'id', None)
-
-    @staticmethod
-    def ors(**kw):
-        '''
-        "OR" lucene query builder
-
-        see https://github.com/scholrly/lucene-querybuilder
-        '''
-        qs = None
-
-        def R(k, v):
-            return Q(k, v, wildcard=True)
-        for k, v in kw.iteritems():
-            qs = qs | R(k, v) if qs is not None else R(k, v)
-        return qs
-
-    @staticmethod
-    def or_nots(**kw):
-        '''
-        "OR NOT" lucene query builder
-
-        see https://github.com/scholrly/lucene-querybuilder
-        '''
-        qs = None
-
-        def R(k, v):
-            return -Q(k, v, wildcard=True)
-        for k, v in kw.iteritems():
-            qs = qs | R(k, v) if qs is not None else R(k, v)
-        return qs
-
-    def properties(self, element):
-        '''
-        get graph element properties
-
-        @param element: graph element
-        '''
-        return dict(element.items()) if element is not None else {}
-
-    def raw(self, model, expr, **kw):
-        '''
-        fetch graph items with Cypher query language
-
-        @param model: graph model
-        @param express: Cypher query
-        @param **kw: variables for Cypher query
-        '''
-        return self.one_or_all(self._db.query(expr, **kw), model)
-
-    def traverser(self, this, tester=None, links=None, unique=None):
-        '''
-        build a traverse function
-
-        @param this: graph model instance
-        @param tester: filter for traversed elements (default: None)
-        @param links: links to traverse (default: None)
-        @param unique: how often to traverse the same element (default: None)
-        '''
-        tv = self._db.traversal()
-        if links is not None:
-            for link in links:
-                if len(link) == 2:
-                    tv = tv.relationships(*link)
-                else:
-                    tv = tv.relationships(link)
-        if unique is not None:
-            tv = tv.uniqueness(unique)
-        if tester is not None:
-            tv = tv.evaluator(tester)
-        return tv.traverse(this.element)
-
-    def walker(self, this, direction=None, label=None, keys=None):
-        '''
-        iterate over and yield links
-
-        @param this: graph model instance
-        @param direction: direction of links (default: None)
-        @param label: label for links (default: None)
-        @param keys: keys to find on elements (default: None)
-        '''
-        links = getattr(this.element, 'rels', [])
-        if label is not None:
-            links = self.get_links(links, label)
-        elif direction is not None:
-            links = self.get_links(links, direction)
-        for link in links:
-            if keys is not None:
-                if not {keys, link.keys()}.intersection():
-                    continue
-            yield link
-
-
-class Write(Backend):
-
-    '''neo4j writer base'''
-
-    def delete_index(self, index):
-        '''
-        delete graph index
-
-        @param index: graph index
-        '''
-        with self._db.transaction:
-            self._db.nodes.indexes.get(index).delete()
-
-    def delete_property(self, this, key):
-        '''
-        delete graph element property
-
-        @param this: graph model instance
-        @param key: graph element property key
-        '''
-        with self._db.transaction:
-            del this.element[key]
-
-    def index_many(self, index, this, indexed, transaction=False):
-        '''
-        index properties on a graph element
-
-        @param index: graph index label
-        @param this: graph model instance
-        @param indexed: properties to index
-        @param transaction: run transaction in this call (default: False)
-        '''
-        def indexer(index, element, indexed):
-            for field in indexed:
-                index[field][element[field]] = element
-        if transaction:
-            with self._db.transaction:
-                indexer(index, this.element, indexed)
-        else:
-            indexer(index, this.element, indexed)
-
-    def index_one(self, index, key, value, this, transaction=False):
-        '''
-        index one property of a graph element
-
-        @param index: graph index label
-        @param key: graph element property key
-        @param value: graph element property value
-        @param this: graph model instance
-        @param transaction: use individual transaction (default: False)
-        '''
-        def indexer(index, key, value, element):
-            index[key][value] = element
-        if transaction:
-            with self._db.transaction:
-                indexer(index, key, value, this.element)
-        else:
-            indexer(index, key, value, this.element)
-
-    def update(self, this, data, callback=None):
-        '''
-        update a graph element's properties
-
-        @param this: graph model instance
-        @param data: cleaned data
-        @param callback: callback function (default: None)
-        '''
-        element = this.element
-        with self._db.transaction:
-            for k, v in data.iteritems():
-                element[k] = v
-            if callback is not None:
-                callback(element)
-
-
-class LinkRead(Read):
-
-    '''neo4j link reader'''
-
-    def get(self, element):
-        '''
-        get link by link id
-
-        @param element: element identifier
-        '''
-        return self._db.relationships[element]
-
-    def index(self, index):
-        '''
-        get link index by name
-
-        @param index: index name
-        '''
-        return self._db.relationships.indexes.get(index)
-
-    def kind(self, element):
-        '''
-        kind of link
-
-        @param element: a link graph element
-        '''
-        return getter(element, 'type')
-
-    def linked(self, this, key):
-        '''
-        search link for specified key
-
-        @param this: a link
-        @param key: key to search for
-        '''
-        for link in this.element.rels:
-            if key in link.keys():
-                return link
-        else:
-            return None
-
-    def traverser(self, this, tester=None, links=None, unique=None):
-        '''
-        build a traverse function
-
-        @param this: graph model instance
-        @param tester: filter for traversed elements (default: None)
-        @param links: links to traverse (default: None)
-        @param unique: how often to traverse the same element (default: None)
-        '''
-        tv = super(LinkRead, self).traverser(this, tester, links, unique)
-        return tv.traverse(this.element).relationships
-
-
-class LinkWrite(Write):
-
-    '''neo4j link writer'''
-
-    def build(self, link, start, end, callback=None, **kw):
-        '''
-        build a new graph link
-
-        @param link: link name
-        @param start: start node for link
-        @param end: end node for link
-        @param callback: callback function (default: None)
-        @param kw: keywords (default: None)
-        '''
-        with self._db.transaction:
-            this = start.element.rels.create(link, end.element, **kw)
-            if callback is not None:
-                this = callback(this)
-        return this
-
-    def create_index(self, index, fts=False):
-        '''
-        create link index
-
-        @param index: node index name
-        @param fts: create a full text index (default: False)
-        '''
-        db = self._db
-        kind = 'fulltext' if fts else None
-        with db.transaction:
-            db.relationships.indexes.create(index, type=kind)
-
-    def delete_element(self, this, indices=None):
-        '''
-        delete graph element
-
-        @param this: graph model instance
-        @param index: graph index (default: None)
-        '''
-        db = self._db
-        element = this.element
-        with db.transaction:
-            if indices is not None:
-                for index in indices:
-                    del db.relationships.indexes.get(index)[element]
-            for link in element.rels:
-                link.delete()
-            element.delete()
-
-
-class NodeRead(Read):
-
-    '''neo4j node reader'''
-
-    def get(self, element):
-        '''get node by link id'''
-        return self._db.nodes[element]
-
-    def index(self, index):
-        '''
-        get node lucene index by name
-
-        @param index: node index name
-        '''
-        return self._db.nodes.indexes.get(index)
-
-    def linked(self, this, key):
-        '''
-        get node from a node's links filtered by keywords
-
-        @param this: graph model instance
-        @param key: keyword in linked node
-        '''
-        for link in this.element.rels:
-            if key in link.end.keys():
-                return link.end
-            elif key in link.start.keys():
-                return link.start
-        else:
-            return None
-
-    def traverser(self, this, tester=None, links=None, unique=None):
-        '''
-        build a traverse function
-
-        @param this: graph model instance
-        @param tester: filter for traversed elements (default: None)
-        @param links: links to traverse (default: None)
-        @param unique: how often to traverse the same element (default: None)
-        '''
-        tv = super(NodeRead, self).traverser(this, links, unique, tester)
-        return tv.traverse(this.element).nodes
-
-    def walker(self, this, direction=None, label=None, keys=None, end=None):
-        '''
-        iterate links and yield links
-
-        @param this: graph model instance
-        @param direction: direction of links (default: None)
-        @param label: label for links (default: None)
-        @param keys: keys to find on elements (default: None)
-        @param end: end of link to return (default: None)
-        '''
-        walker = super(NodeRead, self).walker(this, direction, label, keys)
-        for link in walker:
-            yield getattr(link, end)
-
-
-class NodeWrite(Write):
-
-    '''neo4j node writer'''
-
-    def build(self, data, link=None, other=None, callback=None, **kw):
-        '''
-        build a new graph node
-
-        @param link: link name
-        @param start: start node for link
-        @param end: end node for link
-        @param callback: callback function (default: None)
-        @param kw: keywords (default: None)
-        '''
-        db = self._db
-        with db.transaction:
-            # create node
-            node = db.node(**data)
-            # link back to reference
-            if link is not None and other is not None:
-                node.rels.create(link, other.element, **kw)
-            if callback is not None:
-                node = callback(node)
-        return node
-
-    def clone(self, this, model_link, callback=None, **kw):
-        '''
-        clone node
-
-        @param this: graph model instance
-        @param model_link: model link to clone
-        @param callback: callback function (default: None)
-        '''
-        # link list
-        links = []
-        # node id map
-        id_map = {}
-        # root node of fork
-        fork = None
-        db = self._db
-        node_func = db.node
-        with db.transaction:
-            # traverse outgoing nodes
-            for source in db.traversal().traverse(this.element).nodes:
-                # copy outgoing relationships
-                links.extend([link for link in source.rels.outgoing])
-                # copy node
-                target = node_func(**dict(source.items()))
-                # capture root this
-                if source.id == this.id:
-                    fork = target
-                    reference = this.n.reference()
-                    target.rels.create(
-                        this.C.reference_link, reference.element,
-                    )
-                # add to node map
-                id_map[source.id] = target.id
-            # copy relationships
-            for link in links:
-                node_func[id_map[link.start.id]].rels.create(
-                    link.type,
-                    node_func[id_map[link.end.id]],
-                    **dict(link.items())
-                )
-            # tie back to original
-            fork.rels.create(model_link, this.element, **kw)
-            if callback is not None:
-                fork = callback(fork)
-        return fork
-
-    def create_index(self, index, fts=False):
-        '''
-        create node index
-
-        @param index: index name
-        @param fts: create a full text index (default: False)
-        '''
-        db = self._db
-        kind = 'fulltext' if fts else None
-        with db.transaction:
-            index = db.nodes.indexes.create(index, type=kind)
-        return index
-
-    def delete_element(self, this, indices=None):
-        '''
-        delete graph element
-
-        @param this: graph model instance
-        @param index: graph index (default: None)
-        '''
-        db = self._db
-        element = this.element
-        with db.transaction:
-            if indices is not None:
-                for index in indices:
-                    del db.nodes.indexes.get(index)[element]
-            for link in element.rels:
-                link.delete()
-            element.delete()
-
-
-__all__ = ('LinkRead', 'LinkWrite', 'NodeRead', 'NodeWrite', 'embedded')

graphalchemy/backends/pytablesbe.py

+# -*- coding: utf-8 -*-
+'''pytables backend'''
+
+from __future__ import absolute_import
+
+import tables as tb
+from stuf.utils import get_or_default, getter
+
+from graphalchemy.core import Backend
+
+from .utils import BackendRead
+
+
+def hdf5(url):
+    '''
+    pytables database loader
+
+    @param url: path to database on file system
+    '''
+    return tb.openFile(url, 'a')
+
+
+class Read(BackendRead):
+
+    '''pytables reader base'''
+
+    @property
+    def root(self):
+        '''get root graph element'''
+        return self._db.root
+
+    def filter(self, index, queries, model=None):
+        '''
+        full text search using index
+
+        @param index: name of index
+        @param queries: queries build with query builder
+        @param model: element model (default: None)
+        '''
+        return self.one_or_all(self.index(index).query(queries), model)
+
+    def filter_by(self, index, key, value, callback=None):
+        '''
+        fetch graph elements filtered by keywords
+
+        @param index: index name
+        @param key: keyword in index
+        @param value: value in index (or second key)
+        @param callback: filter callback function (default: None)
+        '''
+        return self.one_or_all_and_close(
+            self.index(index)[key][value], callback,
+        )
+
+    def id(self, element):
+        '''
+        graph element identifier
+
+        @param element: a graph element
+        '''
+        return get_or_default(element, '_v_name', None)
+
+    def properties(self, element):
+        '''
+        get graph element properties
+
+        @param element: graph element
+        '''
+        return dict(
+            (k, element[k]) for k in element.dtype.names
+        ) if element is not None else {}
+
+    def raw(self, model, expr, **kw):
+        '''
+        fetch graph items with Cypher query language
+
+        @param model: graph model
+        @param express: Cypher query
+        @param **kw: variables for Cypher query
+        '''
+        return self.one_or_all(self._db.query(expr, **kw), model)
+
+    def traverser(self, this, tester=None, links=None, unique=None):
+        '''
+        build a traverse function
+
+        @param this: graph model instance
+        @param tester: filter for traversed elements (default: None)
+        @param links: links to traverse (default: None)
+        @param unique: how often to traverse the same element (default: None)
+        '''
+        tv = self._db.traversal()
+        if links is not None:
+            for link in links:
+                if len(link) == 2:
+                    tv = tv.relationships(*link)
+                else:
+                    tv = tv.relationships(link)
+        if unique is not None:
+            tv = tv.uniqueness(unique)
+        if tester is not None:
+            tv = tv.evaluator(tester)
+        return tv.traverse(this.element)
+
+    def walker(self, this, direction=None, label=None, keys=None):
+        '''
+        iterate over and yield links
+
+        @param this: graph model instance
+        @param direction: direction of links (default: None)
+        @param label: label for links (default: None)
+        @param keys: keys to find on elements (default: None)
+        '''
+        links = getattr(this.element, 'rels', [])
+        if label is not None:
+            links = self.get_links(links, label)
+        elif direction is not None:
+            links = self.get_links(links, direction)
+        for link in links:
+            if keys is not None:
+                if not {keys, link.keys()}.intersection():
+                    continue
+            yield link
+
+
+class Write(Backend):
+
+    '''pytables writer base'''
+
+    def delete_index(self, index):
+        '''
+        delete graph index
+
+        @param index: graph index
+        '''
+        with self._db.transaction:
+            self._db.nodes.indexes.get(index).delete()
+
+    def delete_property(self, this, key):
+        '''
+        delete graph element property
+
+        @param this: graph model instance
+        @param key: graph element property key
+        '''
+        this.delAttr(key)
+        self._db.flush()
+
+    def index_many(self, index, this, indexed, transaction=False):
+        '''
+        index properties on a graph element
+
+        @param index: graph index label
+        @param this: graph model instance
+        @param indexed: properties to index
+        @param transaction: run transaction in this call (default: False)
+        '''
+        def indexer(index, element, indexed):
+            for field in indexed:
+                index[field][element[field]] = element
+        if transaction:
+            with self._db.transaction:
+                indexer(index, this.element, indexed)
+        else:
+            indexer(index, this.element, indexed)
+
+    def index_one(self, index, key, value, this, transaction=False):
+        '''
+        index one property of a graph element
+
+        @param index: graph index label
+        @param key: graph element property key
+        @param value: graph element property value
+        @param this: graph model instance
+        @param transaction: use individual transaction (default: False)
+        '''
+        def indexer(index, key, value, element):
+            index[key][value] = element
+        if transaction:
+            with self._db.transaction:
+                indexer(index, key, value, this.element)
+        else:
+            indexer(index, key, value, this.element)
+
+    def update(self, this, data, callback=None):
+        '''
+        update a graph element's properties
+
+        @param this: graph model instance
+        @param data: cleaned data
+        @param callback: callback function (default: None)
+        '''
+        element = this.element
+        with self._db.transaction:
+            for k, v in data.iteritems():
+                element[k] = v
+            if callback is not None:
+                callback(element)
+
+
+class LinkRead(Read):
+
+    '''neo4j link reader'''
+
+    def get(self, element):
+        '''
+        get link by link id
+
+        @param element: element identifier
+        '''
+        return self._db.relationships[element]
+
+    def index(self, index):
+        '''
+        get link index by name
+
+        @param index: index name
+        '''
+        return self._db.relationships.indexes.get(index)
+
+    def kind(self, element):
+        '''
+        kind of link
+
+        @param element: a link graph element
+        '''
+        return getter(element, 'type')
+
+    def linked(self, this, key):
+        '''
+        search link for specified key
+
+        @param this: a link
+        @param key: key to search for
+        '''
+        for link in this.element.rels:
+            if key in link.keys():
+                return link
+        else:
+            return None
+
+    def traverser(self, this, tester=None, links=None, unique=None):
+        '''
+        build a traverse function
+
+        @param this: graph model instance
+        @param tester: filter for traversed elements (default: None)
+        @param links: links to traverse (default: None)
+        @param unique: how often to traverse the same element (default: None)
+        '''
+        tv = super(LinkRead, self).traverser(this, tester, links, unique)
+        return tv.traverse(this.element).relationships
+
+
+class LinkWrite(Write):
+
+    '''neo4j link writer'''
+
+    def build(self, link, start, end, callback=None, **kw):
+        '''
+        build a new graph link
+
+        @param link: link name
+        @param start: start node for link
+        @param end: end node for link
+        @param callback: callback function (default: None)
+        @param kw: keywords (default: None)
+        '''
+        with self._db.transaction:
+            this = start.element.rels.create(link, end.element, **kw)
+            if callback is not None:
+                this = callback(this)
+        return this
+
+    def create_index(self, index, fts=False):
+        '''
+        create link index
+
+        @param index: node index name
+        @param fts: create a full text index (default: False)
+        '''
+        db = self._db
+        kind = 'fulltext' if fts else None
+        with db.transaction:
+            db.relationships.indexes.create(index, type=kind)
+
+    def delete_element(self, this, indices=None):
+        '''
+        delete graph element
+
+        @param this: graph model instance
+        @param index: graph index (default: None)
+        '''
+        this.element.remove()
+        self._db.flush()
+
+
+class NodeRead(Read):
+
+    '''neo4j node reader'''
+
+    def get(self, element):
+        '''get node by link id'''
+        return self._db.nodes[element]
+
+    def index(self, index):
+        '''
+        get node lucene index by name
+
+        @param index: node index name
+        '''
+        return self._db.nodes.indexes.get(index)
+
+    def linked(self, this, key):
+        '''
+        get node from a node's links filtered by keywords
+
+        @param this: graph model instance
+        @param key: keyword in linked node
+        '''
+        for link in this.element.rels:
+            if key in link.end.keys():
+                return link.end
+            elif key in link.start.keys():
+                return link.start
+        else:
+            return None
+
+    def traverser(self, this, tester=None, links=None, unique=None):
+        '''
+        build a traverse function
+
+        @param this: graph model instance
+        @param tester: filter for traversed elements (default: None)
+        @param links: links to traverse (default: None)
+        @param unique: how often to traverse the same element (default: None)
+        '''
+        tv = super(NodeRead, self).traverser(this, links, unique, tester)
+        return tv.traverse(this.element).nodes
+
+    def walker(self, this, direction=None, label=None, keys=None, end=None):
+        '''
+        iterate links and yield links
+
+        @param this: graph model instance
+        @param direction: direction of links (default: None)
+        @param label: label for links (default: None)
+        @param keys: keys to find on elements (default: None)
+        @param end: end of link to return (default: None)
+        '''
+        walker = super(NodeRead, self).walker(this, direction, label, keys)
+        for link in walker:
+            yield getattr(link, end)
+
+
+class NodeWrite(Write):
+
+    '''neo4j node writer'''
+
+    def build(self, data, link=None, other=None, callback=None, **kw):
+        '''
+        build a new graph node
+
+        @param link: link name
+        @param start: start node for link
+        @param end: end node for link
+        @param callback: callback function (default: None)
+        @param kw: keywords (default: None)
+        '''
+        db = self._db
+        with db.transaction:
+            # create node
+            node = db.node(**data)
+            # link back to reference
+            if link is not None and other is not None:
+                node.rels.create(link, other.element, **kw)
+            if callback is not None:
+                node = callback(node)
+        return node
+
+    def clone(self, this, model_link, callback=None, **kw):
+        '''
+        clone node
+
+        @param this: graph model instance
+        @param model_link: model link to clone
+        @param callback: callback function (default: None)
+        '''
+        # link list
+        links = []
+        # node id map
+        id_map = {}
+        # root node of fork
+        fork = None
+        db = self._db
+        node_func = db.node
+        with db.transaction:
+            # traverse outgoing nodes
+            for source in db.traversal().traverse(this.element).nodes:
+                # copy outgoing relationships
+                links.extend([link for link in source.rels.outgoing])
+                # copy node
+                target = node_func(**dict(source.items()))
+                # capture root this
+                if source.id == this.id:
+                    fork = target
+                    reference = this.n.reference()
+                    target.rels.create(
+                        this.C.reference_link, reference.element,
+                    )
+                # add to node map
+                id_map[source.id] = target.id
+            # copy relationships
+            for link in links:
+                node_func[id_map[link.start.id]].rels.create(
+                    link.type,
+                    node_func[id_map[link.end.id]],
+                    **dict(link.items())
+                )
+            # tie back to original
+            fork.rels.create(model_link, this.element, **kw)
+            if callback is not None:
+                fork = callback(fork)
+        return fork
+
+    def create_index(self, index, fts=False):
+        '''
+        create node index
+
+        @param index: index name
+        @param fts: create a full text index (default: False)
+        '''
+        db = self._db
+        kind = 'fulltext' if fts else None
+        with db.transaction:
+            index = db.nodes.indexes.create(index, type=kind)
+        return index
+
+    def delete_element(self, this, indices=None):
+        '''
+        delete graph element
+
+        @param this: graph model instance
+        @param index: graph index (default: None)
+        '''
+        this.element.remove()
+        self._db.flush()
+
+
+__all__ = ('LinkRead', 'LinkWrite', 'NodeRead', 'NodeWrite', 'hdf5')