Strabon

view scripts/archive/v2/runNoaRefinementChain.sh-bakcup @ 965:69a0a785ef8f

added new "constants" module with artifactId "spatial-temporal-constants" and moved GeoConstants there
author Babis Nikolaou <charnik@di.uoa.gr>
date Tue Apr 02 13:27:01 2013 +0300 (2013-04-02)
parents 088dc9156bb8
children
line source
1 #!/bin/bash
2 LOC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4 ENDPOINT="http://localhost:8080/endpoint"
5 DB="endpoint"
6 GRIDURL="http://kk.di.uoa.gr/grid_4.nt"
8 #dataDir="http://localhost/noa-teleios/out_triples/"
9 dataDir="http://godel.di.uoa.gr/hotspots/"
10 name="HMSG2_IR_039_s7_070825"
11 suffix=".hotspots.n3"
13 logFile="chain.log"
14 #countWTime="/usr/bin/time -p %e"
15 #echo > ${logFile}
17 function timer()
18 {
19 if [[ $# -eq 0 ]]; then
20 echo $(date '+%s')
21 else
22 local stime=$1
23 etime=$(date '+%s')
25 if [[ -z "$stime" ]]; then stime=$etime; fi
27 dt=$((etime - stime))
28 ds=$((dt % 60))
29 dm=$(((dt / 60) % 60))
30 dh=$((dt / 3600))
31 printf '%d:%02d:%02d' $dh $dm $ds
32 fi
33 }
35 #prin
36 #tmr1=$(timer)
37 #meta
38 #tmr2=$(timer)
39 #ektypwsi
40 #printf 'LALA %s %s\n' $((tmr2-tmr1)) $(timer $tmr1)
43 deleteSeaHotspots=`cat ${LOC}/DeleteInSea.sparql` # | sed 's/\"/\\\"/g'`
44 refinePartialSeaHotspots=`cat ${LOC}/Refine.sparql` # | sed 's/\"/\\\"/g'`
45 refineTimePersistence=`cat ${LOC}/TimePersistence.sparql` # | sed 's/\"/\\\"/g'`
47 # Initialize
48 sudo service postgresql restart
49 echo "Dropping endpoint database";
50 sudo -u postgres dropdb ${DB}
51 echo "Creating endpoint database"
52 sudo -u postgres createdb ${DB} -T template_postgis
53 echo "restarting tomcat"
54 sudo service tomcat7 restart
56 echo "initializing database"
57 echo "S D R TP" >>stderr.txt
59 ../endpoint store ${ENDPOINT} N-Triples -u ${GRIDURL}
61 #./scripts/endpoint query ${ENDPOINT} "SELECT (COUNT(*) AS ?C) WHERE {?s ?p ?o}"
62 #sudo -u postgres psql -d endpoint -c 'CREATE INDEX datetime_values_idx_value ON datetime_values USING btree(value)';
63 #sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;';
66 #echo "Continue?"
67 #read a
72 for h in `seq 0 23 `; do
73 for m in `seq 0 15 45`; do
74 time=`printf "%02d%02d\n" $h $m`
75 time2=`printf "%02d:%02d\n" $h $m`
76 file=${dataDir}${name}_${time}$suffix
77 # file=${dataUrl}${name}_${time}$suffix
79 # store file
80 echo -n "storing " $file; echo; echo;
81 # echo "Hotspot : " $h:$m >> stderr.txt
82 # ${countTime} ./strabon -db endpoint store $file
84 tmr1=$(timer)
85 ../endpoint store ${ENDPOINT} N-Triples -u ${file}
86 tmr2=$(timer)
87 printf '%s ' $((tmr2-tmr1)) >>stderr.txt
89 # sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;';
91 echo;echo;echo;echo "File ${file} stored!" >> ${logFile}
92 # echo "Continue?"
93 # read a
95 # deleteSeaHotspots
96 echo -n "Going to deleteSeaHotspots 2007-08-25T${time2}:00 " ;echo; echo; echo;
97 query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/2007-08-25T${time2}:00/g" | \
98 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
99 sed "s/SENSOR/MSG2/g"`
100 # ${countTime} ./strabon -db endpoint update "${query}"
102 tmr1=$(timer)
103 ../endpoint update ${ENDPOINT} "${query}"
105 tmr2=$(timer)
106 printf '%s ' $((tmr2-tmr1)) >>stderr.txt
108 echo;echo;echo;echo "File ${file} deleteSeaHotspots done!"
109 # echo "Continue?"
110 # read a
112 # refinePartialSeaHotspots
113 echo -n "refinePartialSeaHotspots 2007-08-25T${time2}:00 " ; echo; echo ; echo;
114 query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/2007-08-25T${time2}:00/g" | \
115 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
116 sed "s/SENSOR/MSG2/g"`
117 # ${countTime} ./strabon -db endpoint update "${query}"
118 tmr1=$(timer)
119 ../endpoint update ${ENDPOINT} "${query}"
121 tmr2=$(timer)
122 printf '%s ' $((tmr2-tmr1)) >>stderr.txt
124 echo "File ${file} refinePartialSeaHotspots done!"
125 # echo "Continue?"
126 # read a
128 # refineTimePersistence
129 echo -n "Going to refineTimePersistence 2007-08-25T${time2}:00 ";echo;echo;echo;
130 min_acquisition_time=`date --date="2007-08-25 ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%m:00`
131 query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/2007-08-25T${time2}:00/g" | \
132 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
133 sed "s/SENSOR/MSG2/g" | \
134 sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \
135 sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g"`
137 # echo "Query:"
138 # echo "${query}"
139 # echo "Continue?"
140 # read a
141 # ${countTime} ./strabon -db endpoint update "${query}"
142 # ${countTime} ../endpoint update ${ENDPOINT} "${query}"
144 sudo -u postgres psql -d ${DB} -c 'VACUUM ANALYZE;';
147 tmr1=$(timer)
148 ../endpoint update ${ENDPOINT} "${query}"
149 tmr2=$(timer)
150 printf '%s \n' $((tmr2-tmr1)) >>stderr.txt
152 echo;echo;echo;echo "File ${file} timePersistence done!"
153 # echo "Continue?"
154 # read a
155 done
156 done
159 #for f in `ls /home/konstantina/noa-teleios/out_triples/HMSG2_IR_039_s7_070825_*.hotspots.n3`
160 #do
162 # echo "Store $f"
163 # ${countTime} ./scripts/strabon -db endpoint store $f
164 #
165 #
166 #done