Strabon

annotate examples/teleios/discoverFires.rq @ 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 3b3e9ed00cf0
children
rev   line source
ggarbis@788 1 #Το πρώτο query εφαρμόζεται με σκοπό τον περιορισμό τoυ θορύβου,
ggarbis@788 2 #εντοπίζοντας την χρονική αστάθεια ("αναλαμπές") σε πολύγωνα
ggarbis@788 3 #καμένων εκτάσεων. Υλοποιήσαμε και εφαρμόσαμε το ακόλουθο χρονικό φίλτρο
ggarbis@788 4 #στα δεδομένα (με αναφορές στον πηγαίο κώδικα):
ggarbis@788 5 #- Στις γραμμές 1574..1614, για κάθε πολύγωνο, ομαδοποιούμε τις
ggarbis@788 6 #καταγραφές οι οποίες δεν απέχουν μεταξύ τους (επόμενη-προηγούμενη)
ggarbis@788 7 #περισσότερο από την τιμή της μεταβλητής persistence.
ggarbis@788 8 #- Στην συνέχεια εξετάζουμε κάθε τέτοια ομάδα (κοντινών στο χώρο
ggarbis@788 9 #καταγραφών), και ελέγχουμε εάν το πλήθος τους (για κάθε τέτοια ομάδα)
ggarbis@788 10 #είναι μικρότερο ή ίσο από την τιμή της μεταβλητής repeat_in_persistence
ggarbis@788 11 #(γραμμές 1614..1630).
ggarbis@788 12 #- Αυτές τις καταγραφές τις διαγράφουμε θεωρώντας τις θόρυβο
ggarbis@788 13
ggarbis@788 14 PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
ggarbis@788 15 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
ggarbis@788 16 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
ggarbis@788 17 PREFIX strdf-ext: <http://strdf.di.uoa.gr/extensions/ontology#>
ggarbis@788 18 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
ggarbis@788 19 PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
ggarbis@788 20
ggarbis@805 21 # The ending time of a fire (identificated by its starting time) is the latest
ggarbis@805 22 # hotspot attributed to this fire
ggarbis@793 23 SELECT ?start (max(?hTime) as ?end) ?geo
ggarbis@793 24 WHERE
ggarbis@793 25 {
ggarbis@793 26 {
ggarbis@805 27 # Each hotspots is finally grouped only with the latest fire starting
ggarbis@805 28 # time found
ggarbis@793 29 SELECT (max(?hStartTime) as ?start) ?hTime ?geo ?h
ggarbis@807 30 # SELECT (count(distinct ?hStartTime) as ?c) ?geo
ggarbis@793 31 WHERE {
ggarbis@793 32 # -- FIND HOTSPOTS THAT DEFINE THE START OF A FIRE (GROUP ALA THEMOS) --
ggarbis@793 33 # Retrieve all hotstpots in time range...
ggarbis@793 34 ?hStart noa:hasAcquisitionTime ?hStartTime ;
ggarbis@793 35 noa:hasGeometry ?geo ;
ggarbis@793 36 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
ggarbis@793 37 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
ggarbis@826 38 OPTIONAL {?hStart noa:isDiscarded ?hStartDisc }. FILTER (!bound(?hStartDisc)) .
ggarbis@826 39 FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)>=0).
ggarbis@793 40 # ... narrow down results so that any previous hotspots is detected at least PERSISTENCE mins earlier
ggarbis@793 41 OPTIONAL {
ggarbis@793 42 ?hPrevious noa:hasAcquisitionTime ?hPreviousTime ;
ggarbis@793 43 noa:hasGeometry ?geo ;
ggarbis@793 44 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
ggarbis@793 45 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
ggarbis@826 46 OPTIONAL {?hPrevious noa:isDiscarded ?hPreviousDisc }. FILTER (!bound(?hPreviousDisc)) .
ggarbis@807 47 FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)>=0).
ggarbis@807 48 FILTER(strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) <= PERSISTENCE*60000 && strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) > 0).
ggarbis@793 49 }
ggarbis@793 50 FILTER(!bound(?hPrevious)) .
ggarbis@788 51
ggarbis@793 52 # FIND HOTSPOTS AFTER A FIRE STARTING TIME
ggarbis@793 53 ?h noa:hasAcquisitionTime ?hTime;
ggarbis@807 54 noa:hasGeometry ?geo;
ggarbis@793 55 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ;
ggarbis@793 56 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
ggarbis@826 57 OPTIONAL {?h noa:isDiscarded ?hDisc }. FILTER (!bound(?hDisc)) .
ggarbis@807 58 FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hTime)>=0).
ggarbis@807 59 FILTER(strdf-ext:diffDateTime(?hTime, ?hStartTime) >= 0).
ggarbis@793 60 }
ggarbis@807 61 # group by ?geo
ggarbis@793 62 group by ?h ?hTime ?geo
ggarbis@793 63 }.
ggarbis@788 64 }
ggarbis@793 65 group by ?start ?geo
ggarbis@826 66 having (count(?h) >= REPEAT_IN_PERS)
ggarbis@826 67