Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

debug convert-saxon.sh script #246

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions bin/convert-saxon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function die {
exit 1
}
function valid_serialization {
case $1 in
case $1 in
rdfxml) return 0 ;;
rdfxml-raw) return 0 ;;
ntriples) return 0 ;;
Expand All @@ -24,7 +24,7 @@ function valid_serialization {
esac
return 1
}


while getopts "s:u:j:" arg; do
case $arg in
Expand All @@ -37,7 +37,7 @@ done

shift $((OPTIND-1))

if [ $# -ne 2 ]; then
if [ $# -ne 2 ]; then
usage
fi

Expand All @@ -46,17 +46,21 @@ fi

valid_serialization $SERIALIZATION || die "Invalid serialization: $SERIALIZATION"

BN_ARG='usebnodes=false'

# Note - saxon Xquery changes to xbin sub-directory, so we make all paths absolute
# readlink also validates the paths

MARCPATH=`readlink -e $1`
#MARCPATH=`readlink -e $1`
MARCPATH=$1
[[ -n "$MARCPATH" ]] || die "marcxml-input-path '$1' must exist"

OUTPUT=`readlink -f $2`
#OUTPUT=`readlink -f $2`
OUTPUT=$2
[[ -n "$OUTPUT" ]] || die "output-path '$2' all directory components must exist"


# Okay - run the conversion

java -cp $SAXON_JAR net.sf.saxon.Query $MYDIR/../xbin/saxon.xqy marcxmluri="$MARCPATH" baseuri="$BASEURI" serialization="$SERIALIZATION" 1>$OUTPUT
java -cp $SAXON_JAR net.sf.saxon.Query $MYDIR/../xbin/saxon.xqy marcxmluri="$MARCPATH" baseuri="$BASEURI" serialization="$SERIALIZATION" $BN_ARG 1>$OUTPUT