Strabon
changeset 466:c63d7397f50d
merge
author | Kostis Kyzirakos <kkyzir@di.uoa.gr> |
---|---|
date | Thu Jul 19 20:25:20 2012 +0300 (2012-07-19) |
parents | 515413720e57 ebb1e9fb543b |
children | 88b4d2c21fb0 |
files | scripts/v2.2/endpoint |
line diff
1.1 --- a/scripts/v2.2/endpoint Thu Jul 19 20:25:03 2012 +0300 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,234 +0,0 @@ 1.4 -#!/bin/bash 1.5 -# 1.6 -# Script for executing SPARQL queries and SPARQL Update queries 1.7 -# as well as storing RDF triples on a Strabon Endpoint. 1.8 -# 1.9 -# Author: Charalampos (Babis) Nikolaou <charnik@di.uoa.gr> 1.10 -# 1.11 - 1.12 -# this command 1.13 -CMD="$(basename ${0})" 1.14 - 1.15 -function help() { 1.16 - echo "Usage: ${CMD} [OPTIONS] COMMAND ENDPOINT ARGS" 1.17 - echo 1.18 - echo "Execute SPARQL and SPARQL Update queries as well as store RDF triples on a Strabon endpoint." 1.19 - echo 1.20 - echo " COMMAND : one of query, queryfile, update, store, or help" 1.21 - echo " ENDPOINT : the URL of the Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint)" 1.22 - echo " ARGS : arguments according to selected command" 1.23 - echo 1.24 - echo "OPTIONS can be any of the following" 1.25 - echo " -d : don't run, just print what shall be executed" 1.26 -} 1.27 - 1.28 -function help_query() { 1.29 - echo "Usage: ${CMD} query ENDPOINT SPARQL_QUERY [RESULT_FORMAT]" 1.30 - echo 1.31 - echo " ENDPOINT : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)" 1.32 - echo " SPARQL_QUERY : the SPARQL query to execute or the alias name corresponding to a" 1.33 - echo " predefined query such as:" 1.34 - echo " \`size': SELECT (count(*) as ?c) WHERE {?s ?p ?o}" 1.35 - echo " RESULT_FORMAT : the format of the result. Possible values are \`KMLMAP\, \`GEOJSON', " 1.36 - echo " \`HTML', \`KMZMAP', \`XML' (default), or \`KML'." 1.37 -} 1.38 - 1.39 -function help_queryfile() { 1.40 - echo "Usage: ${CMD} queryfile ENDPOINT SPARQL_QUERY_FILE [RESULT_FORMAT]" 1.41 - echo 1.42 - echo " ENDPOINT : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)" 1.43 - echo " SPARQL_QUERY_FILE : the file that contain the SPARQL query to execute" 1.44 - echo " RESULT_FORMAT : the format of the result. Possible values are \`KMLMAP\, \`GEOJSON', " 1.45 - echo " \`HTML', \`KMZMAP', \`XML' (default), or \`KML'." 1.46 -} 1.47 - 1.48 -function help_update() { 1.49 - echo "Usage: ${CMD} update ENDPOINT SPARQL_QUERY" 1.50 - echo 1.51 - echo " ENDPOINT : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)" 1.52 - echo " SPARQL_QUERY : the SPARQL update query to execute or the alias name corresponding to a" 1.53 - echo " predefined query such as:" 1.54 - echo " \`clear': DELETE {?s ?p ?o} WHERE {?s ?p ?o}" 1.55 -} 1.56 - 1.57 -function help_store() { 1.58 - echo "Usage: ${CMD} store ENDPOINT FORMAT -t TRIPLES|-u TRIPLES_URL" 1.59 - echo 1.60 - echo " ENDPOINT : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)" 1.61 - echo " FORMAT : the RDF format of the input (one of RDF/XML, N-Triples, Turtle, N3, TriX, TriG, or BinaryRDF)" 1.62 - echo " TRIPLES : the RDF triples to store" 1.63 - echo " TRIPLES_URL : the URL containing the RDF triples to store" 1.64 -} 1.65 - 1.66 -CURL_OPTS="-w HTTP_CODE='%{http_code}\n' -H \"Content-Type:application/x-www-form-urlencoded\" -H \"Accept:text/xml\"" 1.67 - 1.68 -# if set to 1, then only the command to be executed is printed 1.69 -DEBUG=0 1.70 - 1.71 -case "${1}" in 1.72 - -d) 1.73 - shift 1.74 - DEBUG=1 1.75 - ;; 1.76 -esac 1.77 - 1.78 -case "${1}" in 1.79 - help) 1.80 - shift 1.81 - if test $# -eq 1; then 1.82 - case "${1}" in 1.83 - query) 1.84 - help_query 1.85 - ;; 1.86 - queryfile) 1.87 - help_queryfile 1.88 - ;; 1.89 - update) 1.90 - help_update 1.91 - ;; 1.92 - store) 1.93 - help_store 1.94 - ;; 1.95 - *) 1.96 - help 1.97 - ;; 1.98 - esac 1.99 - exit 1 1.100 - fi 1.101 - help 1.102 - exit 0 1.103 - ;; 1.104 - query) 1.105 - shift 1.106 - if ! test $# -ge 2; then 1.107 - help_query 1.108 - exit 1 1.109 - fi 1.110 - URL="${1}/Query" 1.111 - QUERY="${2}" 1.112 - 1.113 - shift 1.114 - shift 1.115 - # predefined queries 1.116 - case "${QUERY}" in 1.117 - size) 1.118 - QUERY="SELECT (count(*) as ?c) WHERE {?s ?p ?o}" 1.119 - ;; 1.120 - esac 1.121 - 1.122 - # set default format 1.123 - FORMAT="XML" 1.124 - if test $# -eq 1; then 1.125 - FORMAT="${1}" 1.126 - fi 1.127 - 1.128 - case "${FORMAT}" in 1.129 - [Kk][Mm][Ll][Mm][Aa][Pp]|[Gg][Ee][Oo][Jj][Ss][Oo][Nn]|[Hh][Tt][Mm][Ll]|[Kk][mM][Zz][Mm][Aa][Pp]|[Xx][Mm][Ll]|[Kk][Mm][Ll]) 1.130 - shift 1.131 - ;; 1.132 - *) 1.133 - echo "${CMD}: unknown format \"${FORMAT}\"." 1.134 - echo "${CMD}: possible values are \`KMLMAP\, \`GEOJSON' \`HTML', \`KMZMAP', \`XML' (default), or \`KML'" 1.135 - exit 2 1.136 - ;; 1.137 - esac 1.138 - 1.139 - EXEC="curl ${CURL_OPTS} -d format='${FORMAT}' --data-urlencode SPARQLQuery='${QUERY}' ${URL}" 1.140 - ;; 1.141 - queryfile) 1.142 - shift 1.143 - if ! test $# -ge 2; then 1.144 - help_queryfile 1.145 - exit 1 1.146 - fi 1.147 - 1.148 - if [ ! -f ${2} ]; 1.149 - then 1.150 - echo "${CMD}: File not found." 1.151 - exit 2 1.152 - fi 1.153 - 1.154 - URL="${1}/Query" 1.155 - QUERY=`cat ${2} | sed 's/\"/\\\"/g'` 1.156 - 1.157 - shift 1.158 - shift 1.159 - 1.160 - # set default format 1.161 - FORMAT="XML" 1.162 - if test $# -eq 1; then 1.163 - FORMAT="${1}" 1.164 - fi 1.165 - 1.166 - case "${FORMAT}" in 1.167 - [Kk][Mm][Ll][Mm][Aa][Pp]|[Gg][Ee][Oo][Jj][Ss][Oo][Nn]|[Hh][Tt][Mm][Ll]|[Kk][mM][Zz][Mm][Aa][Pp]|[Xx][Mm][Ll]|[Kk][Mm][Ll]) 1.168 - shift 1.169 - ;; 1.170 - *) 1.171 - echo "${CMD}: unknown format \"${FORMAT}\"." 1.172 - echo "${CMD}: possible values are \`KMLMAP\, \`GEOJSON' \`HTML', \`KMZMAP', \`XML' (default), or \`KML'" 1.173 - exit 2 1.174 - ;; 1.175 - esac 1.176 - 1.177 - EXEC="curl ${CURL_OPTS} -d format='${FORMAT}' --data-urlencode SPARQLQuery='${QUERY}' ${URL}" 1.178 - ;; 1.179 - 1.180 - update) 1.181 - shift 1.182 - if ! test $# -eq 2; then 1.183 - help_update 1.184 - exit 1 1.185 - fi 1.186 - URL="${1}/Update" 1.187 - QUERY="${2}" 1.188 - 1.189 - # predefined queries 1.190 - case "${QUERY}" in 1.191 - clear) 1.192 - QUERY="DELETE {?s ?p ?o} WHERE {?s ?p ?o}" 1.193 - ;; 1.194 - esac 1.195 - 1.196 - EXEC="curl ${CURL_OPTS} --data-urlencode SPARQLQuery='${QUERY}' ${URL}" 1.197 - ;; 1.198 - store) 1.199 - shift 1.200 - if ! test $# -eq 4; then 1.201 - help_store 1.202 - exit 1 1.203 - fi 1.204 - URL="${1}/Store" 1.205 - FORMAT="${2}" 1.206 - case "${3}" in 1.207 - -t) 1.208 - TRIPLES="${4}" 1.209 - EXEC="curl ${CURL_OPTS} -d format='${FORMAT}' --data-urlencode data='${TRIPLES}' ${URL}" 1.210 - ;; 1.211 - -u) 1.212 - URL_TRIPLES="${4}" 1.213 - EXEC="curl ${CURL_OPTS} -d format='${FORMAT}' --data-urlencode url='${URL_TRIPLES}' -d fromurl='' ${URL}" 1.214 - ;; 1.215 - *) 1.216 - help_store 1.217 - exit 1 1.218 - ;; 1.219 - esac 1.220 - ;; 1.221 - *) 1.222 - help 1.223 - echo 1.224 - echo "${CMD}: unknown command \"${1}\"." 1.225 - exit 1 1.226 - ;; 1.227 -esac 1.228 - 1.229 -# execute or debug 1.230 -if test $DEBUG -eq 1; then 1.231 - echo "${CMD}: Debug is ON" 1.232 - echo "${CMD}: Printing command for execution" 1.233 - echo " $EXEC" 1.234 -else 1.235 - eval ${EXEC} 1.236 -fi 1.237 -
2.1 --- a/scripts/v2.2/runNoaRefinementChain.sh Thu Jul 19 20:25:03 2012 +0300 2.2 +++ b/scripts/v2.2/runNoaRefinementChain.sh Thu Jul 19 20:25:20 2012 +0300 2.3 @@ -18,10 +18,9 @@ 2.4 #dataDir="http://kk.di.uoa.gr/out_triples/" 2.5 #dataDir="http://godel.di.uoa.gr/allhot/" 2.6 dataDir="http://jose.di.uoa.gr/rdf/hotspots/20" 2.7 -name="HMSG2_IR_039_s7_" 2.8 -suffix=".hotspots.nt" 2.9 2.10 -HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots" 2.11 +#HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots" 2.12 +HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots/msg1" 2.13 2.14 logFile="chain.log" 2.15 #countWTime="/usr/bin/time -p %e" 2.16 @@ -63,7 +62,7 @@ 2.17 #elif test -s /etc/SuSE-release ; then 2.18 #elif test -s /etc/gentoo-release ; then 2.19 elif test -s /etc/lsb-release ; then # Ubuntu 2.20 - tomcat="tomcat7" 2.21 + tomcat=$(ls -1 /etc/init.d/| grep tomcat | head -1) 2.22 elif test -s /etc/debian_version ; then 2.23 tomcat="tomcat" 2.24 fi 2.25 @@ -126,18 +125,20 @@ 2.26 #echo "Continue?" 2.27 #read a 2.28 2.29 -#for y in 2008; do 2.30 -for y in 2007 2008 2010 2011 ;do 2.31 +#for y in 2007 2008 2010 2011 ;do 2.32 +for y in 2012 ;do 2.33 # get hotpost URLS 2.34 - for hot in $(curl -s ${HOTSPOTS_URL}/${y}/ | grep -o '>HMSG2.*\.nt' | colrm 1 1); do 2.35 + for hot in $(curl -s ${HOTSPOTS_URL}/${y}/ | grep -o '>HMSG.*\.nt' | colrm 1 1); do 2.36 file="${HOTSPOTS_URL}/${y}/${hot}" 2.37 2.38 + time_status=$(echo ${hot} | egrep -o '[[:digit:]]{6}_[[:digit:]]{4}') 2.39 + 2.40 # get time information for acquisition 2.41 - year=${y} 2.42 - month=$(expr substr ${hot} 19 2) 2.43 - day=$(expr substr ${hot} 21 2) 2.44 - time2=$(expr substr ${hot} 24 2) 2.45 - time2="${time2}:$(expr substr ${hot} 26 2)" 2.46 + year="20$(expr substr ${time_status} 1 2)" 2.47 + month=$(expr substr ${time_status} 3 2) 2.48 + day=$(expr substr ${time_status} 5 2) 2.49 + time2=$(expr substr ${time_status} 8 2) 2.50 + time2="${time2}:$(expr substr ${time_status} 10 2)" 2.51 2.52 # store file 2.53 echo -n "storing " $file; echo; echo;