This module implements a parser and serializer for the CSV SPARQL result formats
http://www.w3.org/TR/sparql11-results-csv-tsv/
Bases: rdflib.query.ResultParser
Thin abstraction layer over the different available modules for decoding and encoding JSON data.
The default behavior is to use simplejson if installed, and otherwise fallback to the standard library module. To explicitly tell SPARQLWrapper which module to use, invoke the use() function with the module name:
import jsonlayer
jsonlayer.use('cjson')
In addition to choosing one of the above modules, you can also configure SPARQLWrapper to use custom decoding and encoding functions:
import jsonlayer
jsonlayer.use(decode=my_decode, encode=my_encode)
Decode the given JSON string.
Parameters: | string (basestring) – the JSON string to decode |
---|---|
Returns: | the corresponding Python data structure |
Return type: | object |
Encode the given object as a JSON string.
Parameters: | obj (object) – the Python data structure to encode |
---|---|
Returns: | the corresponding JSON string |
Return type: | basestring |
Set the JSON library that should be used, either by specifying a known module name, or by providing a decode and encode function.
The modules “simplejson”, “cjson”, and “json” are currently supported for the module parameter.
If provided, the decode parameter must be a callable that accepts a JSON string and returns a corresponding Python data structure. The encode callable must accept a Python data structure and return the corresponding JSON string. Exceptions raised by decoding and encoding should be propagated up unaltered.
Parameters: |
---|
Bases: rdflib.query.Result
Bases: rdflib.query.ResultParser
Bases: rdflib.query.ResultSerializer
rdflib object (Literal, URIRef, BNode) for the given json-format dict.
Bases: rdflib.query.Result
This implements the Tab Separated SPARQL Result Format
It is implemented with pyparsing, reusing the elements from the SPARQL Parser
A Parser for SPARQL results in XML:
http://www.w3.org/TR/rdf-sparql-XMLres/
Bits and pieces borrowed from: http://projects.bigasterisk.com/sparqlhttp/
Authors: Drew Perttula, Gunnar Aastrand Grimnes
Python saxutils-based SPARQL XML Writer
Bases: rdflib.query.Result
Bases: rdflib.query.ResultParser
Bases: rdflib.query.ResultSerializer