From a79d856a1d65a9c1709c61744b670b37b82c3532 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas.schaertl@fau.de>
Date: Tue, 26 May 2020 12:59:50 +0200
Subject: [PATCH] Add generate-ulo-rdf4j.sh

It's a script that generates a Java/RDF4J file with constants
for the OWL ontology. This makes working with ULO convinient.
---
 src/ulo-rdf4j/generate-ulo-rdf4j.sh | 35 +++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100755 src/ulo-rdf4j/generate-ulo-rdf4j.sh

diff --git a/src/ulo-rdf4j/generate-ulo-rdf4j.sh b/src/ulo-rdf4j/generate-ulo-rdf4j.sh
new file mode 100755
index 0000000..650dd0e
--- /dev/null
+++ b/src/ulo-rdf4j/generate-ulo-rdf4j.sh
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+#
+# Generate ULO.java from the OWL ontology.
+# The generated file is printed to stdout.
+#
+
+set -eu
+
+# print first argument to stderr
+report() {
+    echo "$0: $1" 1>&2
+}
+
+# $workdir is the directory where we put all temp files,
+# $target_file the path for the file to generate
+workdir="$(mktemp -d)"
+target_file="$workdir/ULO.java"
+
+(
+    cd "$workdir"
+
+    report "cloning repositories..."
+
+    git clone --quiet https://github.com/ansell/rdf4j-schema-generator.git
+    git clone --quiet https://gl.mathhub.info/ulo/ulo.git ulo
+
+    report "generating $target_file..."
+
+    rdf4j-schema-generator/rdf4j-schema-generator \
+	-f application/xml -name ULO \
+	ulo/ulo.owl "$target_file" >/dev/null
+)
+
+cat "$target_file"
-- 
GitLab