From c2813fcf2821c4add1795d32f5bb26a500b416d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas.schaertl@fau.de>
Date: Tue, 28 Apr 2020 09:26:00 +0200
Subject: [PATCH] fork xz-to-gz script

---
 ulo/isabelle-prepare.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100755 ulo/isabelle-prepare.sh

diff --git a/ulo/isabelle-prepare.sh b/ulo/isabelle-prepare.sh
new file mode 100755
index 0000000..eea1c20
--- /dev/null
+++ b/ulo/isabelle-prepare.sh
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+set -eu
+
+# prepare DIRECTORY for import w/ the graphdb web
+# interface; this is for our prototype, I can't imagine
+# we'll use the web interface in production
+#
+# this script is a fork of xz-to-gz.sh, found in the
+# same directory
+
+if [ ! $# -eq 1 ]; then
+    echo "usage: $0 DIRECTORY" 1>&2
+    exit 1
+fi
+
+directory="$1"
+files=$(find "$directory" -name "*.xz")
+
+for file in $files; do
+    echo "$file" 1>&2
+
+    # the filename of the extracted (uncompressed) file
+    rdf_file=$(echo "$file" | sed 's/\.xz//')
+
+    # uncompress, fix iris, compress again
+    unxz "$file"
+    sed -i 's/|/%7C/g' "$file"
+    gzip "$rdf_file"
+done
-- 
GitLab