diff options
Diffstat (limited to 'foaf')
-rwxr-xr-x | foaf/turtle2rdf.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/foaf/turtle2rdf.sh b/foaf/turtle2rdf.sh new file mode 100755 index 0000000..9a87229 --- /dev/null +++ b/foaf/turtle2rdf.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +ttlfile="$1" +xmlfile="${2:-$(basename "$ttlfile" .ttl).rdf}" + +exit1() { + echo "ERROR: $1" + exit 1 +} + +[ -e "$ttlfile" ] || exit1 "Turtle file \"$ttlfile\" does not exist." +[ ! -e "$xmlfile" ] || exit1 "RDF/XML file \"$xmlfile\" already exists." + +base="$(perl -ne '/^\@base\s+<(http.+)>/ and print $1 and exit;' "$ttlfile")" || true +rapper ${base:+-I "$base"} -i turtle -o rdfxml-abbrev "$ttlfile" > "$xmlfile" |