kapps-triplestore-interface#
This library turns SPARQL queries and updates against a running GraphDB triplestore into callable Python methods. Three research projects run it in production.
Installation#
pip install kapps-triplestore-interface
Or, from a clone of this repository:
uv sync
Getting Started#
The package uses a single class named GraphDB. To use the interface, create an object from
this class:
from kapps_triplestore_interface import GraphDB, GraphDBCredentials
credentials = GraphDBCredentials(
base_url="<your_graph_db_url>",
username="<your_graph_db_user>",
password="<your_graph_db_password>",
repository="<your_selected_repository_id>",
)
my_db = GraphDB(credentials=credentials)
Running Tests#
The test suite expects a running GraphDB instance and uses a dedicated test repository.
Required environment variables for tests:
GRAPHDB_URLGRAPHDB_USERNAMEGRAPHDB_PASSWORDGRAPHDB_TEST_REPOSITORY
Example:
export GRAPHDB_URL="http://localhost:7200"
export GRAPHDB_USERNAME="admin"
export GRAPHDB_PASSWORD="root"
export GRAPHDB_TEST_REPOSITORY="test-repo"
uv run pytest tests -v
Note: application/runtime credentials loaded via GraphDBCredentials.from_env() still use
GRAPHDB_REPOSITORY by default.
Contributing#
Development happens in a private repository at KIT. This GitHub repository is a publish target. A pull request opened here cannot be merged back. Raise an issue instead, or contact the maintainers.
Origin#
This is a renamed fork of
JaFeKl/graph_db_interface by Jan-Felix Klein,
last released as graph-db-interface 2.0.1 on
PyPI under an MIT license. It is maintained here, and changes since then are listed in
CHANGELOG.md.
Migration from graph-db-interface#
Change your dependency from
graph-db-interfacetokapps-triplestore-interface.Change imports from
from graph_db_interface import ...tofrom kapps_triplestore_interface import ....If you catch it, change
GraphDBInterfaceErrortoTripleStoreInterfaceError.
License#
The package is licensed under the MIT license.
Acknowledgements#
This package is developed as part of the INF subproject of the CRC 1574: Circular Factory for the Perpetual Product. This work is therefore supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) [grant-number: SFB-1574-471687386].