rdflib stores based on pyoxigraph
Project description
Oxrdflib
Oxrdflib provides rdflib stores using pyoxigraph.
The stores could be used as drop-in replacements of the rdflib default ones. They supports context but not formulas. Transaction support is not implemented yet.
SPARQL query evaluation is done by pyoxigraph instead of rdflib if a oxrdflib store is used.
Two stores are currently provided:
- An in-memory store, named
"OxMemory"
. - A disk-based store based on the Sled key-value store, named
"OxSled"
.
Oxrdflib is available on Pypi and installable with:
pip install oxrdflib
The oxrdflib stores are automatically registered as rdflib store plugins by setuptools.
API
"OxMemory"
, an in-memory store
To create a rdflib graph with pyoxigraph in memory store use
rdflib.Graph(store="OxMemory")
instead of the usual
rdflib.Graph()
Similarly, to get a conjunctive graph, use
rdflib.ConjunctiveGraph(store="OxMemory")
instead of the usual
rdflib.ConjunctiveGraph()
"OxSled"
, a disk-based store
The disk-based store is based on the Sled key-value store. Sled is not stable yet and its storage system might change in the future.
To open Sled based graph in the directory test_dir
use
rdflib.Graph(store="OxSled", "test_dir")
The store is closed with the close()
method or automatically when Python garbage collector collects the store object.
It is also possible to not provide a directory name. In this case, a temporary directory will be created and deleted when the store is closed. For example, this code uses a temporary directory:
rdflib.Graph(store="OxSled")
rdflib.ConjunctiveGraph
is also usable with "OxSled"
.
Development
To run the test do first pip install -e
to register the stores in rdflib plugin registry.
Then, cd tests && python -m unittest
should run the tests.
The code is automatically formatted using black. A pre-commit configuration is provided.
Run pip install pre-commit && pre-commit install
to install pre-commit as a git pre-commit hook in your clone.
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 Distribution
Built Distribution
Hashes for oxrdflib-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 338e70d689dc668104ce60b301e084307a6e31c717f11e3ef43d6f664a0bd9b8 |
|
MD5 | 4a63aba480506c5e961bdbe5ec05ad2f |
|
BLAKE2b-256 | 758e352707d587d35688a9669348e8c86ad9a568a9de938e4256b3204014e911 |