Strabon
changeset 900:5a82ff362b8d
added --force-delete as an option to *query* command in strabon script. It should be modified to go as a flag to the strabon script so as to be universal for all strabon commands (store, describe, etc.), but this needs some work in files StoreOp, DescribeOp, etc. in order to accept another boolean argument
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Wed Mar 20 18:44:35 2013 +0200 (2013-03-20) |
parents | c5b23c70b6c1 |
children | 95427dc12cc4 |
files | scripts/strabon |
line diff
1.1 --- a/scripts/strabon Wed Mar 20 18:28:58 2013 +0200 1.2 +++ b/scripts/strabon Wed Mar 20 18:44:35 2013 +0200 1.3 @@ -55,6 +55,9 @@ 1.4 # the RDF format of the files to store (defaults to ntriples) 1.5 FORMAT="ntriples" 1.6 1.7 +# true to force deletion of locked table, false otherwise 1.8 +FORCE_DELETE="false" 1.9 + 1.10 # the URI of the named graph into which the RDF files shall be stored 1.11 NAMED_GRAPH= 1.12 1.13 @@ -135,15 +138,19 @@ 1.14 } 1.15 1.16 function help_query() { 1.17 - echo "Usage: ${CMD} query SPARQL_QUERY [RESULT_FORMAT]" 1.18 + echo "Usage: ${CMD} query [OPTIONS] SPARQL_QUERY [RESULT_FORMAT]" 1.19 echo 1.20 echo "Execute a SPARQL query on Strabon." 1.21 echo 1.22 echo " SPARQL_QUERY : the SPARQL query to execute or an alias name such as the following:" 1.23 echo " size: returns the number of triples" 1.24 echo " hotspots: returns the number of hotspots" 1.25 - echo " RESULT_FORMAT : the format of the result. Possible values are \`???' (default), \`xml'" 1.26 + echo " RESULT_FORMAT : the format of the result. Possible values are \`???' (default), \`xml'" 1.27 echo " \`html', \`kml', \`kmz', or \`geojson'" 1.28 + echo 1.29 + echo "OPTIONS can be one of the following" 1.30 + echo " --force-delete : forces deletion of \"locked\" table (e.g., when Strabon has been" 1.31 + echo " ungracefully shutdown)" 1.32 } 1.33 1.34 function help_update() { 1.35 @@ -429,6 +436,13 @@ 1.36 help_query 1.37 exit 1 1.38 fi 1.39 + 1.40 + # check whether force deletion of locked table has been specified 1.41 + if test "${1}" = "--force-delete"; then 1.42 + shift 1.43 + FORCE_DELETE="true" 1.44 + fi 1.45 + 1.46 QUERY="${1}" 1.47 shift 1.48 1.49 @@ -583,6 +597,8 @@ 1.50 STRABON_EXEC="${STRABON_EXEC}(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${file}\" -f ${FORMAT} ${NAMED_GRAPH}); 1.51 " 1.52 done 1.53 +elif test "${CLASS}" = "QueryOp"; then 1.54 + STRABON_EXEC="(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${PREFIXES}${QUERY}\" ${FORCE_DELETE} ${RESULT_FORMAT})" 1.55 else 1.56 STRABON_EXEC="(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${PREFIXES}${QUERY}\" ${RESULT_FORMAT})" 1.57 fi