summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorNicholas Car <nicholas.car@surroundaustralia.com>2021-07-02 23:49:46 +1000
committerGitHub <noreply@github.com>2021-07-02 23:49:46 +1000
commitc59de84101830c3deced0032af1d5ae735728f1d (patch)
treec801a876e90b249440d338279d6b58629056a665 /docs
parente64a9fdcf31442265bdbecc5a56f933d68983d20 (diff)
parent2bedfbb38eef48666fd386ced19f6442db9eb5d2 (diff)
downloadrdflib-c59de84101830c3deced0032af1d5ae735728f1d.tar.gz
Merge branch 'master' into docco_clean
Diffstat (limited to 'docs')
-rw-r--r--docs/apidocs/examples.rst4
-rw-r--r--docs/intro_to_sparql.rst9
-rw-r--r--docs/persistence.rst25
-rw-r--r--docs/plugin_stores.rst2
4 files changed, 26 insertions, 14 deletions
diff --git a/docs/apidocs/examples.rst b/docs/apidocs/examples.rst
index f386408b..84a9bee9 100644
--- a/docs/apidocs/examples.rst
+++ b/docs/apidocs/examples.rst
@@ -58,10 +58,10 @@ These examples all live in ``./examples`` in the source-distribution of RDFLib.
:undoc-members:
:show-inheritance:
-:mod:`sleepycat_example` Module
+:mod:`berkeleydb_example` Module
--------------------------------
-.. automodule:: examples.sleepycat_example
+.. automodule:: examples.berkeleydb_example
:members:
:undoc-members:
:show-inheritance:
diff --git a/docs/intro_to_sparql.rst b/docs/intro_to_sparql.rst
index e80cae58..ef7aab78 100644
--- a/docs/intro_to_sparql.rst
+++ b/docs/intro_to_sparql.rst
@@ -16,8 +16,8 @@ Queries can be evaluated against a graph with the
:meth:`rdflib.graph.Graph.query` method, and updates with
:meth:`rdflib.graph.Graph.update`.
-A query method returns a :class:`rdflib.query.Result` instance. For
-``SELECT`` queries, iterating over this returns
+The query method returns a :class:`rdflib.query.Result` instance. For
+SELECT queries, iterating over this returns
:class:`rdflib.query.ResultRow` instances, each containing a set of
variable bindings. For ``CONSTRUCT``/``DESCRIBE`` queries, iterating over the
result object gives the triples. For ``ASK`` queries, iterating will yield
@@ -43,6 +43,8 @@ For example...
for row in qres:
print(f"{row.aname} knows {row.bname}")
+
+
The results are tuples of values in the same order as your ``SELECT``
arguments. Alternatively, the values can be accessed by variable
name, either as attributes, or as items, e.g. ``row.b`` and ``row["b"]`` are
@@ -122,6 +124,7 @@ example:
# y: a d:
+
Querying a Remote Service
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -147,6 +150,8 @@ The ``SERVICE`` keyword of SPARQL 1.1 can send a query to a remote SPARQL endpoi
for row in qres:
print(row.s)
+
+
This example sends a query to `DBPedia <https://dbpedia.org/>`_'s SPARQL endpoint service so that it can run the query
and then send back the result:
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.
diff --git a/docs/plugin_stores.rst b/docs/plugin_stores.rst
index a936c54e..8fd511d3 100644
--- a/docs/plugin_stores.rst
+++ b/docs/plugin_stores.rst
@@ -14,6 +14,6 @@ SimpleMemory :class:`~rdflib.plugins.stores.memory.SimpleMemory`
Memory :class:`~rdflib.plugins.stores.memory.Memory`
SPARQLStore :class:`~rdflib.plugins.stores.sparqlstore.SPARQLStore`
SPARQLUpdateStore :class:`~rdflib.plugins.stores.sparqlstore.SPARQLUpdateStore`
-Sleepycat :class:`~rdflib.plugins.stores.sleepycat.Sleepycat`
+BerkeleyDB :class:`~rdflib.plugins.stores.berkeleydb.BerkeleyDB`
default :class:`~rdflib.plugins.stores.memory.Memory`
================= ============================================================