Strabon

annotate examples/teleios/deleteReflections.rq @ 1453:2fac60132bc8

completed imlpementation of the period(timestamp,timestamp) function
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Wed Jan 14 13:12:30 2015 +0200 (2015-01-14)
parents 35ee9c800a47
children
rev   line source
ggarbis@786 1 # Θεωρούμε ότι εαν ένα πολύγωνο παραμένει ενεργό για μεγάλο χρονικό
ggarbis@786 2 # διάστημα, χωρίς παράλληλα να ενεργοποιείται κάποιο γειτονικό του, τότε
ggarbis@786 3 # αυτό το πολύγωνο είναι θόρυβος.
ggarbis@786 4 # Συγκεκριμένα, για όλο το χρονικό διάστημα ενδιαφέροντος και για κάθε grid:
ggarbis@786 5 # - Υπολογίζω την χρονική διαφορά της τελευταίας από την πρώτη καταγραφή.
ggarbis@786 6 # - Εαν αυτή είναι μεγαλύτερη της μίας ώρας &
ggarbis@786 7 # - Για όλο αυτό το διάστημα δεν υπάρχουν γειτονικα πολύγωνα ενεργά
ggarbis@786 8 # (adjacent polygons)
ggarbis@786 9 # - Τότε οι συγκεκριμένες καταγραφές διαγράφονται
ggarbis@786 10
ggarbis@786 11 PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
ggarbis@786 12 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
ggarbis@786 13 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
ggarbis@786 14 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
ggarbis@786 15
ggarbis@786 16 INSERT {?h1 noa:isDiscarded "1"^^xsd:int ;
ggarbis@826 17 noa:refinedBy noa:reflections .
ggarbis@786 18 }
ggarbis@786 19 WHERE {
ggarbis@786 20 SELECT ?h1 (count(?h2) as ?h2Count)
ggarbis@786 21 WHERE {
ggarbis@786 22 # Retrieve a hotspot of the current acquisition
ggarbis@786 23 ?h1 noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; #"2007-08-23T13:00:00"^^xsd:dateTime ;
ggarbis@786 24 noa:hasGeometry ?geo ;
ggarbis@826 25 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
ggarbis@786 26 noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string .
ggarbis@786 27
ggarbis@826 28 # Retrieve all hotspots with the same geometry detected at most an hour ago
ggarbis@786 29 ?h2 noa:hasAcquisitionTime ?h2Time ;
ggarbis@786 30 noa:hasGeometry ?geo ;
ggarbis@826 31 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
ggarbis@786 32 noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string .
ggarbis@826 33 FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?h2Time && ?h2Time <= "TIMESTAMP"^^xsd:dateTime ) .
ggarbis@786 34 # FILTER("2007-08-23T12:00:00"^^xsd:dateTime <= ?h2Time && ?h2Time <= "2007-08-23T13:00:00"^^xsd:dateTime) .
ggarbis@786 35
ggarbis@789 36 # Filter the results so that the above hotspots have no neighbours
ggarbis@786 37 OPTIONAL {
ggarbis@786 38 ?h3 noa:hasAcquisitionTime ?h3Time ;
ggarbis@786 39 noa:hasGeometry ?h3Geo ;
ggarbis@826 40 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ;
ggarbis@786 41 noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string .
ggarbis@826 42 FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?h3Time && ?h3Time <= "TIMESTAMP"^^xsd:dateTime ) .
ggarbis@786 43 # FILTER("2007-08-23T12:00:00"^^xsd:dateTime <= ?h3Time && ?h3Time <= "2007-08-23T13:00:00"^^xsd:dateTime) .
ggarbis@786 44 FILTER(strdf:touch(?geo, ?h3Geo)).
ggarbis@786 45 }
ggarbis@786 46 FILTER(!bound(?h3)) .
ggarbis@786 47 }
ggarbis@789 48 # Select every hotspot of the current acquisition which has no neighbours since an hour ago until now
ggarbis@789 49 # and is "on" during all this time (MSG2 can have 333 detections during an hour)
ggarbis@786 50 GROUP BY ?h1
ggarbis@826 51 HAVING (?h2Count >= ACQUISITIONS_IN_AN_HOUR)
ggarbis@786 52 }