Skip to main content

Write your SPARQL query directly in the JSON-LD you would like to have in output

Project description

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/@id using the $anchor modifier.

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.

BIB file

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SPARQLTransformer-2.2.0.tar.gz (8.6 kB view details)

Uploaded Source

File details

Details for the file SPARQLTransformer-2.2.0.tar.gz.

File metadata

  • Download URL: SPARQLTransformer-2.2.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.6

File hashes

Hashes for SPARQLTransformer-2.2.0.tar.gz
Algorithm Hash digest
SHA256 623405b455854713c9dacc4d3269ba754865d1927a4ca548310c2688970591d5
MD5 7afb587507578a7664da0e4fda3a20a1
BLAKE2b-256 3a2fc5e0717e5108d951755b9be34df75d9693207ddfe9272ce8737c0ac6a5b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page