diff options
| author | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2018-11-01 10:04:46 +0100 |
|---|---|---|
| committer | Gunnar Aastrand Grimnes <gromgull@gmail.com> | 2018-11-01 10:13:15 +0100 |
| commit | 2aceef54c6c39d24c20bac04131c7125bae08e25 (patch) | |
| tree | 0606a4242141ecaae676967734b0983d551253e4 | |
| parent | 4065a5ec6fc3eaeaefabc04573ba9462bda72743 (diff) | |
| download | rdflib-sparqlstore_improvements.tar.gz | |
more docs for SPARQLStoresparqlstore_improvements
| -rw-r--r-- | rdflib/plugins/stores/sparqlstore.py | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/rdflib/plugins/stores/sparqlstore.py b/rdflib/plugins/stores/sparqlstore.py index 903d40b9..3c497c9f 100644 --- a/rdflib/plugins/stores/sparqlstore.py +++ b/rdflib/plugins/stores/sparqlstore.py @@ -38,10 +38,9 @@ def _node_to_sparql(node): class SPARQLStore(SPARQLConnector, Store): - """ - An RDFLib store around a SPARQL endpoint + """An RDFLib store around a SPARQL endpoint - This is in theory context-aware and should work as expected + This is context-aware and should work as expected when a context is specified. For ConjunctiveGraphs, reading is done from the "default graph". Exactly @@ -51,7 +50,7 @@ class SPARQLStore(SPARQLConnector, Store): motivated by the SPARQL 1.1. Fuseki/TDB has a flag for specifying that the default graph - is the union of all graphs (tdb:unionDefaultGraph in the Fuseki config). + is the union of all graphs (``tdb:unionDefaultGraph`` in the Fuseki config). .. warning:: By default the SPARQL Store does not support blank-nodes! @@ -61,9 +60,9 @@ class SPARQLStore(SPARQLConnector, Store): See http://www.w3.org/TR/sparql11-query/#BGPsparqlBNodes - You can make use of such extensions through the node_to_sparql and - node_from_result arguments. For example if you want to transform - BNode('0001') into "<bnode:b0001>", you can use a function like this: + You can make use of such extensions through the ``node_to_sparql`` + argument. For example if you want to transform BNode('0001') into + "<bnode:b0001>", you can use a function like this: >>> def my_bnode_ext(node): ... if isinstance(node, BNode): @@ -72,6 +71,22 @@ class SPARQLStore(SPARQLConnector, Store): >>> store = SPARQLStore('http://dbpedia.org/sparql', ... node_to_sparql=my_bnode_ext) + You can request a particular result serialization with the + ``returnFormat`` parameter. This is a string that must have a + matching plugin registered. Built in is support for ``xml``, + ``json``, ``csv``, ``tsv`` and ``application/rdf+xml``. + + The underlying SPARQLConnector builds in the requests library. + Any extra kwargs passed to the SPARQLStore connector are passed to + requests when doing HTTP calls. I.e. you have full control of + cookies/auth/headers. + + Form example: + + >>> SPARQLStore('...my endpoint ...', auth=('user','pass')) + + will use HTTP basic auth. + """ formula_aware = False transaction_aware = False |
