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
To run the tests locally, a valid Stardog license is required and placed in the dockerfiles/stardog-license-key.bin
.
Docker and docker-compose are also required.
docker-compose up --exit-code-from tests
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file pystardog-0.10.0-py3-none-any.whl
.
File metadata
- Download URL: pystardog-0.10.0-py3-none-any.whl
- Upload date:
- Size: 32.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 508c8df14045fd83e53ed7b7683f5d2948aba17956a445078c150506ea07e1ed |
|
MD5 | 5996f9f5e393f11e29172c48735654c9 |
|
BLAKE2b-256 | 921cba932acedec827ec6625ccf4aaa091d8c7c4bf8000cee77273f1a6558e0e |