Skip to main content

rdf-to-sqlite

PyPI Changelog Tests License

Load the contents of an RDF file into a set of SQLite database tables.

$ rdf-to-sqlite --help
Usage: rdf-to-sqlite [OPTIONS] DB_PATH RDF_FILE

  Convert an RDF file to SQLite

Options:
  --version                       Show the version and exit.
  --context TEXT                  URL or file containing a JSON-LD context
  --format [html|n3|nquads|nt|rdfa|rdfa1.0|rdfa1.1|trix|turtle|xml|json-ld]
                                  RDF serialization format  [required]
  --help                          Show this message and exit.

Usage

Given an RDF file example.ttl containing the following:

@prefix ns1: <http://schema.org/> .

<http://www.janedoe.com/> a ns1:Person ;
    ns1:jobTitle "Professor" ;
    ns1:name "Jane Doe" ;
    ns1:telephone "(425) 123-4567" .

Running this command:

$ rdf-to-sqlite example.db example.ttl --format turtle --context https://schema.org/docs/jsonldcontext.jsonld

Will create a database file example.db with this schema, using a property table approach to RDF storage on relational databases [1], [2]:

CREATE TABLE [Person] (
   [@context] TEXT,
   [id] TEXT PRIMARY KEY,
   [jobTitle] TEXT,
   [name] TEXT,
   [telephone] TEXT
);
CREATE TABLE [Person_rdf:type] (
   [subject] TEXT,
   [predicate] TEXT,
   [object] TEXT,
   PRIMARY KEY ([subject], [object])
);

Acknowledgements

Thanks to Simon Willison for the inspiration from his work on Datasette and more specifically yaml-to-sql, which was a very useful example for how to package this up properly.

References

[1] Sakr, S. and Al-Naymat, G., 2010. Relational processing of RDF queries: a survey. ACM SIGMOD Record, 38(4), pp.23-28.

[2] Ali, W., Saleem, M., Yao, B., Hogan, A. and Ngomo, A.C.N., 2020. Storage, indexing, query processing, and benchmarking in centralized and distributed rdf engines: A survey. arXiv preprint arXiv:2009.10331.

Metadata

Release files for rdf-to-sqlite 0.2

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

Source distribution (sdist)

Source distribution for rdf-to-sqlite 0.2
File Size Uploaded
rdf-to-sqlite-0.2.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rdf-to-sqlite 0.2
File Interpreter ABI Platform
rdf_to_sqlite-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / rdf-to-sqlite-0.2.tar.gz

Download URL rdf-to-sqlite-0.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5f3a5021d3a42165d4317771c1b7256ab6ac9398cd2f2312c00548724876f0fe
BLAKE2b-256 checksum
How to use checksums
4968444682ea8a66a9fc233c758e76e77ed5030c5da9712825c083c35366cd21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release files / rdf_to_sqlite-0.2-py3-none-any.whl

Download URL rdf_to_sqlite-0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f9f8ccd9f33a2830f9b9187dbca58be4e7ae1ae3db068d5fa780225e8166237
BLAKE2b-256 checksum
How to use checksums
97ca1825673b41cfd5e444008e06ce4988052549574e82a03ff4fe52169d4e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.7.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

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