Skip to main content

Py SPARQL Transformer

Write your SPARQL query directly in the JSON-LD you would like to have in output. Python version of SPARQL Transformer for JavaScript.

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-LD format. The JSON-LD can be:

  • an already parsed JS object (or defined real time),
  • ONLY if running in NodeJS, 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 test.js for further examples.

Credits

If you use this module for your research work, please cite:

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

BIB file


1: Using virtuoso-sparql-client.

Metadata

Release files for SPARQLTransformer 1.6.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SPARQLTransformer 1.6.6
File Size Uploaded
SPARQLTransformer-1.6.6.tar.gz 6.8 kB Details

Release files / SPARQLTransformer-1.6.6.tar.gz

Download URL SPARQLTransformer-1.6.6.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
89e111ec6de81b0e4e0296fd4223b7e5362b8ad4fd47c9c37fd4f64d92466688
BLAKE2b-256 checksum
How to use checksums
2bcc2a9445b6d07b4e6993d20f75ffacd7b35b807538cd17a478c5d2c4e1de14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.20.0 CPython/3.6.4

Release history Release notifications | RSS feed

2.4.0

2 release files

2.3.0

1 release file

2.2.2

1 release file

2.2.1

1 release file

2.2.0

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.10.0

1 release file

1.9.0

1 release file

1.8.2

1 release file

1.8.1

1 release file

1.7.1

1 release file

1.7.0

1 release file

1.6.13

1 release file

1.6.12

1 release file

1.6.11

1 release file

1.6.10

1 release file

1.6.9

1 release file

1.6.8

1 release file

1.6.7

1 release file

This release

1.6.6 This release

1 release file

1.6.5

1 release file

1.6.4

1 release file

1.6.3

1 release file

1.6.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page