Skip to main content

sparqldataframe

image

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 = """
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>

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.

Metadata

Release files for sparqldataframe 0.1.3

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

Source distribution (sdist)

Source distribution for sparqldataframe 0.1.3
File Size Uploaded Provenance
sparqldataframe-0.1.3.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sparqldataframe 0.1.3
File Interpreter ABI Platform
sparqldataframe-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / sparqldataframe-0.1.3.tar.gz

Download URL sparqldataframe-0.1.3.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e89e366e1a83a0a2c5037c772b6e360dbb9d82bf8b3fb50b756149600e51f606
BLAKE2b-256 checksum
How to use checksums
45f027db45ada67ceff4c4b5d717ac1aeaf7bf5ed6d92c1a0a270d51743ce84e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / sparqldataframe-0.1.3-py3-none-any.whl

Download URL sparqldataframe-0.1.3-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a723aaa1a5568b17dc6a6ae41cbe5e18ec2dee0642e64eaccd11387de048dc2d
BLAKE2b-256 checksum
How to use checksums
10e06610cbb1e9d2962fef97d52a9144dd36d9f2d95ca809b17742680ffc89ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for sparqldataframe 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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