Skip to content

Triplestore

  • SPARQL endpoint with update support
  • Folder containing .sparql files
  • Redis server (optional, for progress tracking)
Terminal window
python -m piccione.upload.on_triplestore <endpoint> <folder> [options]
ArgumentDescription
endpointSPARQL endpoint URL (e.g., http://localhost:8890/sparql)
folderPath to folder containing .sparql files
--failed_fileFile to record failed queries (default: failed_queries.txt)
--stop_fileFile to stop the process (default: .stop_upload)
--redis_hostRedis host for caching
--redis_portRedis port
--redis_dbRedis database number

Example without caching:

Terminal window
python -m piccione.upload.on_triplestore http://localhost:8890/sparql ./sparql_queries

Example with caching:

Terminal window
python -m piccione.upload.on_triplestore http://localhost:8890/sparql ./sparql_queries \
--redis_host localhost --redis_port 6379 --redis_db 0

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).

from piccione.upload.on_triplestore import upload_sparql_updates
# Without caching
upload_sparql_updates(
endpoint="http://localhost:8890/sparql",
folder="./sparql_queries",
)
# With caching
upload_sparql_updates(
endpoint="http://localhost:8890/sparql",
folder="./sparql_queries",
redis_host="localhost",
redis_port=6379,
redis_db=0,
)

Create the stop file (default: .stop_upload) in the working directory to stop processing after the current query completes:

Terminal window
touch .stop_upload
  • Optional Redis-backed progress tracking
  • Automatic retry (3 retries with 5s backoff)
  • Failed queries logged to file
  • Progress bar