Skip to main content

Get a Pandas dataframe from SPARQL queries

Project description

https://img.shields.io/pypi/v/sparqldataframe.svg

A Python library that can send SPARQL queries to a SPARQL endpoint and retrieve a Pandas dataframe from the result.

Installation

pip install sparqldataframe

Usage

Here is an example how to run a SPARQL query on the Wikidata endpoint:

import sparqldataframe

sparql_query = """
SELECT ?item ?itemLabel
WHERE {
  ?item wdt:P31 wd:Q146.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
"""
df = sparqldataframe.query("https://query.wikidata.org/sparql", sparql_query)

Wikidata and DBPedia can be both used without adding the SPARQL endpoint url by using the wikidata_query() and dbpedia_query() functions respectively:

df = sparqldataframe.wikidata_query(sparql_query)
df = sparqldataframe.dbpedia_query(sparql_query)

License

This project is licensed under the MIT license. See the LICENSE for details.

Release history Release notifications

This version
History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
sparqldataframe-0.1.0-py3-none-any.whl (4.2 kB) Copy SHA256 hash SHA256 Wheel py3
sparqldataframe-0.1.0.tar.gz (2.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page