Strabon

changeset 807:1163025f7c46 DiffDateTime

This version of the query is quick enough
author George Garbis <ggarbis@di.uoa.gr>
date Fri Dec 14 18:12:51 2012 +0200 (2012-12-14)
parents 286493843743
children 299566cf0392
files examples/teleios/discoverFires-start.rq examples/teleios/exampleFires.ttl
line diff
     1.1 --- a/examples/teleios/discoverFires-start.rq	Fri Dec 14 18:11:04 2012 +0200
     1.2 +++ b/examples/teleios/discoverFires-start.rq	Fri Dec 14 18:12:51 2012 +0200
     1.3 @@ -29,6 +29,7 @@
     1.4  		# Each hotspots is finally grouped only with the latest fire starting
     1.5  		# time found
     1.6          SELECT (max(?hStartTime) as ?start) ?hTime ?geo ?h
     1.7 +#        SELECT (count(distinct ?hStartTime) as ?c) ?geo
     1.8          WHERE {
     1.9  	        # -- FIND HOTSPOTS THAT DEFINE THE START OF A FIRE (GROUP ALA THEMOS) -- 
    1.10  	        # Retrieve all hotstpots in time range...  
    1.11 @@ -36,26 +37,30 @@
    1.12                      noa:hasGeometry ?geo ;
    1.13  			        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    1.14  			        noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    1.15 -	        FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hStartTime && ?hStartTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    1.16 +	       # FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hStartTime && ?hStartTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    1.17 +             FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)>=0).
    1.18  	        # ... narrow down results so that any previous hotspots is detected at least PERSISTENCE mins earlier
    1.19              OPTIONAL {
    1.20                  ?hPrevious	noa:hasAcquisitionTime ?hPreviousTime ;
    1.21                  			noa:hasGeometry ?geo ;
    1.22  					        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    1.23  					        noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    1.24 -		        FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hStartTime && ?hStartTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    1.25 -                FILTER(strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) <= PERSISTENCE*60000 && ?hStartTime > ?hPreviousTime).
    1.26 +		    #    FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hPreviousTime && ?hPreviousTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    1.27 +         		FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)>=0).                
    1.28 +		        FILTER(strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) <= PERSISTENCE*60000 && strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) > 0).
    1.29              } 
    1.30              FILTER(!bound(?hPrevious)) .
    1.31  
    1.32              # FIND HOTSPOTS AFTER A FIRE STARTING TIME
    1.33              ?h  noa:hasAcquisitionTime ?hTime;
    1.34 -                noa:hasGeometry ?hGeo;
    1.35 +                noa:hasGeometry ?geo;
    1.36  		        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
    1.37  		        noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    1.38 -	        FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hStartTime && ?hStartTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    1.39 -            FILTER(?hTime >= ?hStartTime).
    1.40 +	        # FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hTime && ?hTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime).
    1.41 +        	FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hTime)>=0).   
    1.42 +	 	    FILTER(strdf-ext:diffDateTime(?hTime, ?hStartTime) >= 0).
    1.43          }
    1.44 +#		group by ?geo
    1.45          group by ?h ?hTime ?geo
    1.46      }.
    1.47  }
     2.1 --- a/examples/teleios/exampleFires.ttl	Fri Dec 14 18:11:04 2012 +0200
     2.2 +++ b/examples/teleios/exampleFires.ttl	Fri Dec 14 18:12:51 2012 +0200
     2.3 @@ -1,7 +1,7 @@
     2.4  # Παράδειγμα για το deleteReflections.rq
     2.5  # Έχει 4 ομάδες hotspot.
     2.6  # Η δύο πρώτες ομάδες (h111,h112,h121) απέχουν 10 λεπτά (persistence=10') άρα πάνε μαζί.
     2.7 -# Η δύο τελευταίες (h211, h221) απέχουν πάλι δέκα λεπτά και πάνε μαζί.
     2.8 +# Η δύο τελευταίες (h211, h221, h222) απέχουν πάλι δέκα λεπτά και πάνε μαζί.
     2.9  
    2.10  @prefix lgd: <http://linkedgeodata.org/triplify/> .
    2.11  @prefix lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
    2.12 @@ -42,3 +42,9 @@
    2.13  			noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ;
    2.14       		noa:isDerivedFromSensor "MSG2"^^xsd:string .
    2.15  
    2.16 +noa:h222	noa:hasAcquisitionTime "2012-08-24T12:45:00"^^xsd:dateTime ;
    2.17 +			noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ;
    2.18 +			noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ;
    2.19 +     		noa:isDerivedFromSensor "MSG2"^^xsd:string .
    2.20 +
    2.21 +