Skip to content

Nobatek/fuseki-manager

Repository files navigation

fuseki-manager

Build status Code coverage Code health

About

Jena/Fuseki API clients to manage server and datasets throught HTTP. Based on Fuseki server protocol.

Examples

from fuseki_manager import FusekiAdminClient

client = FusekiAdminClient()

# Get datasets
result = client.get_all_datasets()
# 'result' contains information about datasets
from fuseki_manager import FusekiSPARQLClient

db = FusekiSPARQLClient('dataset_name')

# SELECT request
query = "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 25"
result = db.query(query)
# result = JSON parsed response's results' bindings

# Other kind of requests with results
ns = {'foaf': 'http://xmlns.com/foaf/0.1/'}
query = 'ASK  { ?x foaf:name  "Alice" }'
result = db.raw_query(query, namespaces=ns)
# result = Raw JSON parsed response

# INSERT requets
ns = {'dc': 'http://purl.org/dc/elements/1.1/'}
query = 'INSERT DATA { <http://example/book1> dc:title "A new book" }'
result = db.update_query(query, namespaces=ns)
# result = Raw HTTP response

Installation

pip install setup.py

Development

Use a virtual environnement to debug or develop

# Create virtual environment
$ virtualenv -p /usr/bin/python3 $VIRTUALENVS_DIR/fuseki-manager

# Activate virtualenv
$ source $VIRTUALENVS_DIR/fuseki-manager/bin/activate

Tests

# Install test dependencies
$ pip install -e .[test]

# Run tests
$ py.test

# Skip slow tests
$ py.test -m 'not slow'

# Run tests with coverage
$ py.test --cov=fuseki_manager --cov-report term-missing

API Documentation

https://nobatek.github.io/fuseki-manager/

About

A manager to use Fuseki's APIs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages