Strabon

changeset 826:7ebfdbbce0d5 DiffDateTime

Some corrections in queries
author George Garbis <ggarbis@di.uoa.gr>
date Fri Dec 21 16:27:59 2012 +0200 (2012-12-21)
parents 3b3e9ed00cf0
children bc8d029d2088
files examples/teleios/deleteReflections.rq examples/teleios/deleteSeaHotspots.rq examples/teleios/discoverFires.rq
line diff
     1.1 --- a/examples/teleios/deleteReflections.rq	Wed Dec 19 18:04:34 2012 +0200
     1.2 +++ b/examples/teleios/deleteReflections.rq	Fri Dec 21 16:27:59 2012 +0200
     1.3 @@ -14,7 +14,7 @@
     1.4  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
     1.5  
     1.6  INSERT {?h1 noa:isDiscarded "1"^^xsd:int ;
     1.7 -           noa:refinedBy noa:reflections .
     1.8 +			noa:refinedBy noa:reflections .
     1.9  }
    1.10  WHERE {
    1.11      SELECT ?h1 (count(?h2) as ?h2Count)
    1.12 @@ -22,24 +22,24 @@
    1.13          # Retrieve a hotspot of the current acquisition
    1.14          ?h1 noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; #"2007-08-23T13:00:00"^^xsd:dateTime ; 
    1.15              noa:hasGeometry ?geo ;
    1.16 -		    noa:producedFromProcessingChain "CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
    1.17 +		    noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
    1.18           	noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string .
    1.19  
    1.20 -        # Retrieve all hotspots with the same geometry detected at least an hour ago
    1.21 +        # Retrieve all hotspots with the same geometry detected at most an hour ago
    1.22          ?h2	noa:hasAcquisitionTime ?h2Time ;
    1.23  	        noa:hasGeometry ?geo ;
    1.24 -	        noa:producedFromProcessingChain "CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
    1.25 +	        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
    1.26           	noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string .
    1.27 -    	FILTER("TIMESTAMP_MINUS_ONE_HOUR"^^xsd:dateTime < ?hTime && ?hTime <= "TIMESTAMP"^^xsd:dateTime ) .
    1.28 +    	FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?h2Time && ?h2Time <= "TIMESTAMP"^^xsd:dateTime ) .
    1.29  #        FILTER("2007-08-23T12:00:00"^^xsd:dateTime <= ?h2Time && ?h2Time <= "2007-08-23T13:00:00"^^xsd:dateTime) .
    1.30  
    1.31  		# Filter the results so that the above hotspots have no neighbours
    1.32          OPTIONAL {
    1.33              ?h3	noa:hasAcquisitionTime ?h3Time ;
    1.34  	            noa:hasGeometry ?h3Geo ;
    1.35 -	            noa:producedFromProcessingChain "CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
    1.36 +	            noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
    1.37               	noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string .
    1.38 -        	FILTER("TIMESTAMP_MINUS_ONE_HOUR"^^xsd:dateTime < ?hTime && ?hTime <= "TIMESTAMP"^^xsd:dateTime ) .
    1.39 +        	FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?h3Time && ?h3Time <= "TIMESTAMP"^^xsd:dateTime ) .
    1.40  #            FILTER("2007-08-23T12:00:00"^^xsd:dateTime <= ?h3Time && ?h3Time <= "2007-08-23T13:00:00"^^xsd:dateTime) .
    1.41  	        FILTER(strdf:touch(?geo, ?h3Geo)).
    1.42          }
    1.43 @@ -48,5 +48,5 @@
    1.44  	# Select every hotspot of the current acquisition which has no neighbours since an hour ago until now
    1.45  	# and is "on" during all this time (MSG2 can have 333 detections during an hour)
    1.46      GROUP BY ?h1
    1.47 -    HAVING (?h2Count > 3)
    1.48 +    HAVING (?h2Count >= ACQUISITIONS_IN_AN_HOUR)
    1.49  }
     2.1 --- a/examples/teleios/deleteSeaHotspots.rq	Wed Dec 19 18:04:34 2012 +0200
     2.2 +++ b/examples/teleios/deleteSeaHotspots.rq	Fri Dec 21 16:27:59 2012 +0200
     2.3 @@ -8,11 +8,11 @@
     2.4             noa:refinedBy noa:seaInconsistency .
     2.5  } 
     2.6  WHERE {
     2.7 -?h   noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
     2.8 -     noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
     2.9 -     noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    2.10 -       OPTIONAL {
    2.11 -    ?h	gag:hasMunicipality ?muni .
    2.12 -  } 
    2.13 -  FILTER(!bound(?muni)) .
    2.14 +	?h   noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
    2.15 +	     noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    2.16 +	     noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    2.17 +	OPTIONAL {
    2.18 +		?h	gag:hasMunicipality ?muni .
    2.19 +	} 
    2.20 +	FILTER(!bound(?muni)) .
    2.21  }
     3.1 --- a/examples/teleios/discoverFires.rq	Wed Dec 19 18:04:34 2012 +0200
     3.2 +++ b/examples/teleios/discoverFires.rq	Fri Dec 21 16:27:59 2012 +0200
     3.3 @@ -11,8 +11,6 @@
     3.4  #(γραμμές 1614..1630).
     3.5  #- Αυτές τις καταγραφές τις διαγράφουμε θεωρώντας τις θόρυβο
     3.6  
     3.7 -# ../../scripts/strabon -db testNOANewRefinements query  "`./instantiate.sh -s MSG2 -c StaticThresholds  -m '2012-08-24T12:00:00' -M '2012-08-24T12:40:00' -p 10 -r 3 discoverFires-start.rq | grep -v '#[[:alpha:]]' | grep -v '#[ \(-]' | sed 's/"/\\\\"/g'`" TSV
     3.8 -
     3.9  PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
    3.10  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    3.11  PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
    3.12 @@ -37,15 +35,15 @@
    3.13                      noa:hasGeometry ?geo ;
    3.14  			        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    3.15  			        noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    3.16 -	       # FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hStartTime && ?hStartTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    3.17 -             FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)>=0).
    3.18 +            OPTIONAL {?hStart noa:isDiscarded ?hStartDisc }. FILTER (!bound(?hStartDisc)) .
    3.19 +            FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)>=0).
    3.20  	        # ... narrow down results so that any previous hotspots is detected at least PERSISTENCE mins earlier
    3.21              OPTIONAL {
    3.22                  ?hPrevious	noa:hasAcquisitionTime ?hPreviousTime ;
    3.23                  			noa:hasGeometry ?geo ;
    3.24  					        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    3.25  					        noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    3.26 -		    #    FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hPreviousTime && ?hPreviousTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    3.27 +                OPTIONAL {?hPrevious noa:isDiscarded ?hPreviousDisc }. FILTER (!bound(?hPreviousDisc)) .
    3.28           		FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)>=0).                
    3.29  		        FILTER(strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) <= PERSISTENCE*60000 && strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) > 0).
    3.30              } 
    3.31 @@ -56,7 +54,7 @@
    3.32                  noa:hasGeometry ?geo;
    3.33  		        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    3.34  		        noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    3.35 -	        # FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hTime && ?hTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    3.36 +            OPTIONAL {?h noa:isDiscarded ?hDisc }. FILTER (!bound(?hDisc)) .
    3.37          	FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hTime)>=0).   
    3.38  	 	    FILTER(strdf-ext:diffDateTime(?hTime, ?hStartTime) >= 0).
    3.39          }
    3.40 @@ -65,4 +63,5 @@
    3.41      }.
    3.42  }
    3.43  group by ?start ?geo
    3.44 -having (count(?h) >= 3)
    3.45 +having (count(?h) >= REPEAT_IN_PERS)
    3.46 +