FusekiAdminClient

class fuseki_manager.FusekiAdminClient(*, host='localhost', port=3030, is_secured=False, user=None, pwd=None)

Fuseki ‘administration’ API client (administration service).

create_backup(ds_name)

This operation initiates a backup and returns a JSON object with the task Id in it. Backups are written to the server local directory ‘backups’ as gzip-compressed N-Quads files.

Parameters

ds_name (str) – Dataset’s name.

Returns dict

Details on backup task created, JSON format.

create_dataset(ds_name, *, ds_type='mem')

Add a dataset to a running server.

Parameters
  • ds_name (str) – Dataset’s name.

  • ds_type (str) – Dataset’s type (either ‘mem’ or ‘tdb’).

Returns dict

Details on dataset container created, JSON format.

create_dataset_from_config_file(config_path)

Sets up a dataset from a configuration file on a running server.

Parameters

config_path (str|Path) – Configuration file path (turtle format).

Returns bool

True if no errors raised.

delete_dataset(ds_name, *, force_drop_data=False)

The dataset name and the details of its configuration are completely deleted and can not be recovered.

..Note:

By default, the data of a TDB dataset is not deleted by administration service. To delete dataset’s data, Fuseki data service API can be involved by setting ‘force_drop_data’ parameter to True.

Parameters
  • ds_name (str) – The name of the dataset to remove.

  • force_drop_data (bool) – Execute a ‘DROP ALL’ query before removing dataset. (default False)

Returns bool

True if deleted without errors.

get_all_backups()

Returns a list of all the files in the backup area of the server. This is useful for managing the files externally.

Returns dict

Details on dataset container, JSON format.

get_all_datasets()

Get a container representing all datasets present in the server.

Returns dict

JSON format.

get_all_stats()

Get statistics all datasets in a single response.

Returns dict

Details on all datasets’ statistics, JSON format.

get_all_tasks()

Returns a description of all running and recently tasks. A finished task can be identified by having a “finishPoint” field.

..Note:

Some operations cause a background task to be executed, backup is an example. The result of such operations includes a json object with the task id and also a Location: header with the URL of the task created. Details of the last few completed tasks are retained, up to a fixed number. The records will eventually be removed as later tasks complete, and the task URL will then return 404.

Returns dict

Details on all running and recently finished tasks, JSON format.

get_dataset(ds_name)

Get a dataset can from a running server.

Parameters

ds_name (str) – Dataset’s name.

Returns dict

Details on dataset container, JSON format.

get_stats(ds_name)

Get statistics for a defined dataset in a single response.

Parameters

ds_name (str) – Dataset’s name.

Returns dict

Details on a dataset’s statistics, JSON format.

get_task(task_id)

Get a description about one single task. Thus the progress of a task can be monitored.

Parameters

task_id (int) – ID of an asynchronous task.

Returns dict

Details on a task, JSON format.

ping()

A guaranteed low cost endpoint to test whether a server is running or not.

Returns datetime

Date and time (UTC) of the server check.

restore_data(ds_name, file_paths)

Upload and insert datas by sending a list of files to a dataset. (Fuseki data service is involved.)

Parameters
  • ds_name (str) – Dataset’s name.

  • file_paths (list[Path]) – List of file’s path to send.

Returns dict

Details on data inserted, JSON format.

server_info()

Get details about the server and it’s current status.

Returns dict

JSON format.

set_dataset_state(ds_name, *, state='active')

Set a dataset’s status to ‘active’ or ‘offline’ on a running server.

Parameters
  • ds_name (str) – Dataset’s name.

  • state (str) – Dataset’s new state, either ‘active’ or ‘offline’.

Returns bool

True if state is succesfully updated to ‘active’, False if state is successfully updated to ‘offline’.