Strabon

changeset 217:6503f99b6b54

added predefined update query for deleting all triples of an endpoint. The alias name is "clear"
author Babis Nikolaou <charnik@di.uoa.gr>
date Thu May 31 19:41:29 2012 +0300 (2012-05-31)
parents 16df1bb8cfc0
children 56e02a58c9f2
files scripts/endpoint
line diff
     1.1 --- a/scripts/endpoint	Thu May 31 19:33:39 2012 +0300
     1.2 +++ b/scripts/endpoint	Thu May 31 19:41:29 2012 +0300
     1.3 @@ -32,7 +32,9 @@
     1.4  	echo "Usage: `basename ${0}` update ENDPOINT SPARQL_QUERY"
     1.5  	echo
     1.6  	echo "	ENDPOINT     : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
     1.7 -	echo "	SPARQL_QUERY : the SPARQL update query to execute"
     1.8 +	echo "	SPARQL_QUERY : the SPARQL update query to execute or the alias name corresponding to a"
     1.9 +	echo "		       predefined query such as:"
    1.10 +	echo "				\`clear': DELETE {?s ?p ?o} WHERE {?s ?p ?o}"
    1.11  }
    1.12  
    1.13  function help_store() {
    1.14 @@ -88,6 +90,7 @@
    1.15  		URL="${1}/Query"
    1.16  		QUERY="${2}"
    1.17  
    1.18 +		# predefined queries
    1.19  		case "${QUERY}" in
    1.20  			size)
    1.21  				QUERY="SELECT (count(*) as ?c) WHERE {?s ?p ?o}"
    1.22 @@ -108,6 +111,13 @@
    1.23  		URL="${1}/Update"
    1.24  		QUERY="${2}"
    1.25  		
    1.26 +		# predefined queries
    1.27 +		case "${QUERY}" in
    1.28 +			clear)
    1.29 +				QUERY="DELETE {?s ?p ?o} WHERE {?s ?p ?o}"
    1.30 +				;;
    1.31 +		esac
    1.32 +
    1.33  		CMD="curl ${CURL_OPTS} --data-urlencode SPARQLQuery='${QUERY}' ${URL}"
    1.34  		;;
    1.35  	store)