Last active
December 17, 2024 18:55
-
-
Save alexander-mart/ff1c896f55e5cc7774e922e3f977961b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
replace
terminusdb triples dump
with
terminusdb triples load
for import entities (but not schema!) to TerminusDB from RDF-file