Py SPARQL Transformer
Write your SPARQL query directly in the JSON-LD you would like to have in output.
Looking for the JavaScript Version?
News
- It is now possible to set a different merging anchor instead of
id/@idusing the$anchormodifier.
Table of Contents
How to use
Install by pip.
pip install SPARQLTransformer
Use in your JS application (node or browser).
from SPARQLTransformer import sparqlTransformer
out = sparqlTransformer(query, options)
The first parameter (query) is the query in the JSON format. The JSON can be:
- an already parsed (or defined real time)
dict, - the local path of a JSON file (that will then be read and parsed).
The options parameter is optional, and can define the following:
| OPTION | DEFAULT | NOTE |
|---|---|---|
| context | http://schema.org/ | The value in @context. It overwrites the one in the query. |
| sparqlFunction | None |
A function receiving in input the transformed query in SPARQL, returning a Promise. If not specified, the module performs the query on its own1 against the specified endpoint. |
| endpoint | http://dbpedia.org/sparql | Used only if sparqlFunction is not specified. |
| debug | False |
Enter in debug mode. This allow to print in console the generated SPARQL query. |
See tests.py for further examples.
Credits
If you use this module for your research work, please cite:
Pasquale Lisena, Albert Meroño-Peñuela, Tobias Kuhn and Raphaël Troncy. Easy Web API Development with SPARQL Transformer. In 18th International Semantic Web Conference (ISWC), Auckland, New Zealand, October 26-30, 2019.
Pasquale Lisena and Raphaël Troncy. Transforming the JSON Output of SPARQL Queries for Linked Data Clients. In WWW'18 Companion: The 2018 Web Conference Companion, April 23–27, 2018, Lyon, France. https://doi.org/10.1145/3184558.3188739
Metadata
Release files for SPARQLTransformer 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| SPARQLTransformer-1.10.0.tar.gz | 8.0 kB | Details |
Release files / SPARQLTransformer-1.10.0.tar.gz
| Download URL | SPARQLTransformer-1.10.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b10c5989de12135fda83f269918b179b8b165bcbbf0e1fcfde1e57b084f16480
|
|
BLAKE2b-256 checksum How to use checksums |
194a39121c61ac69b7978305b7c3cf1c0a378a45c904d17f77efe1d4d0946b77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
|