summaryrefslogtreecommitdiff
path: root/docs/persistence.rst
diff options
context:
space:
mode:
authorGunnar Aastrand Grimnes <gromgull@gmail.com>2013-04-13 09:50:30 +0200
committerGunnar Aastrand Grimnes <gromgull@gmail.com>2013-04-13 09:50:30 +0200
commitce02aaf0e2f7b6563edf8b3cddddba38b47f549a (patch)
treeaaea2d6cf70e27516790b256e6c407b8763019f3 /docs/persistence.rst
parent751c80335ab76d4be04d4a7c934fcc2ed12e0f51 (diff)
downloadrdflib-ce02aaf0e2f7b6563edf8b3cddddba38b47f549a.tar.gz
doc update, fixes #260.
Diffstat (limited to 'docs/persistence.rst')
-rw-r--r--docs/persistence.rst36
1 files changed, 20 insertions, 16 deletions
diff --git a/docs/persistence.rst b/docs/persistence.rst
index 4c231c16..41ae08fd 100644
--- a/docs/persistence.rst
+++ b/docs/persistence.rst
@@ -17,13 +17,24 @@ Stores currently supported in rdflib
Usage
^^^^^
-Store instances can be created with the :meth:`plugin` function:
+Most cases passing the name of the store to the Graph constrcutor is enough:
.. code-block:: python
- from rdflib import plugin
- from rdflib.store import Store
- plugin.get('.. one of the supported Stores ..',Store)(identifier=.. id of conjunctive graph ..)
+ from rdflib import Graph
+
+ graph = Graph(store='Sleepycat')
+
+
+If additional configuration of the store is required, a store instances can be created with the :meth:`plugin` function:
+
+.. code-block:: python
+
+ from rdflib import plugin, Store, Graph
+
+ store = plugin.get('.. one of the supported Stores ..',Store)(identifier=.. id of conjunctive graph ..)
+
+ graph = Graph(store=store)
Additional store plugins in ``rdfextras``
@@ -44,24 +55,17 @@ remove the database files that were created.
.. code-block:: python
- import rdflib
- from rdflib.graph import ConjunctiveGraph as Graph
- from rdflib import plugin
- from rdflib.store import Store, NO_STORE, VALID_STORE
- from rdflib.namespace import Namespace
- from rdflib.term import Literal
- from rdflib.term import URIRef
+ from rdflib import ConjunctiveGraph, plugin, Namespace, Literal, URIRef, Store
+ from rdflib.store import NO_STORE, VALID_STORE
+
from tempfile import mkdtemp
default_graph_uri = "http://rdflib.net/rdfstore"
configString = "/var/tmp/rdfstore"
- # Get the Sleepycat plugin.
- store = plugin.get('Sleepycat', Store)('rdfstore')
-
# Open previously created store, or create it if it doesn't exist yet
- graph = Graph(store="Sleepycat",
- identifier = URIRef(default_graph_uri))
+ graph = ConjunctiveGraph(store="Sleepycat",
+ identifier = default_graph_uri)
path = mkdtemp()
rt = graph.open(path, create=False)
if rt == NO_STORE: