Skip to main content

Python API to query a SPARQL endpoint

Project description

sparql-client is a library to query a SPARQL endpoint. It will automatically convert literals to the coresponding Python types.

Visit http://www.eionet.europa.eu/software/sparql-client/ for documentation and examples.

API

First you open a connection to the endpoint:

s = sparql.Service(endpoint)

Then you make the query:

result = s.query(statement)

If you have made a SELECT query, then you can read the result with fetchone() or fetchall():

for row in result.fetchone():

If you have made an ASK query, then you can read the result (a boolean value) with hasresult():

works = result.hasresult()

Conversion of data types

The library will automatically convert typed literals to a coresponding simple type in Python. Dates are also converted if the dateutil library is available.

Running the unit tests

If you have nose installed, just run nosetests in the top-level directory. Some tests require the python-dateutil (version 1.5) or mock libraries. Tested under Python 2.4 through 2.7.

License

The contents of this package are subject to the Mozilla Public License Version 1.1 (the “License”); you may not use this package except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is SPARQL client version 1.0.

The Initial Owner of the Original Code is European Environment Agency (EEA). Portions created by Eau de Web for EEA are Copyright (C) European Environment Agency. All Rights Reserved.

Authors

  • Søren Roug, EEA

  • Alex Morega, Eau de Web

Changelog

0.9 (2011-10-24)

  • New argument convert_type for unpack_row [moregale]

0.8 (2011-08-29)

  • First version available on PyPI [roug, moregale]

Project details


Download files

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

Source Distributions

sparql-client-0.10.zip (11.9 kB view details)

Uploaded Source

sparql-client-0.9.zip (8.2 kB view details)

Uploaded Source

File details

Details for the file sparql-client-0.10.zip.

File metadata

  • Download URL: sparql-client-0.10.zip
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sparql-client-0.10.zip
Algorithm Hash digest
SHA256 376fa7b5438afb26bedc22985a58781aa752d26bab6bcfbf00fc19e9a82ada9f
MD5 cf9607419e9e2b5802a30cda79f3f3a3
BLAKE2b-256 e2f2191c3ef1fc0408ae93d0b77853825999b2f93bc8296d3e82815b5227c475

See more details on using hashes here.

File details

Details for the file sparql-client-0.9.zip.

File metadata

  • Download URL: sparql-client-0.9.zip
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sparql-client-0.9.zip
Algorithm Hash digest
SHA256 883669c03706e404e68f358a4c39f8e975f9587389af069d69cc5dfed9666fc4
MD5 7ac8c7f409c6a085f11baebf4821252d
BLAKE2b-256 2040afe90fa088ced9a9dbb13e3dd05e585cc5d4f792520a9543070f62976956

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