#!/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"