Fuseki¶
kurra.db.fuseki ¶
Functions to work with the Jena Fuseki RDF Database's API.
FusekiError ¶
ping ¶
Check if the Fuseki server is alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The server's ping response text. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the server does not respond with success. |
Source code in kurra/db/fuseki.py
server ¶
Get basic Fuseki server info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g., http://localhost:3030 |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The server info response text. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the server does not respond with success. |
Source code in kurra/db/fuseki.py
status ¶
stats ¶
Request statistics for all datasets, or one named dataset, on the Fuseki server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
name
|
str
|
The dataset to get statistics for. If None (default), statistics for all datasets are returned. |
None
|
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The statistics response text. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the server does not respond with success. |
Source code in kurra/db/fuseki.py
backup ¶
Ask the Fuseki server to create a backup of a dataset -- Not yet implemented.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
name
|
str
|
The dataset to backup. |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Not yet implemented. |
Source code in kurra/db/fuseki.py
backups ¶
backups_list ¶
List all existing backups on the Fuseki server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The backups list response text. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the server does not respond with success. |
Source code in kurra/db/fuseki.py
sleep ¶
Tell the Fuseki server to sleep -- Not yet implemented.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Not yet implemented. |
Source code in kurra/db/fuseki.py
tasks ¶
List tasks currently running on the Fuseki server, or get one named task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
name
|
str
|
The task to get. If None (default), all running tasks are listed. |
None
|
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The tasks response text. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the server does not respond with success. |
Source code in kurra/db/fuseki.py
metrics ¶
Get metrics for the Fuseki server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The metrics response text. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the server does not respond with success. |
Source code in kurra/db/fuseki.py
describe ¶
Describe the datasets on the Fuseki server, or a single named dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
dataset_name
|
str
|
The dataset to be described. If None (default), then all datasets will be listed. |
None
|
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
The Fuseki listing of datasets as a dictionary. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the datasets fail to list or the server responds with an invalid data structure. |
Source code in kurra/db/fuseki.py
create ¶
create(sparql_endpoint: str, dataset_name_or_config_file: str | TextIOBase | Path, dataset_type: str = 'tdb2', http_client: Client | None = None) -> str
Create a new Fuseki dataset, from a name and type or an assembler config file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sparql_endpoint
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
dataset_name_or_config_file
|
str | TextIOBase | Path
|
The name of the dataset to create (using |
required |
dataset_type
|
str
|
The dataset type to create, when |
'tdb2'
|
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
A message confirming the dataset was created. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the dataset fails to create. |
Source code in kurra/db/fuseki.py
delete ¶
Delete a Fuseki dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
The base URL of the Fuseki server. E.g. http://localhost:3030 |
required |
dataset_name
|
str
|
The dataset to be deleted. |
required |
http_client
|
Client | None
|
An optional HTTPX client to contain credentials if needed. A new one is created if not given. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
A message indicating the successful deletion of the dataset. |
Raises:
| Type | Description |
|---|---|
FusekiError
|
If the dataset fails to delete. |