Strabon

changeset 98:b22762ef9795

imroved help messages in endpoint script
author Babis Nikolaou <charnik@di.uoa.gr>
date Thu Apr 05 13:55:28 2012 +0300 (2012-04-05)
parents 369029414139
children e0285c06da6a
files scripts/endpoint
line diff
     1.1 --- a/scripts/endpoint	Thu Apr 05 12:58:20 2012 +0300
     1.2 +++ b/scripts/endpoint	Thu Apr 05 13:55:28 2012 +0300
     1.3 @@ -7,31 +7,33 @@
     1.4  #
     1.5  
     1.6  function help() {
     1.7 -	echo SYNOPSIS
     1.8 -	echo "	`basename ${0}` query|update|store ARGS"
     1.9 +	echo "Usage: `basename ${0}` COMMAND ENDPOINT ARGS"
    1.10 +	echo
    1.11 +	echo "Execute SPARQL and SPARQL Update queries as well as store RDF triples on a Strabon endpoint."
    1.12 +	echo
    1.13 +	echo "	COMMAND	 : one of query, update, store, or help"
    1.14 +	echo "	ENDPOINT : the URL of the Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint)"
    1.15 +	echo "	ARGS	 : arguments according to selected command"
    1.16  }
    1.17  
    1.18  function help_query() {
    1.19 -	echo SYNOPSIS
    1.20 -	echo "	`basename ${0}` query URL SPARQL_QUERY"
    1.21 +	echo "Usage: `basename ${0}` query ENDPOINT SPARQL_QUERY"
    1.22  	echo
    1.23 -	echo "	URL	     : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
    1.24 +	echo "	ENDPOINT     : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
    1.25  	echo "	SPARQL_QUERY : the SPARQL query to execute"
    1.26  }
    1.27  
    1.28  function help_update() {
    1.29 -	echo SYNOPSIS
    1.30 -	echo "	`basename ${0}` update URL SPARQL_QUERY"
    1.31 +	echo "Usage: `basename ${0}` update ENDPOINT SPARQL_QUERY"
    1.32  	echo
    1.33 -	echo "	URL	     : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
    1.34 +	echo "	ENDPOINT     : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
    1.35  	echo "	SPARQL_QUERY : the SPARQL update query to execute"
    1.36  }
    1.37  
    1.38  function help_store() {
    1.39 -	echo SYNOPSIS
    1.40 -	echo "	`basename ${0}` store URL FORMAT -t TRIPLES|-u TRIPLES_URL  "
    1.41 +	echo "Usage: `basename ${0}` store ENDPOINT FORMAT -t TRIPLES|-u TRIPLES_URL"
    1.42  	echo
    1.43 -	echo "	URL	    : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
    1.44 +	echo "	ENDPOINT    : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
    1.45  	echo "	FORMAT	    : the RDF format of the input (one of RDF/XML, N-Triples, Turtle, N3, TriX, TriG, or BinaryRDF)"
    1.46  	echo "	TRIPLES	    : the RDF triples to store"
    1.47  	echo "	TRIPLES_URL : the URL containing the RDF triples to store"
    1.48 @@ -41,6 +43,24 @@
    1.49  
    1.50  case "${1}" in
    1.51  	help)
    1.52 +		shift
    1.53 +		if test $# -eq 1; then
    1.54 +			case "${1}" in
    1.55 +				query)
    1.56 +					help_query
    1.57 +					;;
    1.58 +				update)
    1.59 +					help_update
    1.60 +					;;
    1.61 +				store)
    1.62 +					help_store
    1.63 +					;;
    1.64 +				*)
    1.65 +					help
    1.66 +					;;
    1.67 +			esac
    1.68 +			exit 1
    1.69 +		fi
    1.70  		help
    1.71  		exit 0
    1.72  		;;
    1.73 @@ -93,8 +113,9 @@
    1.74  		esac
    1.75  		;;
    1.76  	*) 
    1.77 +		help
    1.78 +		echo
    1.79  		echo "ERROR: Unknown command \"${1}\"."
    1.80 -		help
    1.81  		exit 1
    1.82  		;;
    1.83  esac