blob: 676cd254b09475b475a7c569ef640c3fff2f33bc (
plain)
- #!/bin/sh
- set -e
- rdffile="$1"
- ttlfile="${2:-$(basename "$rdffile" .rdf).ttl}"
- exit1() {
- echo "ERROR: $1"
- exit 1
- }
- [ -e "$rdffile" ] || exit1 "RDF file \"$rdffile\" does not exist."
- [ ! -e "$ttlfile" ] || exit1 "Turtle file \"$ttlfile\" already exists."
- base="$(perl -ne '/\bxml:base="(http.+)"/ and print $1 and exit;' "$rdffile")" || true #'
- rapper -i rdfxml ${base:+-O "$base"} -o turtle "$rdffile" > "$ttlfile"
- perl -i -pe 's/ {4}/\t/g' "$ttlfile"
|