Strabon

changeset 529:d9e6882ac11a

fix queries for delete in sea with kallikratis etc.
author George Garbis <ggarbis@di.uoa.gr>
date Mon Jul 30 23:09:39 2012 +0300 (2012-07-30)
parents ee19ee42b46f
children dcfff8c3fe37
files scripts/v2.3/deleteSeaHotspots.sparql scripts/v2.3/discover.sparql scripts/v2.3/insertMunicipalities.sparql scripts/v2.3/landUseInvalidForFires.sparql scripts/v2.3/refinePartialSeaHotspots.sparql scripts/v2.3/refineTimePersistence.sparql scripts/v2.3/runNoaRefinementChain.sh
line diff
     1.1 --- a/scripts/v2.3/deleteSeaHotspots.sparql	Mon Jul 30 22:13:58 2012 +0300
     1.2 +++ b/scripts/v2.3/deleteSeaHotspots.sparql	Mon Jul 30 23:09:39 2012 +0300
     1.3 @@ -2,8 +2,7 @@
     1.4  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
     1.5  PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
     1.6  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
     1.7 -PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     1.8 -
     1.9 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
    1.10  
    1.11  INSERT {?h noa:isDiscarded "1"^^xsd:int} 
    1.12  WHERE {
     2.1 --- a/scripts/v2.3/discover.sparql	Mon Jul 30 22:13:58 2012 +0300
     2.2 +++ b/scripts/v2.3/discover.sparql	Mon Jul 30 23:09:39 2012 +0300
     2.3 @@ -3,17 +3,18 @@
     2.4  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
     2.5  PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 
     2.6  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     2.7 -PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     2.8 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
     2.9  
    2.10  SELECT ?h  (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ?conf ?muni
    2.11  WHERE { 
    2.12  ?h   noa:hasGeometry ?hGeo ;
    2.13       noa:hasAcquisitionTime ?hAcquisitionTime ; 
    2.14 -     noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 
    2.15 +     noa:producedFromProcessingChain ?hProcessingChain ; 
    2.16       noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    2.17       noa:hasConfidence ?conf ;
    2.18       gag:hasMunicipality ?muni .
    2.19 -     FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hAcquisitionTime && ?hAcquisitionTime < "MAX_ACQUISITION_TIME"^^xsd:dateTime ) .
    2.20 +     FILTER(?hProcessingChain = "PROCESSING_CHAIN" || ?hProcessingChain = "PROCESSING_CHAIN-TimePersistence") .
    2.21 +     FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hAcquisitionTime && ?hAcquisitionTime <= "MAX_ACQUISITION_TIME"^^xsd:dateTime ) .
    2.22       OPTIONAL {?h noa:isDiscarded ?disc }.
    2.23       FILTER (!bound(?disc)) .
    2.24  }
     3.1 --- a/scripts/v2.3/insertMunicipalities.sparql	Mon Jul 30 22:13:58 2012 +0300
     3.2 +++ b/scripts/v2.3/insertMunicipalities.sparql	Mon Jul 30 23:09:39 2012 +0300
     3.3 @@ -2,7 +2,7 @@
     3.4  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
     3.5  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
     3.6  PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
     3.7 -PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     3.8 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
     3.9  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
    3.10  
    3.11  INSERT { ?h gag:hasMunicipality ?muni }
    3.12 @@ -16,8 +16,8 @@
    3.13          noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime.
    3.14  	?m	rdf:type gag:Dhmos ;
    3.15  		rdfs:label ?mLabel ;
    3.16 -		strdf:hasGeometry ?mGeo .
    3.17 -	FILTER(strdf:mbbIntersects(?hGeo, ?mGeo)) .
    3.18 +		gag:hasGeometry ?mGeo .
    3.19 +	FILTER(strdf:intersects(?hGeo, ?mGeo)) .
    3.20    }  
    3.21    GROUP BY ?h
    3.22  }
     4.1 --- a/scripts/v2.3/landUseInvalidForFires.sparql	Mon Jul 30 22:13:58 2012 +0300
     4.2 +++ b/scripts/v2.3/landUseInvalidForFires.sparql	Mon Jul 30 23:09:39 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 WHERE 
    4.24 +	{
    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.3/refinePartialSeaHotspots.sparql	Mon Jul 30 22:13:58 2012 +0300
     5.2 +++ b/scripts/v2.3/refinePartialSeaHotspots.sparql	Mon Jul 30 23:09:39 2012 +0300
     5.3 @@ -2,7 +2,7 @@
     5.4  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
     5.5  PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 
     5.6  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     5.7 -PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     5.8 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
     5.9  
    5.10  
    5.11  INSERT { ?h noa:isDiscarded "1"^^xsd:int . 
    5.12 @@ -26,8 +26,8 @@
    5.13         noa:hasGeometry ?hGeo ;
    5.14         gag:hasMunicipality ?muni ;
    5.15         noa:hasConfidence ?conf .
    5.16 -?c     rdf:type noa:Coastline ;
    5.17 -       noa:hasGeometry ?cGeo .
    5.18 +?c     rdf:type gag:GeometryPart ;
    5.19 +       gag:hasGeometry ?cGeo .
    5.20  	   FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . 
    5.21    }
    5.22    GROUP BY ?h ?hGeo ?conf ?muni
     6.1 --- a/scripts/v2.3/refineTimePersistence.sparql	Mon Jul 30 22:13:58 2012 +0300
     6.2 +++ b/scripts/v2.3/refineTimePersistence.sparql	Mon Jul 30 23:09:39 2012 +0300
     6.3 @@ -2,46 +2,44 @@
     6.4  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
     6.5  PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 
     6.6  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
     6.7 -PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#>
     6.8 -
     6.9 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
    6.10  
    6.11  INSERT {
    6.12 - ?newHotspot rdf:type noa:Hotspot ;
    6.13 -		noa:hasConfidence ?hConfidence ;
    6.14 -	        noa:hasGeometry ?hGeometry1 ;
    6.15 -		noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 
    6.16 -	        noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.17 -		noa:hasConfirmation noa:unknown ;
    6.18 -	        noa:producedFromProcessingChain "PROCESSING_CHAIN-TimePersistence"^^xsd:string ; 
    6.19 -		noa:isProducedBy noa:noa ;
    6.20 -		 gag:hasMunicipality ?muni ;
    6.21 -		noa:isDerivedFromSatellite "SAT"^^xsd:string .
    6.22 -
    6.23 +	?newHotspot rdf:type noa:Hotspot ;
    6.24 +				noa:hasConfidence ?hConfidence ;
    6.25 +				noa:hasGeometry ?hGeometry1 ;
    6.26 +				noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 
    6.27 +				noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.28 +				noa:hasConfirmation noa:unknown ;
    6.29 +				noa:producedFromProcessingChain "PROCESSING_CHAIN-TimePersistence"^^xsd:string ; 
    6.30 +				noa:isProducedBy noa:noa ;
    6.31 +				gag:hasMunicipality ?hMunicipality1 ;
    6.32 +				noa:isDerivedFromSatellite "SAT"^^xsd:string .
    6.33  }
    6.34  WHERE {
    6.35 -  SELECT (URI(CONCAT(STR(MAX(?H1)),"virtual/NEW_HOTSPOT")) AS ?newHotspot)
    6.36 -  (SUM(?hConfidence1)/ACQUISITIONS_IN_HALF_AN_HOUR AS ?hConfidence)
    6.37 -  ?hGeometry1 ?muni
    6.38 +	SELECT  (URI(CONCAT(STR(MAX(?h1)),"/virtual/NEW_HOTSPOT")) AS ?newHotspot)
    6.39 +			(SUM(?hConfidence1)/ACQUISITIONS_IN_HALF_AN_HOUR AS ?hConfidence)
    6.40 +			?hGeometry1 ?hMunicipality1
    6.41    WHERE {
    6.42 -    ?H1 noa:hasConfidence ?hConfidence1 .
    6.43 -    ?H1 noa:hasGeometry ?hGeometry1 .
    6.44 -    ?H1 gag:hasMunicipality ?muni .
    6.45 -    ?H1 noa:hasAcquisitionTime ?hAcquisitionTime1 .
    6.46 -    ?H1 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    6.47 -    ?H1 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string .
    6.48 -    OPTIONAL { ?H1 noa:isDiscarded ?z } .
    6.49 +    ?h1 noa:hasConfidence ?hConfidence1 ;
    6.50 +        noa:hasGeometry ?hGeometry1 ;
    6.51 +        gag:hasMunicipality ?hMunicipality1 ;
    6.52 +        noa:hasAcquisitionTime ?hAcquisitionTime1 ;
    6.53 +        noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.54 +        noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string .
    6.55 +    OPTIONAL { ?h1 noa:isDiscarded ?z } .
    6.56      FILTER (!BOUND(?z)) .
    6.57      FILTER( "MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hAcquisitionTime1 && ?hAcquisitionTime1 < "TIMESTAMP"^^xsd:dateTime ) .
    6.58      OPTIONAL {
    6.59 -      ?H2 noa:hasGeometry ?HGEO2 .
    6.60 -      ?H2 noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime .
    6.61 -      ?H2 noa:isDerivedFromSensor "SENSOR"^^xsd:string .
    6.62 -      ?H2 noa:producedFromProcessingChain ?hProcessingChain2 .
    6.63 +      ?h2 noa:hasGeometry ?hGeometry2 ;
    6.64 +          noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ;
    6.65 +          noa:isDerivedFromSensor "SENSOR"^^xsd:string ;
    6.66 +          noa:producedFromProcessingChain ?hProcessingChain2 .
    6.67        FILTER(("PROCESSING_CHAIN"^^xsd:string = ?hProcessingChain2)||("PROCESSING_CHAIN-TimePersistence"^^xsd:string = ?hProcessingChain2)).
    6.68 -      FILTER( strdf:mbbEquals(?hGeometry1, ?HGEO2) ) .
    6.69 +      FILTER( strdf:mbbEquals(?hGeometry1, ?hGeometry2) ) .
    6.70      }
    6.71 -    FILTER( !BOUND(?H2) ) .
    6.72 +    FILTER( !BOUND(?h2) ) .
    6.73    }
    6.74 -  GROUP BY ?hGeometry1 ?muni
    6.75 +  GROUP BY ?hGeometry1 ?hMunicipality1
    6.76    HAVING(SUM(?hConfidence1)>0.0)
    6.77  }
     7.1 --- a/scripts/v2.3/runNoaRefinementChain.sh	Mon Jul 30 22:13:58 2012 +0300
     7.2 +++ b/scripts/v2.3/runNoaRefinementChain.sh	Mon Jul 30 23:09:39 2012 +0300
     7.3 @@ -4,8 +4,8 @@
     7.4  ENDPOINT="http://localhost:8080/endpoint"
     7.5  DB="endpoint"
     7.6  
     7.7 -#HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots/MSG2"
     7.8 -HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots/MSG1"
     7.9 +HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots/MSG2"
    7.10 +#HOTSPOTS_URL="http://jose.di.uoa.gr/rdf/hotspots/MSG1"
    7.11  
    7.12  logFile="chain.log"
    7.13  
    7.14 @@ -86,7 +86,10 @@
    7.15  createdb  ${DB} 
    7.16  
    7.17  # load data
    7.18 -curl -s http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-Corine-dump-postgres-${POSTGRES_MAIN_VERSION}.tgz | tar xz -O | psql -d ${DB}
    7.19 +
    7.20 +
    7.21 +curl -s http://dev.strabon.di.uoa.gr/rdf/coastline-kallikrates_30000-excludedAreas-dump.tgz | tar xz -O | psql -d ${DB}
    7.22 +#curl -s http://dev.strabon.di.uoa.gr/rdf/Kallikratis-Coastline-Corine-dump-postgres-${POSTGRES_MAIN_VERSION}.tgz | tar xz -O | psql -d ${DB}
    7.23  psql ${DB} -c 'VACUUM ANALYZE' 
    7.24  
    7.25  echo "starting tomcat"
    7.26 @@ -107,7 +110,7 @@
    7.27  #sudo -u postgres psql -d endpoint -c 'VACUUM ANALYZE;';
    7.28  
    7.29  #for y in 2007 2008 2010 2011 ;do
    7.30 -for y in 2012; do
    7.31 +for y in 2007; do
    7.32  	# get hotpost URLS
    7.33  	for hot in $(curl -s ${HOTSPOTS_URL}/${y}/ | grep -o '>HMSG.*\.nt' | colrm 1 1); do
    7.34  		file="${HOTSPOTS_URL}/${y}/${hot}"