Skip to main content

Sage: a SPARQL query engine for public Linked Data providers

Project description

Sage: a SPARQL query engine for public Linked Data providers

Build Status PyPI version

Python implementation of SaGe, a stable, responsive and unrestricted SPARQL query server.

Table of contents

Installation

Installation using pip (with the HDT backend)

Installation in a virtualenv is strongly advised!

Requirements:

  • pip

  • gcc/clang with c++11 support

  • Python Development headers ..

    You should have the Python.h header available on your system. For example, for Python 3.6, install the python3.6-dev package on Debian/Ubuntu systems.

The core engine of the SaGe SPARQL query server with HDT as a backend can be installed as follows:

pip install sage-engine[hdt]

Manual installation (with the HDT backend)

Additional requirements:

  • git

  • npm (shipped with Node.js on most systems)

git clone https://github.com/sage-org/sage-engine
cd sage-engine/
pip install -r requirements.txt
pip install -e .[hdt]

Getting started

Server configuration

A Sage server is configured using a configuration file in YAML syntax. You will find below a minimal working example of such configuration file. A full example is available in the ``config_examples/` directory <https://github.com/sage-org/sage-engine/blob/master/config_examples/example.yaml>`_

name: SaGe Test server
maintainer: Chuck Norris
quota: 75
max_results: 2000
datasets:
-
  name: dbpedia
  description: DBPedia
  backend: hdt-file
  file: datasets/dbpedia.2016.hdt

The quota and max_results fields are used to set the maximum time quantum and the maximum number of results allowed per request, respectively.

Each entry in the datasets field declare a RDF dataset with a name, description, backend and options specific to this backend. Currently, only the hdt-file backend is supported, which allow a Sage server to load RDF datasets from HDT files. Sage uses pyHDT to load and query HDT files.

Starting the server

The sage executable, installed alongside the Sage server, allows to easily start a Sage server from a configuration file using Gunicorn, a Python WSGI HTTP Server.

# launch Sage server with 4 workers on port 8000
sage my_config.yaml -w 4 -p 8000

The full usage of the sage executable is detailed below:

usage: sage [-h] [-p P] [-w W] [--log-level LEVEL] config

Launch the Sage server using a configuration file

positional arguments:
  config             Path to the configuration file

optional arguments:
  -h, --help         show this help message and exit
  -p P, --port P     The port to bind (default: 8000)
  -w W, --workers W  The number of server workers (default: 4)
  --log-level LEVEL  The granularity of log outputs (default: info)

SaGe Docker image

The Sage server is also available through a Docker image. In order to use it, do not forget to mount in the container the directory that contains you configuration file and your datasets.

docker pull callidon/sage
docker run -v path/to/config-file:/opt/data/ -p 8000:8000 callidon/sage sage /opt/data/config.yaml -w 4 -p 8000

Documentation

To generate the documentation, you must install the following dependencies

pip install sphinx sphinx_rtd_theme sphinxcontrib-httpdomain

Then, navigate in the docs directory and generate the documentation

cd docs/
make html
open build/html/index.html

Copyright 2017-2019 - GDD Team, LS2N, University of Nantes

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

sage-engine-2.0.1.tar.gz (20.6 MB view details)

Uploaded Source

File details

Details for the file sage-engine-2.0.1.tar.gz.

File metadata

  • Download URL: sage-engine-2.0.1.tar.gz
  • Upload date:
  • Size: 20.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.4

File hashes

Hashes for sage-engine-2.0.1.tar.gz
Algorithm Hash digest
SHA256 641e84f1f7b66d3c26705b7b99f1c84b135872f46437e0ba2b82e22fa33e7996
MD5 79e9732eb6b847e75637c63d9474af34
BLAKE2b-256 3c42223769d9d995e97fb2c27df33994e98b0dcdbc3b32669aacea612048ccd8

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