diff options
author | Nicholas Car <nicholas.car@surroundaustralia.com> | 2021-07-02 23:49:46 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-02 23:49:46 +1000 |
commit | c59de84101830c3deced0032af1d5ae735728f1d (patch) | |
tree | c801a876e90b249440d338279d6b58629056a665 /docs/persistence.rst | |
parent | e64a9fdcf31442265bdbecc5a56f933d68983d20 (diff) | |
parent | 2bedfbb38eef48666fd386ced19f6442db9eb5d2 (diff) | |
download | rdflib-c59de84101830c3deced0032af1d5ae735728f1d.tar.gz |
Merge branch 'master' into docco_clean
Diffstat (limited to 'docs/persistence.rst')
-rw-r--r-- | docs/persistence.rst | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/docs/persistence.rst b/docs/persistence.rst index 6b373580..43c56176 100644 --- a/docs/persistence.rst +++ b/docs/persistence.rst @@ -19,10 +19,10 @@ this API for a different store. Stores currently shipped with core RDFLib ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* :class:`Memory <rdflib.plugins.stores.memory.Memory>` (not persistent!) -* :class:`~rdflib.plugins.stores.sleepycat.Sleepycat` (on disk persistence via Python's :ref:`bsddb` or :ref:`bsddb3` packages) -* :class:`~rdflib.plugins.stores.sparqlstore.SPARQLStore` - a read-only wrapper around a remote SPARQL Query endpoint. -* :class:`~rdflib.plugins.stores.sparqlstore.SPARQLUpdateStore` - a read-write wrapper around a remote SPARQL query/update endpoint pair. +* :class:`Memory <rdflib.plugins.stores.memory.Memory>` - not persistent! +* :class:`~rdflib.plugins.stores.berkeleydb.BerkeleyDB` - on disk persistence via Python's `berkeleydb package <https://pypi.org/project/berkeleydb/>`_ +* :class:`~rdflib.plugins.stores.sparqlstore.SPARQLStore` - a read-only wrapper around a remote SPARQL Query endpoint +* :class:`~rdflib.plugins.stores.sparqlstore.SPARQLUpdateStore` - a read-write wrapper around a remote SPARQL query/update endpoint pair Usage ^^^^^ @@ -33,7 +33,7 @@ In most cases, passing the name of the store to the Graph constructor is enough: from rdflib import Graph - graph = Graph(store='Sleepycat') + graph = Graph(store='BerkeleyDB') Most stores offering on-disk persistence will need to be opened before reading or writing. @@ -42,13 +42,20 @@ an identifier with which you can open the graph: .. code-block:: python - graph = Graph('Sleepycat', identifier='mygraph') + graph = Graph('BerkeleyDB', identifier='mygraph') # first time create the store: - graph.open('/home/user/data/myRDFLibStore', create = True) + graph.open('/home/user/data/myRDFLibStore', create=True) # work with the graph: - graph.add( mytriples ) + data = """ + PREFIX : <https://example.org/> + + :a :b :c . + :d :e :f . + :d :g :h . + """ + graph.parse(data=data, format="ttl") # when done! graph.close() @@ -70,5 +77,5 @@ More store implementations are available in RDFLib extension projects: Example ^^^^^^^ -* :mod:`examples.sleepycat_example` contains an example for using a Sleepycat store. +* :mod:`examples.berkeleydb_example` contains an example for using a BerkeleyDB store. * :mod:`examples.sparqlstore_example` contains an example for using a SPARQLStore. |