Strabon

changeset 1231:866bf84309ae

fix bug about parsing options and using prefixes.sparql with a query argument
author George Garbis <ggarbis@di.uoa.gr>
date Wed Jul 17 16:16:18 2013 +0300 (2013-07-17)
parents a8ed86790eb4
children 6f23ffd29a1e
files scripts/endpoint
line diff
     1.1 --- a/scripts/endpoint	Thu Jul 04 18:46:04 2013 +0300
     1.2 +++ b/scripts/endpoint	Wed Jul 17 16:16:18 2013 +0300
     1.3 @@ -97,22 +97,23 @@
     1.4  DEBUG=0
     1.5  # set default limit
     1.6  MAXLIMIT=0
     1.7 -case "${1}" in
     1.8 -	-d)
     1.9 -		shift
    1.10 -		DEBUG=1
    1.11 -		;;
    1.12 -	-i)
    1.13 -		shift
    1.14 -		PREFIXES="$(cat ${PREFIXES_FILE})
    1.15 -"
    1.16 -		;;
    1.17 -	-l)
    1.18 -		MAXLIMIT="${2}"	
    1.19 -		shift
    1.20 -		shift
    1.21 -		;;
    1.22 -esac
    1.23 +while test $# -gt 0 -a "X${1:0:1}" == "X-"; do
    1.24 +	case "${1}" in
    1.25 +		-d)
    1.26 +			shift
    1.27 +			DEBUG=1
    1.28 +			;;
    1.29 +		-i)
    1.30 +			shift
    1.31 +			PREFIXES="$(cat ${PREFIXES_FILE})"
    1.32 +			;;
    1.33 +		-l)
    1.34 +			MAXLIMIT="${2}"	
    1.35 +			shift
    1.36 +			shift
    1.37 +			;;
    1.38 +	esac
    1.39 +done
    1.40  
    1.41  case "${1}" in
    1.42  	help)
    1.43 @@ -193,7 +194,7 @@
    1.44  				;;
    1.45  		esac
    1.46  
    1.47 -		EXEC="curl -H 'Content-Type:application/x-www-form-urlencoded' -H 'Accept:${MIME_TYPE}' --data-urlencode query='${QUERY}' --data maxLimit='${MAXLIMIT}' ${URL}"
    1.48 +		EXEC="curl -H 'Content-Type:application/x-www-form-urlencoded' -H 'Accept:${MIME_TYPE}' --data-urlencode query='${PREFIXES}${QUERY}' --data maxLimit='${MAXLIMIT}' ${URL}"
    1.49  		;;
    1.50  	queryfile)
    1.51  		shift