Skip to main content

Command-line tool for using the QLever graph database

Project description

QLever

This repository provides a self-documenting and easy-to-use command-line tool for QLever (pronounced "Clever"), a graph database implementing the RDF and SPARQL standards. For a detailed description of what QLever is and what it can do, see here.

Installation

Simply do pip install qlever and make sure that the directory where pip installs the package is in your PATH. Typically, pip will warn you when that is not the case and tell you what to do. If you encounter an "Externally managed Environment" error, try pipx instead of pip.

Type qlever without arguments to check that the installation worked. When using it for the first time, you will see a warning at the top with instructions on how to enable autocompletion. Do it, it makes using qlever so much easier (pip cannot do that for you automatically, sorry).

Usage

Create an empty directory, with a name corresponding to the dataset you want to work with. For the following example, take olympics. Go to that directory and do the following.

qlever setup-config olympics   # Get Qleverfile (config file) for this dataset
qlever get-data                # Download the dataset
qlever index                   # Build index data structures for this dataset
qlever start                   # Start a QLever server using that index
qlever query                   # Launch an example query
qlever ui                      # Launch the QLever UI

This will create a SPARQL endpoint for the 120 Years of Olympics dataset. It is a great dataset for getting started because it is small, but not trivial (around 2 million triples), and the downloading and indexing should only take a few seconds.

Each command will also show you the command line it uses. That way you can learn, on the side, how QLever works internally. If you just want to know the command line for a particular command, without executing it, you can append --show like this:

qlever index --show

There are many more commands and options, see qlever --help for general help, qlever <command> --help for help on a specific command, or just use the autocompletion.

Use on macOS and Windows

By default, qlever uses QLever's official Docker image. In principle, that image runs on Linux, macOS, and Windows. On Linux, Docker runs natively and incurs only a relatively small overhead regarding performance and RAM consumption. On macOS and Windows, Docker runs in a virtual machine, which incurs a significant and sometimes unpredictable overhead. For example, qlever index might abort prematurely (without a proper error message) because the virtual machine runs out of RAM.

For optimal performance, compile QLever from source on your machine. For Linux, this is relatively straightforward: just follow the RUN instructions in the Dockerfile. For macOS, this is more complicated, see this workflow.

Use with your own dataset

To use QLever with your own dataset, you need a Qleverfile, like in the example above. The easiest way to write a Qleverfile is to get one of the existing ones (using qlever setup-config ... as explained above) and then change it according to your needs (the variable names should be self-explanatory). Pick one for a dataset that is similar to yours and when in doubt, pick olympics.

For developers

The (Python) code for the script is in the *.py files in src/qlever. The preconfigured Qleverfiles are in src/qlever/Qleverfiles.

If you want to make changes to the script, or add new commands, do as follows:

git clone https://github.com/ad-freiburg/qlever-control
cd qlever-control
pip install -e .

Then you can use qlever just as if you had installed it via pip install qlever. Note that you don't have to rerun pip install -e . when you modify any of the *.py files and not even when you add new commands in src/qlever/commands. The exceutable created by pip simply links and refers to the files in your working copy.

If you have bug fixes or new useful features or commands, please open a pull request. If you have questions or suggestions, please open an issue.

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

qlever-0.5.45.tar.gz (82.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qlever-0.5.45-py3-none-any.whl (110.8 kB view details)

Uploaded Python 3

File details

Details for the file qlever-0.5.45.tar.gz.

File metadata

  • Download URL: qlever-0.5.45.tar.gz
  • Upload date:
  • Size: 82.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qlever-0.5.45.tar.gz
Algorithm Hash digest
SHA256 bc9d0b0cdaf4d4532ce455361380ea34baddca9992f4fd01665d341014ff65ee
MD5 7e64b2f4e3b42e1a63a9b9597b12cbe3
BLAKE2b-256 30643aa30ebb5742ad167a50034f8b8ba5bd73feef3dcbdf49b1ba889a3aec62

See more details on using hashes here.

File details

Details for the file qlever-0.5.45-py3-none-any.whl.

File metadata

  • Download URL: qlever-0.5.45-py3-none-any.whl
  • Upload date:
  • Size: 110.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for qlever-0.5.45-py3-none-any.whl
Algorithm Hash digest
SHA256 ebd926018e31bb7c44ed2032654e2109baf14e251c78d943d097983654996163
MD5 5e29608aba167a7470326a6d9b70f1d5
BLAKE2b-256 e97f4c0baa6622910a27ea7679b486f7e0cfb05a9e49170bd09904a0ee9f9d68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page