Skip to main content

SPOLStore

A Python RDFLib store that stores RDF data on a simple Subject-Predicate-Object-Literal basis, with all literals fulltext indexed using the SQLite FTS5.

Usage

First install the package, this can be done with:

pip install spolstore

Before you can use it, it needs to be opened by specifying where on the filesystem the sqlite database containing the graph is. To use this as a store in RDFlib, initialize and open a graph:

import rdflib
g = rdflib.Graph("spol")
g.open("/tmp/example.spol")

If you do not open a graph first, an exception is thrown when trying to call any methods on it.

Once a graph has been parsed, you can perform fulltext searches using a SPARQL query:

import rdflib
g = rdflib.Graph("spol")
g.open("/tmp/example.spol")
g.parse("http://www.w3.org/People/Berners-Lee/card")
q = """
    PREFIX foaf: <http://xmlns.com/foaf/0.1/>

    SELECT ?s ?p
    WHERE {
            ?s ?p "web workshop" .
    }
"""
for r in g.query(q):
    print(r)

Import an ntriples file from disk

You can also load a .nt file from disk using SPOLStore like so:

python -m spolstore example.nt example.spol

The file can be compressed. The script checks for an extension named .gz, and if so, will uncompress the file when reading. If you know how many triples there are in the file, you can also specify it on the command line to see the progress.

python -m spolstore --total=6122281 abiggerfile.nt.gz someotherfile.spol

See here for more Usage and querying as a SQL database directly.

TODO

This is very much the first working version. Consider it a practical prototype. Probably many bugs...

  • Handle languages and data types properly for Literals, in stead of the current dumb dumps

Metadata

Release files for spolstore 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spolstore 0.9
File Size Uploaded Provenance
spolstore-0.9.tar.gz 6.6 kB Without provenance Details

Release files / spolstore-0.9.tar.gz

Download URL spolstore-0.9.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
49c08f5c3758860158f740448537b076160cf9c205d3f8527bd19b2a64bac388
BLAKE2b-256 checksum
How to use checksums
bdf328e2798f040840db9b2ad1c69c4f24a3191fc1ce5fde63dca92b60a71bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for spolstore 0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page