Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

TriplyDB File Upload -- Python

Python reference implementation for uploading files to TriplyDB using the TUS resumable upload protocol.

Requirements

  • Python 3.8+

Setup

# Create virtual environment and install dependencies
./build.sh

This creates a venv/ virtual environment and installs the required packages.

Usage

Via wrapper script

./upload.sh \
  --file path/to/data.ttl \
  --account your-account \
  --dataset your-dataset \
  --token YOUR_API_TOKEN

Via Python directly

source venv/bin/activate
python upload_file.py \
  --file path/to/data.ttl \
  --account your-account \
  --dataset your-dataset \
  --token YOUR_API_TOKEN

With optional parameters

./upload.sh \
  --file path/to/data.nt \
  --account your-account \
  --dataset your-dataset \
  --token YOUR_API_TOKEN \
  --api-url http://api.triplydb.local \
  --default-graph "http://example.org/my-graph" \
  --overwrite-all

Parameters

Parameter Required Description
--file Yes Path to the file to upload
--account Yes TriplyDB account name
--dataset Yes TriplyDB dataset name
--token Yes TriplyDB API token
--api-url No API URL (default: https://api.triplydb.com)
--default-graph No Default graph name for imported triples
--overwrite-all No Overwrite all existing graphs in the dataset
--merge-graphs No Merge data into existing graphs

Dependencies

Library Version Purpose
tuspy >=1.0.0 TUS protocol
requests >=2.31.0 HTTP client

Project Structure

python/
├── requirements.txt
├── build.sh
├── upload.sh
├── README.md
└── upload_file.py