Skip to content

Commit 9ac1cb2

Browse files
committed
more docs for SPARQLStore
1 parent 4065a5e commit 9ac1cb2

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

rdflib/plugins/stores/sparqlstore.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ def _node_to_sparql(node):
3838

3939

4040
class SPARQLStore(SPARQLConnector, Store):
41-
"""
42-
An RDFLib store around a SPARQL endpoint
41+
"""An RDFLib store around a SPARQL endpoint
4342
44-
This is in theory context-aware and should work as expected
43+
This is context-aware and should work as expected
4544
when a context is specified.
4645
4746
For ConjunctiveGraphs, reading is done from the "default graph". Exactly
@@ -51,7 +50,7 @@ class SPARQLStore(SPARQLConnector, Store):
5150
motivated by the SPARQL 1.1.
5251
5352
Fuseki/TDB has a flag for specifying that the default graph
54-
is the union of all graphs (tdb:unionDefaultGraph in the Fuseki config).
53+
is the union of all graphs (``tdb:unionDefaultGraph`` in the Fuseki config).
5554
5655
.. warning:: By default the SPARQL Store does not support blank-nodes!
5756
@@ -61,9 +60,9 @@ class SPARQLStore(SPARQLConnector, Store):
6160
6261
See http://www.w3.org/TR/sparql11-query/#BGPsparqlBNodes
6362
64-
You can make use of such extensions through the node_to_sparql and
65-
node_from_result arguments. For example if you want to transform
66-
BNode('0001') into "<bnode:b0001>", you can use a function like this:
63+
You can make use of such extensions through the ``node_to_sparql``
64+
argument. For example if you want to transform BNode('0001') into
65+
"<bnode:b0001>", you can use a function like this:
6766
6867
>>> def my_bnode_ext(node):
6968
... if isinstance(node, BNode):
@@ -72,6 +71,22 @@ class SPARQLStore(SPARQLConnector, Store):
7271
>>> store = SPARQLStore('http://dbpedia.org/sparql',
7372
... node_to_sparql=my_bnode_ext)
7473
74+
You can request a particular result serialization with the
75+
``returnFormat`` parameter. This is a string that must have a
76+
matching plugin registered. Built in is support for ``xml``,
77+
``json``, ``csv``, ``tsv`` and ``application/rdf+xml``.
78+
79+
The underlying SPARQLConnector builds in the requests library.
80+
Any extra kwargs passed to the SPARQLStore connector are passed to
81+
requests when doing HTTP calls. I.e. you have full control of
82+
cookies/auth/headers.
83+
84+
Form example:
85+
86+
>>> SPARQLStore('...my endpoint ...', auth=(user,pass))
87+
88+
will use HTTP basic auth.
89+
7590
"""
7691
formula_aware = False
7792
transaction_aware = False

0 commit comments

Comments
 (0)