Strabon

changeset 235:deddf369e10f

progress on strabon script
author Babis Nikolaou <charnik@di.uoa.gr>
date Sun Jun 03 15:16:14 2012 +0300 (2012-06-03)
parents 073b525b20b9
children 54ffeb7810e0
files runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java scripts/strabon
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java	Sun Jun 03 14:40:16 2012 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java	Sun Jun 03 15:16:14 2012 +0300
     1.3 @@ -39,8 +39,6 @@
     1.4  
     1.5  		Strabon strabon = null;
     1.6  		try {
     1.7 -			logger.info("[QueryOp] Executing query: " + queryString);
     1.8 -			
     1.9  			strabon = new Strabon(db, user, passwd, port, host, true);
    1.10  			strabon.query(queryString, resultsFormat, strabon.getSailRepoConnection());
    1.11  			
     2.1 --- a/scripts/strabon	Sun Jun 03 14:40:16 2012 +0300
     2.2 +++ b/scripts/strabon	Sun Jun 03 15:16:14 2012 +0300
     2.3 @@ -47,13 +47,13 @@
     2.4  }
     2.5  
     2.6  function help_store() {
     2.7 -	echo "Usage: ${CMD} store FILE"
     2.8 +	echo "Usage: ${CMD} store FILE..."
     2.9  	echo
    2.10 -	echo "Store an RDF document or ??? in Strabon."
    2.11 +	echo "Store RDF documents in Strabon."
    2.12  	echo
    2.13 -	echo "	FILE	: the file containing the RDF document to store. It can be a filename or a URL"
    2.14 +	echo "	FILE	: the file containing the RDF document to store. It can be a filename or a URL,"
    2.15  	echo "		  (i.e., file:///tmp/file.nt, http://www.example.org/file.nt,"
    2.16 -	echo "		  ftp://www.example.org/file.nt, etc.)"
    2.17 +	echo "		  ftp://www.example.org/file.nt, etc.)."
    2.18  }
    2.19  
    2.20  # runtime package
    2.21 @@ -144,8 +144,7 @@
    2.22  		CLASS="QueryOp"
    2.23  		shift
    2.24  		if ! test $# -eq 1; then
    2.25 -			#help_query
    2.26 -			help
    2.27 +			help_query
    2.28  			exit 1
    2.29  		fi
    2.30  		QUERY="${1}"
    2.31 @@ -161,8 +160,7 @@
    2.32  		CLASS="UpdateOp"
    2.33  		shift
    2.34  		if ! test $# -eq 1; then
    2.35 -			#help_query
    2.36 -			help
    2.37 +			help_update
    2.38  			exit 1
    2.39  		fi
    2.40  		QUERY="${1}"
    2.41 @@ -177,29 +175,37 @@
    2.42  	store)
    2.43  		CLASS="StoreOp"
    2.44  		shift
    2.45 -		if ! test $# -eq 1; then
    2.46 -			#help_query
    2.47 -			help
    2.48 +		if ! test $# -ge 1; then
    2.49 +			help_store
    2.50  			exit 1
    2.51  		fi
    2.52 -		QUERY="${1}"
    2.53 +		# do not make an assignment of the files to QUERY
    2.54 +		# handle the case afterwards
    2.55 +		# QUERY="${@}"
    2.56  		;;
    2.57  	*) 
    2.58  		help
    2.59  		echo
    2.60 -		echo "ERROR: Unknown command \"${1}\"."
    2.61 +		echo "${CMD}: Unknown command \"${1}\"."
    2.62  		exit 1
    2.63  		;;
    2.64  esac
    2.65  
    2.66 -STRABON_EXEC="(cd ${RUNTIME} && java -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${QUERY}\")"
    2.67 +if test "${CLASS}" = "StoreOp"; then
    2.68 +	STRABON_EXEC=
    2.69 +	for file in "${@}"; do
    2.70 +		STRABON_EXEC="${STRABON_EXEC}(cd ${RUNTIME} && java -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${file}\");
    2.71 +"
    2.72 +	done
    2.73 +else
    2.74 +	STRABON_EXEC="(cd ${RUNTIME} && java -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${QUERY}\")"
    2.75 +fi
    2.76  
    2.77  # execute or debug
    2.78  if test ${DEBUG} -eq 1; then
    2.79 -	echo "`basename ${0}`: Debug is ON"
    2.80 -	echo "`basename ${0}`: Printing command for execution"	
    2.81 -	echo "	${STRABON_EXEC}"
    2.82 +	echo "${CMD}: Debug is ON"
    2.83 +	echo "${CMD}: Printing command for execution"	
    2.84 +	echo "${STRABON_EXEC}"
    2.85  else
    2.86  	eval ${STRABON_EXEC}
    2.87  fi
    2.88 -