#! /bin/sh

set -eu

# Prepare DIRECTORY for import w/ the GraphDB web interface.
#
# That is, it searches for *.rdf.xz files in DIRECTORY and passes
# each file to the isabelle-prepare-file.sh script.
#
# If you want to prepare Isabelle exported files for GraphDB, you
# probably should use this script.

if [ ! $# -eq 1 ]; then
    echo "usage: $0 DIRECTORY" 1>&2
    exit 1
fi

directory="$1"
threads=6

script_dir=$(dirname "$0")
cd "$script_dir"

find "$directory" -name "*.rdf.xz" -print0 -exec xargs -0 -P $threads ./isabelle-prepare-file.sh {} \;
