Download runtime/restore.sh from VISAI-AI/icj-citation-graph: direct link, hf CLI and curl.
- Browser
- Download file 1.86 kB
-
https://huggingface.co/datasets/VISAI-AI/icj-citation-graph/resolve/main/runtime/restore.sh
- Command line
-
hf download hf://datasets/VISAI-AI/icj-citation-graph/runtime/restore.sh
-
curl -L -o restore.sh https://huggingface.co/datasets/VISAI-AI/icj-citation-graph/resolve/main/runtime/restore.sh
1.86 kB
| set -eu | |
| dump=/dataset/dumps/neo4j.dump | |
| test -f "$dump" || { echo 'Download the dataset first; dumps/neo4j.dump is missing.' >&2; exit 1; } | |
| expected=$(awk '$2 == "dumps/neo4j.dump" {print $1}' /dataset/SHA256SUMS) | |
| test -n "$expected" || { echo 'Dump checksum is missing.' >&2; exit 1; } | |
| actual=$(sha256sum "$dump" | cut -d ' ' -f 1) | |
| test "$actual" = "$expected" || { echo 'Dump checksum mismatch.' >&2; exit 1; } | |
| if test -f /data/.icj-restored; then | |
| test "$(cat /data/.icj-restored)" = "$expected" || { echo 'This volume belongs to a different release. Use a new Compose project/volume.' >&2; exit 1; } | |
| echo 'Graph already restored.' | |
| exit 0 | |
| fi | |
| if test -f /data/.icj-restoring; then | |
| test "$(cat /data/.icj-restoring)" = "$expected" || { echo 'Interrupted restore belongs to another release.' >&2; exit 1; } | |
| else | |
| test ! -d /data/databases/neo4j || { echo 'Existing unrecognized database; refusing to replace it.' >&2; exit 1; } | |
| printf '%s\n' "$expected" > /data/.icj-restoring | |
| fi | |
| if test ! -f /data/.icj-loaded; then | |
| mkdir -p /data/.icj-stage | |
| printf 'server.directories.data=/data/.icj-stage\nserver.directories.transaction.logs.root=/data/.icj-stage/transactions\n' > /tmp/restore.conf | |
| neo4j-admin database load neo4j --from-path=/dataset/dumps --overwrite-destination=true --additional-config=/tmp/restore.conf | |
| touch /data/.icj-loaded | |
| fi | |
| mkdir -p /data/databases /data/transactions | |
| for section in databases transactions; do | |
| if test -d "/data/.icj-stage/$section/neo4j"; then | |
| test ! -d "/data/$section/neo4j" || { echo 'Conflicting restore directories.' >&2; exit 1; } | |
| mv "/data/.icj-stage/$section/neo4j" "/data/$section/neo4j" | |
| fi | |
| done | |
| test -f /data/databases/neo4j/neostore | |
| chown -R neo4j:neo4j /data | |
| mv /data/.icj-restoring /data/.icj-restored | |
| echo 'Graph restored and checksum verified.' | |