Strabon

changeset 506:1056efcaa186

one pass over queries in v2.2 and chain script
author Babis Nikolaou <charnik@di.uoa.gr>
date Wed Jul 25 16:25:28 2012 +0300 (2012-07-25)
parents bd55cc99cea2
children 69fb6f4f192a
files scripts/v2.2/deleteSeaHotspots.sparql scripts/v2.2/discover.sparql scripts/v2.2/insertMunicipalities.sparql scripts/v2.2/landUseInvalidForFires.sparql scripts/v2.2/refinePartialSeaHotspots.sparql scripts/v2.2/refineTimePersistence.sparql scripts/v2.2/runNoaRefinementChain.sh
line diff
     1.1 --- a/scripts/v2.2/deleteSeaHotspots.sparql	Wed Jul 25 12:26:02 2012 +0300
     1.2 +++ b/scripts/v2.2/deleteSeaHotspots.sparql	Wed Jul 25 16:25:28 2012 +0300
     1.3 @@ -10,8 +10,8 @@
     1.4  ?h   noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
     1.5       noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
     1.6       noa:isDerivedFromSensor "SENSOR"^^xsd:string .
     1.7 -       OPTIONAL {
     1.8 -    ?h	gag:hasMunicipality ?muni .
     1.9 +  OPTIONAL {
    1.10 +     ?h	gag:hasMunicipality ?muni .
    1.11    } 
    1.12    FILTER(!bound(?muni)) .
    1.13  }
     2.1 --- a/scripts/v2.2/discover.sparql	Wed Jul 25 12:26:02 2012 +0300
     2.2 +++ b/scripts/v2.2/discover.sparql	Wed Jul 25 16:25:28 2012 +0300
     2.3 @@ -5,7 +5,7 @@
     2.4  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     2.5  PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     2.6  
     2.7 -SELECT ?h  (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ?conf ?muni
     2.8 +SELECT ?h (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ?conf ?muni
     2.9  WHERE { 
    2.10  ?h   noa:hasGeometry ?hGeo ;
    2.11       noa:hasAcquisitionTime ?hAcquisitionTime ; 
     3.1 --- a/scripts/v2.2/insertMunicipalities.sparql	Wed Jul 25 12:26:02 2012 +0300
     3.2 +++ b/scripts/v2.2/insertMunicipalities.sparql	Wed Jul 25 16:25:28 2012 +0300
     3.3 @@ -13,7 +13,7 @@
     3.4  		noa:hasGeometry ?hGeo ;
     3.5  		noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
     3.6  		noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
     3.7 -        noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime.
     3.8 +        	noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime .
     3.9  	?m	rdf:type gag:Dhmos ;
    3.10  		rdfs:label ?mLabel ;
    3.11  		strdf:hasGeometry ?mGeo .
     4.1 --- a/scripts/v2.2/landUseInvalidForFires.sparql	Wed Jul 25 12:26:02 2012 +0300
     4.2 +++ b/scripts/v2.2/landUseInvalidForFires.sparql	Wed Jul 25 16:25:28 2012 +0300
     4.3 @@ -4,20 +4,18 @@
     4.4  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     4.5  PREFIX clc: <http://geo.linkedopendata.gr/corine/ontology#>
     4.6  
     4.7 -
     4.8 -
     4.9  INSERT {?h noa:isDiscarded "1"^^xsd:int} 
    4.10  WHERE {
    4.11 -SELECT ?h WHERE 
    4.12 -{
    4.13 -?h   noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
    4.14 -     noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    4.15 -     noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    4.16 -     noa:hasGeometry ?hGeo.
    4.17 -?a   rdf:type   clc:ExcludeArea;
    4.18 -  clc:hasGeometry ?aGeo.
    4.19 -FILTER(strdf:mbbIntersects(?hGeo,?aGeo)).
    4.20 -} 
    4.21 -GROUP BY ?h ?hGeo
    4.22 -HAVING strdf:contains(strdf:union(?aGeo),?hGeo)
    4.23 +SELECT ?h 
    4.24 + WHERE {
    4.25 + ?h   noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
    4.26 +      noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    4.27 +      noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    4.28 +      noa:hasGeometry ?hGeo .
    4.29 + ?a   rdf:type   clc:ExcludeArea ;
    4.30 +     clc:hasGeometry ?aGeo .
    4.31 + FILTER(strdf:mbbIntersects(?hGeo,?aGeo)) .
    4.32 + } 
    4.33 + GROUP BY ?h ?hGeo
    4.34 + HAVING strdf:contains(strdf:union(?aGeo),?hGeo)
    4.35  }
     5.1 --- a/scripts/v2.2/refinePartialSeaHotspots.sparql	Wed Jul 25 12:26:02 2012 +0300
     5.2 +++ b/scripts/v2.2/refinePartialSeaHotspots.sparql	Wed Jul 25 16:25:28 2012 +0300
     5.3 @@ -4,7 +4,6 @@
     5.4  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     5.5  PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     5.6  
     5.7 -
     5.8  INSERT { ?h noa:isDiscarded "1"^^xsd:int . 
     5.9  	 ?valid rdf:type noa:Hotspot ;
    5.10  		noa:hasConfidence ?conf ;
    5.11 @@ -18,7 +17,7 @@
    5.12  		noa:isDerivedFromSatellite "SAT"^^xsd:string .
    5.13  }
    5.14  WHERE { 
    5.15 -  SELECT ?h  (strdf:intersection(?hGeo, strdf:union(?cGeo)) AS ?dif) (BNODE() AS ?valid) ?conf ?muni
    5.16 +  SELECT ?h (strdf:intersection(?hGeo, strdf:union(?cGeo)) AS ?dif) (BNODE() AS ?valid) ?conf ?muni
    5.17    WHERE { 
    5.18  ?h     noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime; 
    5.19         noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 
    5.20 @@ -28,7 +27,7 @@
    5.21         noa:hasConfidence ?conf .
    5.22  ?c     rdf:type noa:Coastline ;
    5.23         noa:hasGeometry ?cGeo .
    5.24 -	   FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . 
    5.25 +       FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . 
    5.26    }
    5.27    GROUP BY ?h ?hGeo ?conf ?muni
    5.28    HAVING strdf:overlap(?hGeo, strdf:union(?cGeo))
     6.1 --- a/scripts/v2.2/refineTimePersistence.sparql	Wed Jul 25 12:26:02 2012 +0300
     6.2 +++ b/scripts/v2.2/refineTimePersistence.sparql	Wed Jul 25 16:25:28 2012 +0300
     6.3 @@ -4,40 +4,39 @@
     6.4  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     6.5  PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     6.6  
     6.7 -
     6.8  INSERT {
     6.9   ?newHotspot rdf:type noa:Hotspot ;
    6.10 -		noa:hasConfidence ?hConfidence ;
    6.11 -	        noa:hasGeometry ?hGeometry1 ;
    6.12 -		noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 
    6.13 -	        noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.14 -		noa:hasConfirmation noa:unknown ;
    6.15 -	        noa:producedFromProcessingChain "PROCESSING_CHAIN-TimePersistence"^^xsd:string ; 
    6.16 -		noa:isProducedBy noa:noa ;
    6.17 -		 gag:hasMunicipality ?muni ;
    6.18 -		noa:isDerivedFromSatellite "SAT"^^xsd:string .
    6.19 -
    6.20 +	     noa:hasConfidence ?hConfidence ;
    6.21 +	     noa:hasGeometry ?hGeometry1 ;
    6.22 +	     noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 
    6.23 +	     noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.24 +	     noa:hasConfirmation noa:unknown ;
    6.25 +	     noa:producedFromProcessingChain "PROCESSING_CHAIN-TimePersistence"^^xsd:string ; 
    6.26 +	     noa:isProducedBy noa:noa ;
    6.27 +	     gag:hasMunicipality ?muni ;
    6.28 +	     noa:isDerivedFromSatellite "SAT"^^xsd:string .
    6.29  }
    6.30  WHERE {
    6.31    SELECT (BNODE() AS ?newHotspot)
    6.32    (SUM(?hConfidence1)/ACQUISITIONS_IN_HALF_AN_HOUR AS ?hConfidence)
    6.33    ?hGeometry1 ?muni
    6.34    WHERE {
    6.35 -    ?H1 noa:hasConfidence ?hConfidence1 .
    6.36 -    ?H1 noa:hasGeometry ?hGeometry1 .
    6.37 -    ?H1 gag:hasMunicipality ?muni .
    6.38 -    ?H1 noa:hasAcquisitionTime ?hAcquisitionTime1 .
    6.39 -    ?H1 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    6.40 -    ?H1 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string .
    6.41 +    ?H1 noa:hasConfidence ?hConfidence1 ;
    6.42 +	noa:hasGeometry ?hGeometry1 ;
    6.43 +	gag:hasMunicipality ?muni ;
    6.44 +	noa:hasAcquisitionTime ?hAcquisitionTime1 ;
    6.45 +	noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.46 +	noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string .
    6.47      OPTIONAL { ?H1 noa:isDiscarded ?z } .
    6.48      FILTER (!BOUND(?z)) .
    6.49 +    
    6.50      FILTER( "MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hAcquisitionTime1 && ?hAcquisitionTime1 < "TIMESTAMP"^^xsd:dateTime ) .
    6.51      OPTIONAL {
    6.52 -      ?H2 noa:hasGeometry ?HGEO2 .
    6.53 -      ?H2 noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime .
    6.54 -      ?H2 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    6.55 -      ?H2 noa:producedFromProcessingChain ?hProcessingChain2 .
    6.56 -      FILTER(("PROCESSING_CHAIN"^^xsd:string = ?hProcessingChain2)||("PROCESSING_CHAIN-TimePersistence"^^xsd:string = ?hProcessingChain2)).
    6.57 +      ?H2 noa:hasGeometry ?HGEO2 ;
    6.58 +	  noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
    6.59 +	  noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.60 +	  noa:producedFromProcessingChain ?hProcessingChain2 .
    6.61 +      FILTER(("PROCESSING_CHAIN"^^xsd:string = ?hProcessingChain2)||("PROCESSING_CHAIN-TimePersistence"^^xsd:string = ?hProcessingChain2)) .
    6.62        FILTER( strdf:mbbEquals(?hGeometry1, ?HGEO2) ) .
    6.63      }
    6.64      FILTER( !BOUND(?H2) ) .
     7.1 --- a/scripts/v2.2/runNoaRefinementChain.sh	Wed Jul 25 12:26:02 2012 +0300
     7.2 +++ b/scripts/v2.2/runNoaRefinementChain.sh	Wed Jul 25 16:25:28 2012 +0300
     7.3 @@ -117,12 +117,16 @@
     7.4  		# get sensor
     7.5  		SENSOR=$(echo ${hot} | grep -o 'MSG.')
     7.6  
     7.7 -		# get satellite
     7.8 +		# get satellite and set number of acquisitions per hour
     7.9  		if test "${SENSOR}" = "MSG2"; then
    7.10  			SAT="METEOSAT9"
    7.11 +
    7.12 +			N_ACQUISITIONS=3.0
    7.13  		else
    7.14  			SAT="METEOSAT8"
    7.15  			SENSOR="MSG1_RSS"
    7.16 +
    7.17 +			N_ACQUISITIONS=11.0
    7.18  		fi
    7.19  
    7.20  		# get time information for acquisition and construct timestamp
    7.21 @@ -158,7 +162,7 @@
    7.22  
    7.23  		tmr1=$(timer)
    7.24  
    7.25 -		query=`echo "${insertMunicipalities}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    7.26 +		query=`echo "${insertMunicipalities}" | sed "s/TIMESTAMP/${TIMESTAMP}/g" | \
    7.27  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    7.28  		sed "s/SENSOR/${SENSOR}/g"`
    7.29  
    7.30 @@ -176,8 +180,8 @@
    7.31  		fi
    7.32  		
    7.33  		# deleteSeaHotspots
    7.34 -		echo -n "Going to deleteSeaHotspots ${year}-${month}-${day}T${time2}:00 " ;echo; echo; echo;
    7.35 -		query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    7.36 +		echo -n "Going to deleteSeaHotspots ${TIMESTAMP} " ;echo; echo; echo;
    7.37 +		query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/${TIMESTAMP}/g" | \
    7.38  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    7.39  		sed "s/SENSOR/${SENSOR}/g"`
    7.40  		# ${countTime} ./strabon -db endpoint update "${query}"
    7.41 @@ -189,14 +193,12 @@
    7.42  		printf '%s ' $((tmr2-tmr1)) >>stderr.txt
    7.43  		echo;echo;echo;echo "File ${file} deleteSeaHotspots done!"
    7.44  
    7.45 -		# echo "Continue?"
    7.46 -		# read a
    7.47 -			# invalidForFires
    7.48 -		echo -n "invalidForFires ${year}-${month}-${day}T${time2}:00 "  ; echo; echo ; echo;
    7.49 -		query=`echo "${invalidForFires}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    7.50 +		# invalidForFires
    7.51 +		echo -n "invalidForFires ${TIMESTAMP} "  ; echo; echo ; echo;
    7.52 +		query=`echo "${invalidForFires}" | sed "s/TIMESTAMP/${TIMESTAMP}/g" | \
    7.53  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    7.54 -		sed "s/SENSOR/${SENSOR}/g" |\
    7.55 -		sed "s/SAT/${SAT}/g"`
    7.56 +		sed "s/SENSOR/${SENSOR}/g"` 
    7.57 +
    7.58  		# ${countTime} ./strabon -db endpoint update "${query}"
    7.59  		tmr1=$(timer)
    7.60  		../endpoint update ${ENDPOINT} "${query}"
    7.61 @@ -205,8 +207,8 @@
    7.62  		echo "File ${file} invalidForFires done!"
    7.63   
    7.64  		# refinePartialSeaHotspots
    7.65 -		echo -n "refinePartialSeaHotspots ${year}-${month}-${day}T${time2}:00 "  ; echo; echo ; echo;
    7.66 -		query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    7.67 +		echo -n "refinePartialSeaHotspots ${TIMESTAMP} "  ; echo; echo ; echo;
    7.68 +		query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/${TIMESTAMP}/g" | \
    7.69  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    7.70  		sed "s/SENSOR/${SENSOR}/g" |\
    7.71  		sed "s/SAT/${SAT}/g"`
    7.72 @@ -221,12 +223,12 @@
    7.73  		# read a
    7.74  
    7.75  		# refineTimePersistence
    7.76 -		echo -n "Going to refineTimePersistence ${year}-${month}-${day}T${time2}:00 ";echo;echo;echo; 
    7.77 +		echo -n "Going to refineTimePersistence ${TIMESTAMP} ";echo;echo;echo; 
    7.78  		min_acquisition_time=`date --date="${year}-${month}-${day} ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%M:00`
    7.79 -		query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/${year}-${month}-${day}T${time2}:00/g" | \
    7.80 +		query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/${TIMESTAMP}/g" | \
    7.81  		sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \
    7.82  		sed "s/SENSOR/${SENSOR}/g" | \
    7.83 -		sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \
    7.84 +		sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/${N_ACQUISITIONS}/g" | \
    7.85  		sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g" |\
    7.86  		sed "s/SAT/${SAT}/g"`
    7.87  
    7.88 @@ -242,7 +244,7 @@
    7.89  
    7.90  
    7.91  		# discover
    7.92 -		echo -n "Going to discover ${year}-${month}-${day}T${time2}:00 ";echo;echo;echo; 
    7.93 +		echo -n "Going to discover ${TIMESTAMP} ";echo;echo;echo; 
    7.94  		min_acquisition_time=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%M:00`
    7.95  		max_acquisition_time=`date --date="${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%M:00`
    7.96  		query=`echo "${discover}" | \
    7.97 @@ -256,7 +258,6 @@
    7.98  		tmr2=$(timer)
    7.99  		printf '%s \n' $((tmr2-tmr1)) >>discover.txt
   7.100  		echo;echo;echo;echo "Discovered hotspots done!"
   7.101 -
   7.102  	done
   7.103  done
   7.104