Strabon

view scripts/archive/v2/runNoaRefinementChain.sh @ 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="strabon27"
6 GRIDURL="http://kk.di.uoa.gr/grid_4.nt"
7 CHECKDIR="/home/konstantina/allhot/"
9 #dataDir="http://localhost/noa-teleios/out_triples/"
10 #dataDir="http://kk.di.uoa.gr/out_triples/"
11 dataDir="http://godel.di.uoa.gr/allhot/"
12 name="HMSG2_IR_039_s7_07"
13 suffix=".hotspots.nt"
15 logFile="chain.log"
16 #countWTime="/usr/bin/time -p %e"
17 #echo > ${logFile}
19 function timer()
20 {
21 if [[ $# -eq 0 ]]; then
22 echo $(date '+%s')
23 else
24 local stime=$1
25 etime=$(date '+%s')
27 if [[ -z "$stime" ]]; then stime=$etime; fi
29 dt=$((etime - stime))
30 ds=$((dt % 60))
31 dm=$(((dt / 60) % 60))
32 dh=$((dt / 3600))
33 printf '%d:%02d:%02d' $dh $dm $ds
34 fi
35 }
37 #prin
38 #tmr1=$(timer)
39 #meta
40 #tmr2=$(timer)
41 #ektypwsi
42 #printf 'LALA %s %s\n' $((tmr2-tmr1)) $(timer $tmr1)
45 deleteSeaHotspots=`cat ${LOC}/DeleteInSea.sparql` # | sed 's/\"/\\\"/g'`
46 refinePartialSeaHotspots=`cat ${LOC}/Refine.sparql` # | sed 's/\"/\\\"/g'`
47 refineTimePersistence=`cat ${LOC}/TimePersistence.sparql` # | sed 's/\"/\\\"/g'`
49 # Initialize
50 sudo service postgresql restart
51 echo "Dropping endpoint database";
52 sudo -u postgres dropdb ${DB}
53 echo "Creating endpoint database"
54 sudo -u postgres createdb ${DB} -T postgistemplate
55 echo "restarting tomcat"
56 sudo service tomcat7 restart
58 echo "initializing database"
59 echo "S D R TP" >>stderr.txt
61 ../endpoint store ${ENDPOINT} N-Triples -u ${GRIDURL}
64 #./scripts/endpoint query ${ENDPOINT} "SELECT (COUNT(*) AS ?C) WHERE {?s ?p ?o}"
65 #sudo -u postgres psql -d endpoint -c 'CREATE INDEX datetime_values_idx_value ON datetime_values USING btree(value)';
66 #sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;';
69 #echo "Continue?"
70 #read a
73 for mon in `seq 7 10`; do
74 for d in `seq 1 30`; do
75 for h in `seq 0 23 `; do
76 for m in `seq 0 15 45`; do
77 time=`printf "%02d%02d\n" $h $m`
78 time2=`printf "%02d:%02d\n" $h $m`
79 day=`printf "%02d" $d`
80 month=`printf "%02d" $mon`
81 file=${dataDir}${name}${month}${day}_${time}$suffix
82 # file=${dataUrl}${name}_${time}$suffix
84 check=${CHECKDIR}${name}${month}${day}_${time}$suffix
86 if [[ ! -e $check ]];
87 then echo "FILE" $check "NOT EXISTS" ; continue
88 fi
90 # store file
91 echo -n "storing " $file; echo; echo;
92 # echo "Hotspot : " $h:$m >> stderr.txt
93 # ${countTime} ./strabon -db endpoint store $file
95 tmr1=$(timer)
96 ../endpoint store ${ENDPOINT} N-Triples -u ${file}
97 tmr2=$(timer)
98 printf '%s ' $((tmr2-tmr1)) >>stderr.txt
100 # sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;';
102 echo;echo;echo;echo "File ${file} stored!" >> ${logFile}
103 # echo "Continue?"
104 # read a
106 # deleteSeaHotspots
107 echo -n "Going to deleteSeaHotspots 2007-${month}-${day}T${time2}:00 " ;echo; echo; echo;
108 query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/2007-${month}-${day}T${time2}:00/g" | \
109 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
110 sed "s/SENSOR/MSG2/g"`
111 # ${countTime} ./strabon -db endpoint update "${query}"
113 tmr1=$(timer)
114 ../endpoint update ${ENDPOINT} "${query}"
116 tmr2=$(timer)
117 printf '%s ' $((tmr2-tmr1)) >>stderr.txt
119 echo;echo;echo;echo "File ${file} deleteSeaHotspots done!"
120 # echo "Continue?"
121 # read a
123 # refinePartialSeaHotspots
124 echo -n "refinePartialSeaHotspots 2007-${month}-${day}T${time2}:00 " ; echo; echo ; echo;
125 query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/2007-${month}-${day}T${time2}:00/g" | \
126 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
127 sed "s/SENSOR/MSG2/g"`
128 # ${countTime} ./strabon -db endpoint update "${query}"
129 tmr1=$(timer)
130 ../endpoint update ${ENDPOINT} "${query}"
132 tmr2=$(timer)
133 printf '%s ' $((tmr2-tmr1)) >>stderr.txt
135 echo "File ${file} refinePartialSeaHotspots done!"
136 # echo "Continue?"
137 # read a
139 # refineTimePersistence
140 echo -n "Going to refineTimePersistence 2007-${month}-${day}T${time2}:00 ";echo;echo;echo;
141 min_acquisition_time=`date --date="2007-${month}-${day} ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%m:00`
142 query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/2007-${month}-${day}T${time2}:00/g" | \
143 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
144 sed "s/SENSOR/MSG2/g" | \
145 sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \
146 sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g"`
148 # echo "Query:"
149 # echo "${query}"
150 # echo "Continue?"
151 # read a
152 # ${countTime} ./strabon -db endpoint update "${query}"
153 # ${countTime} ../endpoint update ${ENDPOINT} "${query}"
155 sudo -u postgres psql -d ${DB} -c 'VACUUM ANALYZE;';
158 tmr1=$(timer)
159 ../endpoint update ${ENDPOINT} "${query}"
160 tmr2=$(timer)
161 printf '%s \n' $((tmr2-tmr1)) >>stderr.txt
163 echo;echo;echo;echo "File ${file} timePersistence done!"
164 # echo "Continue?"
165 # read a
166 done
167 done
168 done
169 done
172 #for f in `ls /home/konstantina/noa-teleios/out_triples/HMSG2_IR_039_s7_070825_*.hotspots.n3`
173 #do
175 # echo "Store $f"
176 # ${countTime} ./scripts/strabon -db endpoint store $f
177 #
178 #
179 #done