diff options
author | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2013-04-13 09:50:30 +0200 |
---|---|---|
committer | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2013-04-13 09:50:30 +0200 |
commit | ce02aaf0e2f7b6563edf8b3cddddba38b47f549a (patch) | |
tree | aaea2d6cf70e27516790b256e6c407b8763019f3 | |
parent | 751c80335ab76d4be04d4a7c934fcc2ed12e0f51 (diff) | |
download | rdflib-ce02aaf0e2f7b6563edf8b3cddddba38b47f549a.tar.gz |
doc update, fixes #260.
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | docs/assorted_examples.rst | 3 | ||||
-rw-r--r-- | docs/gettingstarted.rst | 7 | ||||
-rw-r--r-- | docs/graphs_bnodes.rst | 3 | ||||
-rw-r--r-- | docs/intro_to_graphs.rst | 2 | ||||
-rw-r--r-- | docs/intro_to_sparql.rst | 14 | ||||
-rw-r--r-- | docs/persistence.rst | 36 |
7 files changed, 40 insertions, 34 deletions
@@ -67,11 +67,13 @@ are listed on [PyPi](pypi.python.org/pypi/rdflib/) RDFLib has a plugin-architecture for store-implementation, as well as parsers/serializers, several other projects exist which extend RDFLib features: - * [rdfextras](https://github.com/RDFLib/rdfextras) - for SPARQL Support + * [rdflib-sparql](https://github.com/RDFLib/rdflib-sparql) - for SPARQL Support * [rdflib-json](https://github.com/RDFLib/rdflib-jsonld) - Serializer and parser for [json-ld](http://json-ld.org) * [rdflib-sparqlstore](https://github.com/RDFLib/rdflib-sparqlstore) - a store implementation on top of a SPARQL endpoint accessed over HTTP * [rdflib-mysql](https://github.com/RDFLib/rdflib-mysql) - a store implementation of top of MySQL + * [rdfextras](https://github.com/RDFLib/rdfextras) - additional experimental plugins and tools + Support ------- @@ -84,11 +86,6 @@ Continuous integration status details available from travis.ci: [![Build Status](https://travis-ci.org/RDFLib/rdflib.png?branch=master)](https://travis-ci.org/RDFLib/rdflib) -The RDFExtras project offers several additional stores as well as a -SPARQL engine for use with RDFLib: - -https://github.com/RDFLib/rdfextras/ - The documentation can be built by doing:: $ python setup.py build_sphinx diff --git a/docs/assorted_examples.rst b/docs/assorted_examples.rst index 961f6daf..d6404bc5 100644 --- a/docs/assorted_examples.rst +++ b/docs/assorted_examples.rst @@ -43,8 +43,7 @@ fold_sha1.py might be easier to do some operations on. """ - from rdflib.graph import Graph - from rdflib import Namespace + from rdflib import Graph, Namespace FOAF = Namespace("http://xmlns.com/foaf/0.1/") STABLE = Namespace("http://example.com/person/mbox_sha1sum/") diff --git a/docs/gettingstarted.rst b/docs/gettingstarted.rst index afe05cb9..56e05d6d 100644 --- a/docs/gettingstarted.rst +++ b/docs/gettingstarted.rst @@ -11,7 +11,7 @@ RDFLib is open source and is maintained in a `GitHub <http://github.com/RDFLib/rdflib/>`_ repository. RDFLib releases, current and previous are listed on `PyPi <pypi.python.org/pypi/rdflib/>`_ -RDFLib may be easy_installed: +The best way to install RDFLib is to use easy_install or pip: .. code-block :: bash @@ -57,9 +57,7 @@ A more extensive example: .. code-block:: python - from rdflib.graph import Graph - from rdflib import Literal, BNode, Namespace - from rdflib import RDF + from rdflib import Graph, Literal, BNode, Namespace, RDF g = Graph() @@ -89,3 +87,4 @@ A more extensive example: for mbox in g.objects(person, FOAF["mbox"]): print(mbox) +Additional examples can be found in the examples folder in the source distribution. diff --git a/docs/graphs_bnodes.rst b/docs/graphs_bnodes.rst index 1f931bce..61c5a8aa 100644 --- a/docs/graphs_bnodes.rst +++ b/docs/graphs_bnodes.rst @@ -11,8 +11,7 @@ Clarifying the query more precisely: .. code-block:: pycon - >>> from rdflib.graph import Graph, ConjunctiveGraph - >>> from rdflib import URIRef + >>> from rdflib import Graph, ConjunctiveGraph, URIRef [1] diff --git a/docs/intro_to_graphs.rst b/docs/intro_to_graphs.rst index 870e3a29..c4634276 100644 --- a/docs/intro_to_graphs.rst +++ b/docs/intro_to_graphs.rst @@ -18,7 +18,7 @@ In an interactive python interpreter, try this: .. code-block:: pycon - >>> from rdflib.graph import Graph + >>> from rdflib import Graph >>> g = Graph() >>> g.parse("demo.nt", format="nt") <Graph identifier=HCbubHJy0 (<class 'rdflib.graph.Graph'>)> diff --git a/docs/intro_to_sparql.rst b/docs/intro_to_sparql.rst index 3745139d..1032d891 100644 --- a/docs/intro_to_sparql.rst +++ b/docs/intro_to_sparql.rst @@ -11,7 +11,7 @@ You might parse some files into a new graph (see `Introduction to parsing <intro .. code-block:: python - from rdflib.graph import Graph + from rdflib import Graph g = Graph() g.parse("http://bigasterisk.com/foaf.rdf") g.parse("http://www.w3.org/People/Berners-Lee/card.rdf") @@ -20,7 +20,7 @@ LiveJournal produces FOAF data for their users, but they seem to use ``foaf:memb .. code-block:: python - from rdflib.namespace import Namespace + from rdflib import Namespace FOAF = Namespace("http://xmlns.com/foaf/0.1/") g.parse("http://danbri.livejournal.com/data/foaf") [g.add((s, FOAF['name'], n)) @@ -31,12 +31,20 @@ Run a Query The ``rdflib`` package concentrates on providing the core RDF types and interfaces for working with RDF. As indicated in the introduction, the package defines a plugin interface (for parsers, stores, and serializers) that other packages can use to implement parsers, stores, and serializers that will plug into the ``rdflib`` package. -In order to perform SPARQL queries, you need to install the companion ``rdfextras`` package which includes a SPARQL plugin implementation: +In order to perform SPARQL queries, you need to install a SPARQL plugin implementation: either the old ``rdfextras`` package, or the new ``rdflib-sparql``, i.e. either: .. code-block:: bash $ easy_install rdfextras +or + +.. code-block:: bash + + $ easy_install rdflib-sparql + + + If installed with setuptools this automatically binds the the imported SPARQL query processor implementation to the :meth:`rdflib.graph.Graph.query` method, which can then be passed a SPARQL query (a string). When called, the :meth:`~rdflib.graph.Graph.query` method returns a SPARQLQuery object whose ``result`` attribute is a list of results. Continuing the example... 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: |