Skip to content

Instantly share code, notes, and snippets.

@alexander-mart
Last active December 24, 2023 22:11
Show Gist options
  • Save alexander-mart/ff1c896f55e5cc7774e922e3f977961b to your computer and use it in GitHub Desktop.
Save alexander-mart/ff1c896f55e5cc7774e922e3f977961b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Connect to TerminusDB and dump all data (RDF-triplets) to local file
# https://gist.github.com/alexander-mart/ff1c896f55e5cc7774e922e3f977961b
# Access the TerminusDB CLI from the Docker Compose:
# https://terminusdb.com/docs/install-terminusdb-as-a-docker-container/#usingthecli
# TerminusDB dump command:
# https://terminusdb.com/docs/terminusdb-cli-commands/#triplesdump
# Turtle RDF format:
# https://en.wikipedia.org/wiki/Turtle_(syntax)
# https://www.w3.org/TR/turtle/
organization=admin # Edit me
data_product_id=my_database # Edit me
branch=main # Edit me (optional)
# iso_datetime_escaped example:
# 2023-12-25T00-39-38+03-00
iso_datetime_escaped=$(date --iso-8601=seconds | sed s/:/-/g)
docker compose run --rm terminusdb-server ./terminusdb triples dump $organization/$data_product_id/local/branch/$branch/instance > backup_$iso_datetime_escaped.ttl
# output filename example:
# backup_2023-12-25T00-39-38+03-00.ttl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment