Strabon

view scripts/runNoaRefinement.sh @ 1426:014379fdddf2

fixed the tests of geof:distance and geof:buffer, that had wrong results due to the
conversion of the resulting geometry to the srid 3857.
The results are validated using PostGIS, where in the case of buffer there are
small differences in the precision.
Moreover, in the case of BufferMetresTest, there was no point in having as distance
1m, because the geometry did not change, so i added 55000 metres instead (about 0.5 degrees).
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Wed Sep 24 17:43:53 2014 +0300 (2014-09-24)
parents b95784675cc7
children
line source
1 #! /bin/bash
3 #
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 #
8 # Copyright (C) 2010, 2011, 2012, Pyravlos Team
9 #
10 # http://www.strabon.di.uoa.gr/
11 #
14 dataDir="/home/ggarbis/TELEIOS/NOA_Processing_Chain/chain_msg2/data/out_triples/"
15 dataUrl="http://pathway.di.uoa.gr/hotspots/out_triples/"
16 name="HMSG2_IR_039_s7_070825"
17 suffix=".hotspots.n3"
19 logFile="chain.log"
20 countTime="/usr/bin/time -ao ${logFile} -f %e"
21 echo > ${logFile}
23 deleteSeaHotspots="PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
24 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
25 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
26 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
28 DELETE {?h ?property ?object}
29 WHERE {
30 ?h rdf:type noa:Hotspot;
31 noa:hasAcquisitionTime \"TIMESTAMP\"^^xsd:dateTime;
32 noa:producedFromProcessingChain \"PROCESSING_CHAIN\"^^xsd:string;
33 noa:isDerivedFromSensor \"SENSOR\"^^xsd:string;
34 noa:hasGeometry ?hGeo;
35 ?property ?object .
36 OPTIONAL {
37 ?c rdf:type noa:Coastline;
38 noa:hasGeometry ?cGeo .
39 FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) .
40 }
41 FILTER(!bound(?c)) .
42 }"
44 refinePartialSeaHotspots="PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
45 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
46 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
47 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
49 DELETE { ?h noa:hasGeometry ?hGeo}
50 INSERT { ?h noa:hasGeometry ?dif}
51 WHERE {
52 SELECT DISTINCT ?h ?hGeo (strdf:intersection(?hGeo, strdf:union(?cGeo)) AS ?dif)
53 WHERE {
54 ?h rdf:type noa:Hotspot;
55 noa:hasAcquisitionTime ?hAcqTime;
56 noa:producedFromProcessingChain \"PROCESSING_CHAIN\"^^xsd:string;
57 noa:isDerivedFromSensor \"SENSOR\"^^xsd:string;
58 noa:hasGeometry ?hGeo .
59 FILTER(\"TIMESTAMP\"^^xsd:dateTime = ?hAcqTime) .
60 ?c rdf:type noa:Coastline;
61 noa:hasGeometry ?cGeo .
62 FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) .
63 }
64 GROUP BY ?h ?hGeo
65 HAVING strdf:overlap(?hGeo, strdf:union(?cGeo))
66 }"
68 refineTimePersistence="PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
69 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
70 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
71 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
73 INSERT {
74 ?newHotspot rdf:type noa:Hotspot .
75 ?newHotspot noa:hasConfidence ?hConfidence .
76 ?newHotspot noa:hasGeometry ?hGeometry1 .
77 ?newHotspot noa:hasAcquisitionTime \"TIMESTAMP\"^^xsd:dateTime .
78 ?newHotspot noa:isDerivedFromSensor \"SENSOR\"^^xsd:string .
79 ?newHotspot noa:hasConfirmation noa:unknown .
80 ?newHotspot noa:producedFromProcessingChain ?hProcessingChain .
81 ?newHotspot noa:isProducedBy noa:noa .
82 }
83 WHERE {
84 SELECT (BNODE() AS ?newHotspot)
85 (SUM(?hConfidence1)/ACQUISITIONS_IN_HALF_AN_HOUR AS ?hConfidence)
86 ?hGeometry1
87 (CONCAT(\"PROCESSING_CHAIN\"^^xsd:string,\"-TimePersistence\") AS ?hProcessingChain)
88 WHERE {
89 ?H1 rdf:type noa:Hotspot .
90 ?H1 noa:hasConfidence ?hConfidence1 .
91 ?H1 noa:hasGeometry ?hGeometry1 .
92 ?H1 noa:hasAcquisitionTime ?hAcquisitionTime1 .
93 ?H1 noa:isDerivedFromSensor \"SENSOR\"^^xsd:string .
94 ?H1 noa:hasConfirmation noa:unknown .
95 ?H1 noa:producedFromProcessingChain \"PROCESSING_CHAIN\"^^xsd:string .
96 ?H1 noa:isProducedBy noa:noa .
97 FILTER( \"MIN_ACQUISITION_TIME\"^^xsd:dateTime <= ?hAcquisitionTime1 && ?hAcquisitionTime1 < \"TIMESTAMP\"^^xsd:dateTime ) .
98 OPTIONAL {
99 ?H2 rdf:type noa:Hotspot .
100 ?H2 noa:hasGeometry ?HGEO2 .
101 ?H2 noa:hasAcquisitionTime ?hAcquisitionTime2 .
102 ?H2 noa:isDerivedFromSensor \"SENSOR\"^^xsd:string .
103 ?H2 noa:producedFromProcessingChain ?hProcessingChain2 .
104 FILTER(regex(\"PROCESSING_CHAIN\"^^xsd:string, ?hProcessingChain2)).
105 FILTER( strdf:equals(?hGeometry1, ?HGEO2) ) .
106 FILTER(?hAcquisitionTime2 = \"TIMESTAMP\"^^xsd:dateTime) .
107 }
108 FILTER( !BOUND(?H2) ) .
109 }
110 GROUP BY ?hGeometry1
111 HAVING(SUM(?hConfidence1)>0.0)
112 }
113 "
115 # Initialize
116 sudo service postgresql restart
117 dropdb endpoint
118 createdb endpoint -T template_postgis
119 sudo service tomcat6 restart
120 ./endpoint store http://localhost:8080/endpoint N-Triples -u http://pathway.di.uoa.gr/hotspots/grid_4.nt
122 #./scripts/endpoint query http://localhost:8080/endpoint "SELECT (COUNT(*) AS ?C) WHERE {?s ?p ?o}"
123 #echo "Continue?"
124 #read a
128 for h in `seq 0 12`; do
129 for m in `seq 0 15 45`; do
130 time=`printf "%02d%02d\n" $h $m`
131 time2=`printf "%02d:%02d\n" $h $m`
132 # file=${dataDir}${name}_${time}$suffix
133 file=${dataUrl}${name}_${time}$suffix
135 # store file
136 echo -n "storing 2007-08-25T${time2}:00 " >> ${logFile}
137 # ${countTime} ./strabon -db endpoint store $file
138 ${countTime} ./endpoint store http://localhost:8080/endpoint N-Triples -u ${file}
140 # echo "File ${file} stored!" >> ${logFile}
141 # echo "Continue?"
142 # read a
144 # deleteSeaHotspots
145 echo -n "deleteSeaHotspots 2007-08-25T${time2}:00 " >> ${logFile}
146 query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/2007-08-25T${time2}:00/g" | \
147 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
148 sed "s/SENSOR/MSG2/g"`
149 # ${countTime} ./strabon -db endpoint update "${query}"
150 ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}"
152 # echo "File ${file} deleteSeaHotspots done!"
153 # echo "Continue?"
154 # read a
156 # refinePartialSeaHotspots
157 echo -n "refinePartialSeaHotspots 2007-08-25T${time2}:00 " >> ${logFile}
158 query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/2007-08-25T${time2}:00/g" | \
159 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
160 sed "s/SENSOR/MSG2/g"`
161 # ${countTime} ./strabon -db endpoint update "${query}"
162 ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}"
164 # echo "File ${file} refinePartialSeaHotspots done!"
165 # echo "Continue?"
166 # read a
168 # refineTimePersistence
169 echo -n "refineTimePersistence 2007-08-25T${time2}:00 " >> ${logFile}
170 min_acquisition_time=`date --date="2007-08-25 ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%m:00`
171 query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/2007-08-25T${time2}:00/g" | \
172 sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
173 sed "s/SENSOR/MSG2/g" | \
174 sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \
175 sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g"`
177 # echo "Query:"
178 # echo "${query}"
179 # echo "Continue?"
180 # read a
181 # ${countTime} ./strabon -db endpoint update "${query}"
182 # ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}"
183 ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}"
185 # echo "File ${file} refinePartialSeaHotspots done!"
186 # echo "Continue?"
187 # read a
188 done
189 done
192 #for f in `ls /home/ggarbis/TELEIOS/NOA_Processing_Chain/chain_msg2/data/out_triples/HMSG2_IR_039_s7_070825_*.hotspots.n3`
193 #do
195 # echo "Store $f"
196 # ${countTime} ./scripts/strabon -db endpoint store $f
197 #
198 #
199 #done