Triplestore
Prerequisites
Section titled “Prerequisites”- SPARQL endpoint with update support
- Folder containing
.sparqlfiles - Redis server (optional, for progress tracking)
python -m piccione.upload.on_triplestore <endpoint> <folder> [options]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
endpoint | SPARQL endpoint URL (e.g., http://localhost:8890/sparql) |
folder | Path to folder containing .sparql files |
--failed_file | File to record failed queries (default: failed_queries.txt) |
--stop_file | File to stop the process (default: .stop_upload) |
--redis_host | Redis host for caching |
--redis_port | Redis port |
--redis_db | Redis database number |
Example without caching:
python -m piccione.upload.on_triplestore http://localhost:8890/sparql ./sparql_queriesExample with caching:
python -m piccione.upload.on_triplestore http://localhost:8890/sparql ./sparql_queries \ --redis_host localhost --redis_port 6379 --redis_db 0Caching
Section titled “Caching”Caching is optional. When enabled, the module uses Redis to track processed files, allowing interrupted uploads to resume without re-executing completed queries.
To enable caching, specify all three Redis parameters: --redis_host, --redis_port, --redis_db.
The cache uses the key processed_files (Redis SET).
Programmatic usage
Section titled “Programmatic usage”from piccione.upload.on_triplestore import upload_sparql_updates
# Without cachingupload_sparql_updates( endpoint="http://localhost:8890/sparql", folder="./sparql_queries",)
# With cachingupload_sparql_updates( endpoint="http://localhost:8890/sparql", folder="./sparql_queries", redis_host="localhost", redis_port=6379, redis_db=0,)Graceful interruption
Section titled “Graceful interruption”Create the stop file (default: .stop_upload) in the working directory to stop processing after the current query completes:
touch .stop_uploadFeatures
Section titled “Features”- Optional Redis-backed progress tracking
- Automatic retry (3 retries with 5s backoff)
- Failed queries logged to file
- Progress bar