Skip to main content

Use Stardog with Python!

Project description

pystardog

Python wrapper for communicating with the Stardog HTTP server.

What is it?

This framework wraps all the functionality of a client for the Stardog Knowledge Graph, and provides access to a full set of functions such as executing SPARQL queries, administrative tasks on Stardog, and the use of the Reasoning API.

The implementation uses the HTTP protocol, since most of Stardog functionality is available using this protocol. For more information, go to the Stardog's HTTP Programming documentation.

Installation

pystardog is on PyPI so all you need is: pip install pystardog

Documentation

Documentation is readable at Read the Docs or can be built using Sphinx:

pip install -r requirements.txt
cd docs
make html

Tests

Create a virtual environment:

virtualenv -p $(which python3) venv

Activate the virtualenv:

$ . venv/bin/activate
(venv) $

Install the dependencies

pip install -r requirements.txt

Run the tests

python setup.py test

Quick Example

import stardog

conn_details = {
  'endpoint': 'http://localhost:5820',
  'username': 'admin',
  'password': 'admin'
}

with stardog.Admin(**conn_details) as admin:
  db = admin.new_database('db')

  with stardog.Connection('db', **conn_details) as conn:
    conn.begin()
    conn.add(stardog.content.File('./test/data/example.ttl'))
    conn.commit()
    results = conn.select('select * { ?a ?p ?o }')

  db.drop()

Interactive Tutorial

There is a Jupyter notebook and instructions in the notebooks directory of this repository.

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pystardog-0.9.8-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file pystardog-0.9.8-py3-none-any.whl.

File metadata

  • Download URL: pystardog-0.9.8-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

File hashes

Hashes for pystardog-0.9.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6181602109133b8cc8b11ccc92b4f60b860f6182a84f7760af740726d16d703b
MD5 2d9638d7ad9a29f1f2fbed9974bb35b0
BLAKE2b-256 b7d5a6e7553c1bb48f6ef1b87e9968f397bfbeffc0415da76fc961b33ba1e879

See more details on using hashes here.

Supported by

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