annotate tests/test-rdf-writer/test-rdf-writer.sh @ 190:2d2253469ca4

Merge in subrepo
author Chris Cannam
date Mon, 02 Mar 2015 17:21:59 +0000
parents cbbf8a838b47
children 4ef452f5fefc
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@119 3 . ../include.sh
Chris@0 4
Chris@119 5 infile=$audiopath/3clicks8.wav
Chris@0 6 tmpttl=$mypath/tmp_1_$$.ttl
Chris@0 7
Chris@0 8 trap "rm -f $tmpttl" 0
Chris@0 9
Chris@119 10 transformdir=$mypath/transforms
Chris@0 11
Chris@0 12 for rdfarg in "" "--rdf-plain" ; do
Chris@0 13
Chris@0 14 note=""
Chris@0 15 [ -n "$rdfarg" ] && note=" with $rdfarg"
Chris@0 16
Chris@0 17 rm -f $tmpttl
Chris@0 18
Chris@119 19 $r -t $transformdir/onsets.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
Chris@0 20 fail "Fails to run with onsets transform and RDF writer$note"
Chris@0 21
Chris@0 22 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
Chris@0 23 fail "Fails to produce parseable RDF/TTL for onsets transform$note"
Chris@0 24
Chris@0 25 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 26 fail "RDF output contains no triples (?) for onsets transform$note"
Chris@0 27
Chris@0 28 rm -f $tmpttl
Chris@0 29
Chris@119 30 $r -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
Chris@0 31 fail "Fails to run with detectionfunction transform and RDF writer$note"
Chris@0 32
Chris@0 33 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
Chris@0 34 fail "Fails to produce parseable RDF/TTL for detectionfunction transform$note"
Chris@0 35
Chris@0 36 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 37 fail "RDF output contains no triples (?) for detectionfunction transform$note"
Chris@0 38
Chris@0 39 rm -f $tmpttl
Chris@0 40
Chris@119 41 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile $rdfarg --rdf-one-file $tmpttl 2>/dev/null || \
Chris@0 42 fail "Fails to run with detectionfunction and onsets transforms together and RDF writer$note"
Chris@0 43
Chris@0 44 rapper -i turtle $tmpttl >/dev/null 2>&1 || \
Chris@0 45 fail "Fails to produce parseable RDF/TTL for detectionfunction and onsets transforms together$note"
Chris@0 46
Chris@0 47 rapper -i turtle -c $tmpttl 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' ||
Chris@0 48 fail "RDF output contains no triples (?) for detectionfunction and onsets transforms together$note"
Chris@0 49
Chris@0 50 done
Chris@0 51
Chris@188 52 # Check the output encoding -- should be valid UTF-8 always
Chris@188 53
Chris@188 54 for code in ucs-2 iso-8859-1; do
Chris@188 55 $r -t $transformdir/onsets.n3 -w rdf --rdf-stdout $audiopath/id3v2-$code.mp3 2>/dev/null | uconv --from-code utf-8 --to-code utf-8 --from-callback stop >/dev/null ||
Chris@188 56 fail "RDF/Turtle output from $code input is not valid utf-8 according to uconv"
Chris@188 57 done
Chris@188 58
Chris@0 59 exit 0