Skip to main content

rdflib store using SQLite Fulltext index

Project description

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

To use this as a store in RDFlib, initialize and open a graph:

import rdflib
g = rdflib.Graph(store="spol")

Before you can use it, it needs to be opened by specifying where on the filesystem the sqlite database containing the graph is.

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spolstore-0.1.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file spolstore-0.1.tar.gz.

File metadata

  • Download URL: spolstore-0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for spolstore-0.1.tar.gz
Algorithm Hash digest
SHA256 49eda40419ff1e17b9d9635df65d7a3addd966a0e6c7fec9cc3be2325ca11d2a
MD5 233554f9f991c785358a01fbfc0b1922
BLAKE2b-256 6574c6a9fd4f258006afb5b79d355fd2cbc0f2b79db6e3eb69c65451da6c1291

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