Strabon
changeset 522:9be794b81096
QueryBean: changes to conform to changeset 499:ef9c43dd2c78. This changeset is about the HTML visual interface only
line diff
1.1 --- a/endpoint/WebContent/query.jsp Sat Jul 28 13:26:36 2012 +0300 1.2 +++ b/endpoint/WebContent/query.jsp Sat Jul 28 15:18:25 2012 +0300 1.3 @@ -1,4 +1,5 @@ 1.4 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 1.5 +<jsp:directive.page import="eu.earthobservatory.org.StrabonEndpoint.Common"/> 1.6 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 1.7 <html> 1.8 <head> 1.9 @@ -23,17 +24,17 @@ 1.10 </script> 1.11 <script type="text/javascript"> 1.12 function initialize() { 1.13 - var brahames = new google.maps.LatLng(37.92253, 23.72275); 1.14 - var myOptions = { 1.15 - zoom: 11, 1.16 - center: brahames, 1.17 - mapTypeId: google.maps.MapTypeId.ROADMAP 1.18 - }; 1.19 + var brahames = new google.maps.LatLng(37.92253, 23.72275); 1.20 + var myOptions = { 1.21 + zoom: 11, 1.22 + center: brahames, 1.23 + mapTypeId: google.maps.MapTypeId.ROADMAP 1.24 + }; 1.25 1.26 - var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 1.27 + var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 1.28 1.29 - var ctaLayer = new google.maps.KmlLayer(''); 1.30 - ctaLayer.setMap(map); 1.31 + var ctaLayer = new google.maps.KmlLayer('<%=request.getAttribute("pathToKML") != null ? request.getAttribute("pathToKML"):""%>'); 1.32 + ctaLayer.setMap(map); 1.33 } 1.34 </script> 1.35 <title>TELEIOS: Strabon Endpoint</title> 1.36 @@ -44,19 +45,21 @@ 1.37 <%@ include file="teleios-header.html"%> 1.38 <!-- include TELEIOS header and description --> 1.39 1.40 -<form enctype="UTF-8" accept-charset="UTF-8" method="post" action="Query"> 1.41 +<FORM enctype="UTF-8" accept-charset="UTF-8" method="post" action="Query"> 1.42 +<INPUT type=hidden name="view" value="HTML"/> 1.43 + 1.44 <table border="0" width="100%"><tr> 1.45 <td width="90" valign="top" bgcolor="#dfe8f0"> 1.46 <table border="0" cellspacing="0" cellpadding="0" width="165" id="navigation"> 1.47 <tr><td id="twidth"> 1.48 -<a href="Query?SPARQLQuery=%23+Discovering+raw+data+and+products%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT+%3Ffilename%0AWHERE+%7B%3Ffile+rdf%3Atype+noa%3AShpFile+%3B%0A%09+++++++++noa%3AhasFilename+%3Ffilename+%3B%0A%09+++++++++noa%3AhasAcquisitionTime+%3FsensingTime+.%0A%09+FILTER%28+str%28%3FsensingTime%29+%3E%3D+%222007-08-26T12%3A00%3A00%22+%29+.%0A%09+FILTER%28+str%28%3FsensingTime%29+%3C%3D+%222007-08-26T12%3A30%3A00%22+%29+.%0A%09+%3Ffile+noa%3AisDerivedFromSensor+%3Fsensor+.%0A%09+FILTER%28+str%28%3Fsensor%29+%3D+%22MSG2%22+%29+.%0A%09+%3Ffile+noa%3AproducedFromProcessingChain+%3Fchain+.%0A%09+FILTER%28+str%28%3Fchain%29+%3D+%22StaticThresholds%22+%29+.+%0A%7D&format=HTML"title="Find all shapefiles derived from sensor MSG2 between [2007-08-26T12:00:00,2007-08-26T12:30:00], using dynamic thresholds."> · Query 1: Discover raw data and products</a><br/> 1.49 -<a href="Query?SPARQLQuery=%23+Get+all+hotspots+%0A%23+-+in+Pelloponesus+%0A%23+-+at+2007-08-24%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT+%3Fh+%3FhAcqTime+%3FhConfidence+%3FhConfirmation+%3FhProvider+%3FhSensor+%3FhSatellite+%28strdf%3Atransform%28%3FhGeo%2C+%3Chttp%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F4326%3E%29+as+%3Fgeo%29+%0AWHERE+%7B+%3Fh+%09rdf%3Atype+noa%3AHotspot%3B%0A%09%09%09noa%3AhasGeometry+%3FhGeo%3B%0A%09%09%09noa%3AhasAcquisitionTime+%3FhAcqTime%3B%0A%09%09%09noa%3AhasConfidence+%3FhConfidence%3B%0A%09%09%09noa%3AisProducedBy+%3FhProvider%3B%0A%09%09%09noa%3AhasConfirmation+%3FhConfirmation%3B%0A%09%09%09noa%3AisDerivedFromSensor+%3FhSensor%3B%0A%09%09%09noa%3AisDerivedFromSatellite+%3FhSatellite+%3B%0A%09%09%09noa%3AproducedFromProcessingChain+%3FhChain+.%0A%09FILTER%28str%28%3FhChain%29+%3D+%22StaticThresholds%22%29.%0A%09FILTER%28%3FhAcqTime+%3D+%222007-08-24T14%3A45%3A00%22%5E%5Exsd%3AdateTime%29+.%0A%09FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FhGeo%29%29+.+%0A%7D&format=KMZMAP"title="Find all hotspots in Pelloponesus derived from the dynamic thresholds processing chain at 2007-08-24T14:45:00. "> · Query 2: Discover Hotspots</a><br/> 1.50 -<a href="Update?SPARQLQuery=%23+Delete+hotspots+that+lie+in+sea%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0ADELETE+%7B%3Fh+%3Fproperty+%3Fobject%7D%0AWHERE+%7B+%3Fh+%09rdf%3Atype+noa%3AHotspot%3B%0A++++++++++++noa%3AhasAcquisitionTime+%3FhAcqTime%3B%0A++++++++++++noa%3AproducedFromProcessingChain+%3FhChain%3B%0A++++++++++++noa%3AhasGeometry+%3FhGeo%3B%0A++++++++++++%3Fproperty+%3Fobject.%0A++++++++FILTER%28str%28%3FhChain%29+%3D+%22StaticThresholds%22%29.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FhGeo%29%29.%0A++++++++FILTER%28%222007-08-24T14%3A45%3A00%22%5E%5Exsd%3AdateTime+%3D+%3FhAcqTime%29.%0A++++++++OPTIONAL+%7B%0A++++++++++++%3Fc+rdf%3Atype+noa%3ACoastline%3B%0A+++++++++++++++noa%3AhasGeometry+%3FcGeo.%0A++++++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FcGeo%29%29.%0A++++++++++++FILTER%28strdf%3AanyInteract%28%3FhGeo%2C+%3FcGeo%29%29+.+%0A++++++++%7D%0A++++++++FILTER%28%21bound%28%3Fc%29%29.+%0A%7D&format=HTML"title="Mark as invalid all hotspots produced by the static thresholds processing chain and are acquired at 2007-08-24T14:45:00 which are located in the sea"> · Update A: Invalidate hotspots in sea</a><br/> 1.51 -<a href="Update?SPARQLQuery=%23+Refine+the+geometry+of+hotspots+that+partially+lie+in+sea%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E+%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E+%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E+%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E+%0A%0A%0AINSERT+%7B+%3Fh+noa%3AisDiscarded+%221%22%5E%5Exsd%3Aint+.+%0A%09+%3Fvalid+rdf%3Atype+noa%3AHotspot+%3B%0A%09%09noa%3AhasConfidence+%3Fconf+%3B%0A%09++++++++noa%3AhasGeometry+%3Fdif+%3B%0A%09%09noa%3AhasAcquisitionTime+%22TIMESTAMP%22%5E%5Exsd%3AdateTime+%3B+%0A%09++++++++noa%3AisDerivedFromSensor+%22SENSOR%22%5E%5Exsd%3Astring+%3B%0A%09%09noa%3AhasConfirmation+noa%3Aunknown+%3B%0A%09++++++++noa%3AproducedFromProcessingChain+%22PROCESSING_CHAIN%22%5E%5Exsd%3Astring+%3B+%0A%09%09noa%3AisProducedBy+noa%3Anoa+%3B%0A%09%09noa%3AisDerivedFromSatellite+%3Fsat+.%0A%7D%0AWHERE+%7B+%0A++SELECT+DISTINCT+%3Fh+%3FhGeo+%28strdf%3Aintersection%28%3FhGeo%2C+strdf%3Aunion%28%3FcGeo%29%29+AS+%3Fdif%29+%28BNODE%28%29+AS+%3Fvalid%29+%3Fconf+%3Fsat%0A++WHERE+%7B+%0A++++%3Fh+rdf%3Atype+noa%3AHotspot+%3B+%0A+++++++noa%3AhasAcquisitionTime+%3FhAcqTime+%3B+%0A+++++++noa%3AproducedFromProcessingChain+%22PROCESSING_CHAIN%22%5E%5Exsd%3Astring+%3B+%0A+++++++noa%3AisDerivedFromSensor+%22SENSOR%22%5E%5Exsd%3Astring+%3B%0A+++++++noa%3AhasGeometry+%3FhGeo+%3B%0A+++++++noa%3AhasConfidence+%3Fconf+%3B%0A+++++++noa%3AisDerivedFromSatellite+%3Fsat+.%0A++++FILTER%28%22TIMESTAMP%22%5E%5Exsd%3AdateTime+%3D+%3FhAcqTime%29+.%0A++++%3Fc+rdf%3Atype+noa%3ACoastline+%3B%0A+++++++noa%3AhasGeometry+%3FcGeo+.%0A++++FILTER%28strdf%3AanyInteract%28%3FhGeo%2C+%3FcGeo%29%29+.+%0A++%7D%0A++GROUP+BY+%3Fh+%3FhGeo+%3Fconf+%3Fsat%0A++HAVING+strdf%3Aoverlap%28%3FhGeo%2C+strdf%3Aunion%28%3FcGeo%29%29%0A%7D%0A&format=HTML"title="Refine hotspots acquired at 2007-08-24T14:45:00 removing the part that lies in the sea. "> · Update B: Refine hotspots in sea</a><br/> 1.52 -<a href="Query?SPARQLQuery=%23Get+all+coniferous+forests+in+Peloponnese%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT+%3Fa+%3FaGeo%0AWHERE%7B+%3Fa+rdf%3Atype+clc%3AArea%3B%0A++++++++++clc%3AhasLandUse+%3FaLandUse%3B%0A++++++++++noa%3AhasGeometry+%3FaGeo.%0A+++++++%3FaLandUse+rdf%3Atype+%3FaLandUseType.%0A+++++++FILTER%28%3FaLandUseType+%3D+clc%3AConiferousForest%29.%0A+++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5Estrdf%3AWKT%2C%3FaGeo%29%29.+%0A%7D&format=KMZMAP"title="Discover all coniferous forests using the clc ontology "> · Query 3: Discover coniferous forests</a><br/> 1.53 -<a href="Query?SPARQLQuery=%23+Get+all+municipalities+of+Pelloponnese%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Flontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT++%3Fd+%3FdGeo%0AWHERE+%7B+%3Fd+rdf%3Atype+gag%3ADhmos%3B+%0A+++++++++++strdf%3AhasGeometry+%3FdGeo%3B+%0A+++++++++++rdfs%3Alabel+%3FdLabel.+%0A+++++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FdGeo%29%29.+%0A%7D&format=KMZMAP"title="Find all municipalities of Pelloponnese using kallikratis ontology "> · Query 4: Discover primary roads</a><br/> 1.54 -<a href="Query?SPARQLQuery=%23+Get+all+primary+roads+in+Pelloponnese%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT++%3Fr+%3FrGeo%0AWHERE+%7B+%3Fr+rdf%3Atype+%3FrType+%3B%0A+++++++++++noa%3AhasGeometry+%3FrGeo+.%0A++++++++FILTER%28%3FrType+%3D+lgdo%3APrimary%29+.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C21.027+38.36%29%29%22%5E%5Estrdf%3AWKT%2C+%3FrGeo%29+%29.+%0A%7D&format=KMZMAP"title="Get all primary roads in Pelloponnese using the linked geodata ontology "> · Query 5: Get all primary roads in Pelloponnese</a><br/> 1.55 -<a href="Query?SPARQLQuery=%23+Get+all+hotspots+%0A%23+-+in+Pelloponesus+%0A%23+-+at+2007-08-24%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT++%3Fh+%3FhAcqTime+%28strdf%3Atransform%28%3FhGeo%2C+%3Chttp%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F4326%3E%29+as+%3Fgeo%29+%0AWHERE+%7B+%3Fh+%09rdf%3Atype+noa%3AHotspot%3B%0A++++++++++++noa%3AhasGeometry+%3FhGeo%3B%0A++++++++++++noa%3AhasAcquisitionTime+%3FhAcqTime%3B%0A++++++++++++noa%3AproducedFromProcessingChain+%3FhChain+.%0A++++++++FILTER%28str%28%3FhChain%29+%3D+%22StaticThresholds%22%29.%0A++++++++FILTER%28%3FhAcqTime+%3D+%222007-08-24T14%3A45%3A00%22%5E%5Exsd%3AdateTime%29+.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FhGeo%29%29+.+%0A++++++++%3Fa+rdf%3Atype+clc%3AArea%3B%0A+++++++++++clc%3AhasLandUse+%3FaLandUse%3B%0A+++++++++++noa%3AhasGeometry+%3FaGeo.%0A++++++++%3FaLandUse+rdf%3Atype+%3FaLandUseType.%0A++++++++FILTER%28%3FaLandUseType+%3D+clc%3AForest%29.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5Estrdf%3AWKT%2C%3FaGeo%29%29.+%0A++++++++FILTER%28strdf%3Aoverlap%28%3FaGeo%2C+%3FhGeo%29%29+.+%0A%7D&format=KMZMAP"title="Find all hotspots located in Pelloponnesian forests and acquired at 2007-08-24T14:45:00 using static thresholds processing chain "> · Query 6: Discover hotspots</a><br/> 1.56 +<a href="Query?view=HTML&handle=map&query=%23+Discovering+raw+data+and+products%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT+%3Ffilename%0AWHERE+%7B%3Ffile+rdf%3Atype+noa%3AShpFile+%3B%0A%09+++++++++noa%3AhasFilename+%3Ffilename+%3B%0A%09+++++++++noa%3AhasAcquisitionTime+%3FsensingTime+.%0A%09+FILTER%28+str%28%3FsensingTime%29+%3E%3D+%222007-08-26T12%3A00%3A00%22+%29+.%0A%09+FILTER%28+str%28%3FsensingTime%29+%3C%3D+%222007-08-26T12%3A30%3A00%22+%29+.%0A%09+%3Ffile+noa%3AisDerivedFromSensor+%3Fsensor+.%0A%09+FILTER%28+str%28%3Fsensor%29+%3D+%22MSG2%22+%29+.%0A%09+%3Ffile+noa%3AproducedFromProcessingChain+%3Fchain+.%0A%09+FILTER%28+str%28%3Fchain%29+%3D+%22StaticThresholds%22+%29+.+%0A%7D&format=KML"title="Find all shapefiles derived from sensor MSG2 between [2007-08-26T12:00:00,2007-08-26T12:30:00], using dynamic thresholds."> · Query 1: Discover raw data and products</a><br/> 1.57 +<a href="Query?view=HTML&handle=map&query=%23+Get+all+hotspots+%0A%23+-+in+Pelloponesus+%0A%23+-+at+2007-08-24%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT+%3Fh+%3FhAcqTime+%3FhConfidence+%3FhConfirmation+%3FhProvider+%3FhSensor+%3FhSatellite+%28strdf%3Atransform%28%3FhGeo%2C+%3Chttp%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F4326%3E%29+as+%3Fgeo%29+%0AWHERE+%7B+%3Fh+%09rdf%3Atype+noa%3AHotspot%3B%0A%09%09%09noa%3AhasGeometry+%3FhGeo%3B%0A%09%09%09noa%3AhasAcquisitionTime+%3FhAcqTime%3B%0A%09%09%09noa%3AhasConfidence+%3FhConfidence%3B%0A%09%09%09noa%3AisProducedBy+%3FhProvider%3B%0A%09%09%09noa%3AhasConfirmation+%3FhConfirmation%3B%0A%09%09%09noa%3AisDerivedFromSensor+%3FhSensor%3B%0A%09%09%09noa%3AisDerivedFromSatellite+%3FhSatellite+%3B%0A%09%09%09noa%3AproducedFromProcessingChain+%3FhChain+.%0A%09FILTER%28str%28%3FhChain%29+%3D+%22StaticThresholds%22%29.%0A%09FILTER%28%3FhAcqTime+%3D+%222007-08-24T14%3A45%3A00%22%5E%5Exsd%3AdateTime%29+.%0A%09FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FhGeo%29%29+.+%0A%7D&format=KMZ"title="Find all hotspots in Pelloponesus derived from the dynamic thresholds processing chain at 2007-08-24T14:45:00. "> · Query 2: Discover Hotspots</a><br/> 1.58 +<a href="Update?view=HTML&query=%23+Delete+hotspots+that+lie+in+sea%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0ADELETE+%7B%3Fh+%3Fproperty+%3Fobject%7D%0AWHERE+%7B+%3Fh+%09rdf%3Atype+noa%3AHotspot%3B%0A++++++++++++noa%3AhasAcquisitionTime+%3FhAcqTime%3B%0A++++++++++++noa%3AproducedFromProcessingChain+%3FhChain%3B%0A++++++++++++noa%3AhasGeometry+%3FhGeo%3B%0A++++++++++++%3Fproperty+%3Fobject.%0A++++++++FILTER%28str%28%3FhChain%29+%3D+%22StaticThresholds%22%29.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FhGeo%29%29.%0A++++++++FILTER%28%222007-08-24T14%3A45%3A00%22%5E%5Exsd%3AdateTime+%3D+%3FhAcqTime%29.%0A++++++++OPTIONAL+%7B%0A++++++++++++%3Fc+rdf%3Atype+noa%3ACoastline%3B%0A+++++++++++++++noa%3AhasGeometry+%3FcGeo.%0A++++++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FcGeo%29%29.%0A++++++++++++FILTER%28strdf%3AanyInteract%28%3FhGeo%2C+%3FcGeo%29%29+.+%0A++++++++%7D%0A++++++++FILTER%28%21bound%28%3Fc%29%29.+%0A%7D&format=KML"title="Mark as invalid all hotspots produced by the static thresholds processing chain and are acquired at 2007-08-24T14:45:00 which are located in the sea"> · Update A: Invalidate hotspots in sea</a><br/> 1.59 +<a href="Update?view=HTML&query=%23+Refine+the+geometry+of+hotspots+that+partially+lie+in+sea%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E+%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E+%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E+%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E+%0A%0A%0AINSERT+%7B+%3Fh+noa%3AisDiscarded+%221%22%5E%5Exsd%3Aint+.+%0A%09+%3Fvalid+rdf%3Atype+noa%3AHotspot+%3B%0A%09%09noa%3AhasConfidence+%3Fconf+%3B%0A%09++++++++noa%3AhasGeometry+%3Fdif+%3B%0A%09%09noa%3AhasAcquisitionTime+%22TIMESTAMP%22%5E%5Exsd%3AdateTime+%3B+%0A%09++++++++noa%3AisDerivedFromSensor+%22SENSOR%22%5E%5Exsd%3Astring+%3B%0A%09%09noa%3AhasConfirmation+noa%3Aunknown+%3B%0A%09++++++++noa%3AproducedFromProcessingChain+%22PROCESSING_CHAIN%22%5E%5Exsd%3Astring+%3B+%0A%09%09noa%3AisProducedBy+noa%3Anoa+%3B%0A%09%09noa%3AisDerivedFromSatellite+%3Fsat+.%0A%7D%0AWHERE+%7B+%0A++SELECT+DISTINCT+%3Fh+%3FhGeo+%28strdf%3Aintersection%28%3FhGeo%2C+strdf%3Aunion%28%3FcGeo%29%29+AS+%3Fdif%29+%28BNODE%28%29+AS+%3Fvalid%29+%3Fconf+%3Fsat%0A++WHERE+%7B+%0A++++%3Fh+rdf%3Atype+noa%3AHotspot+%3B+%0A+++++++noa%3AhasAcquisitionTime+%3FhAcqTime+%3B+%0A+++++++noa%3AproducedFromProcessingChain+%22PROCESSING_CHAIN%22%5E%5Exsd%3Astring+%3B+%0A+++++++noa%3AisDerivedFromSensor+%22SENSOR%22%5E%5Exsd%3Astring+%3B%0A+++++++noa%3AhasGeometry+%3FhGeo+%3B%0A+++++++noa%3AhasConfidence+%3Fconf+%3B%0A+++++++noa%3AisDerivedFromSatellite+%3Fsat+.%0A++++FILTER%28%22TIMESTAMP%22%5E%5Exsd%3AdateTime+%3D+%3FhAcqTime%29+.%0A++++%3Fc+rdf%3Atype+noa%3ACoastline+%3B%0A+++++++noa%3AhasGeometry+%3FcGeo+.%0A++++FILTER%28strdf%3AanyInteract%28%3FhGeo%2C+%3FcGeo%29%29+.+%0A++%7D%0A++GROUP+BY+%3Fh+%3FhGeo+%3Fconf+%3Fsat%0A++HAVING+strdf%3Aoverlap%28%3FhGeo%2C+strdf%3Aunion%28%3FcGeo%29%29%0A%7D%0A&format=HTML"title="Refine hotspots acquired at 2007-08-24T14:45:00 removing the part that lies in the sea. "> · Update B: Refine hotspots in sea</a><br/> 1.60 +<a href="Query?view=HTML&handle=map&query=%23Get+all+coniferous+forests+in+Peloponnese%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT+%3Fa+%3FaGeo%0AWHERE%7B+%3Fa+rdf%3Atype+clc%3AArea%3B%0A++++++++++clc%3AhasLandUse+%3FaLandUse%3B%0A++++++++++noa%3AhasGeometry+%3FaGeo.%0A+++++++%3FaLandUse+rdf%3Atype+%3FaLandUseType.%0A+++++++FILTER%28%3FaLandUseType+%3D+clc%3AConiferousForest%29.%0A+++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5Estrdf%3AWKT%2C%3FaGeo%29%29.+%0A%7D&format=KMZ"title="Discover all coniferous forests using the clc ontology "> · Query 3: Discover coniferous forests</a><br/> 1.61 +<a href="Query?view=HTML&handle=map&query=%23+Get+all+municipalities+of+Pelloponnese%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Flontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT++%3Fd+%3FdGeo%0AWHERE+%7B+%3Fd+rdf%3Atype+gag%3ADhmos%3B+%0A+++++++++++strdf%3AhasGeometry+%3FdGeo%3B+%0A+++++++++++rdfs%3Alabel+%3FdLabel.+%0A+++++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FdGeo%29%29.+%0A%7D&format=KMZ"title="Find all municipalities of Pelloponnese using kallikratis ontology "> · Query 4: Discover primary roads</a><br/> 1.62 +<a href="Query?view=HTML&handle=map&query=%23+Get+all+primary+roads+in+Pelloponnese%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT++%3Fr+%3FrGeo%0AWHERE+%7B+%3Fr+rdf%3Atype+%3FrType+%3B%0A+++++++++++noa%3AhasGeometry+%3FrGeo+.%0A++++++++FILTER%28%3FrType+%3D+lgdo%3APrimary%29+.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C21.027+38.36%29%29%22%5E%5Estrdf%3AWKT%2C+%3FrGeo%29+%29.+%0A%7D&format=KMZ"title="Get all primary roads in Pelloponnese using the linked geodata ontology "> · Query 5: Get all primary roads in Pelloponnese</a><br/> 1.63 +<a href="Query?view=HTML&handle=map&query=%23+Get+all+hotspots+%0A%23+-+in+Pelloponesus+%0A%23+-+at+2007-08-24%0APREFIX+noa%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+clc%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FclcOntology.owl%23%3E%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+strdf%3A+%3Chttp%3A%2F%2Fstrdf.di.uoa.gr%2Fontology%23%3E%0APREFIX+teleios%3A+%3Chttp%3A%2F%2Fteleios.di.uoa.gr%2Fontologies%2FnoaOntology.owl%23%3E%0APREFIX+gag%3A+%3Chttp%3A%2F%2Fwww.semanticweb.org%2Fontologies%2F2011%2FgagKallikratis.rdf%23%3E%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2003%2F01%2Fgeo%2Fwgs84_pos%23%3E%0APREFIX+georss%3A+%3Chttp%3A%2F%2Fwww.georss.org%2Fgeorss%2F%3E%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0APREFIX+gn%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0A%0ASELECT++%3Fh+%3FhAcqTime+%28strdf%3Atransform%28%3FhGeo%2C+%3Chttp%3A%2F%2Fwww.opengis.net%2Fdef%2Fcrs%2FEPSG%2F0%2F4326%3E%29+as+%3Fgeo%29+%0AWHERE+%7B+%3Fh+%09rdf%3Atype+noa%3AHotspot%3B%0A++++++++++++noa%3AhasGeometry+%3FhGeo%3B%0A++++++++++++noa%3AhasAcquisitionTime+%3FhAcqTime%3B%0A++++++++++++noa%3AproducedFromProcessingChain+%3FhChain+.%0A++++++++FILTER%28str%28%3FhChain%29+%3D+%22StaticThresholds%22%29.%0A++++++++FILTER%28%3FhAcqTime+%3D+%222007-08-24T14%3A45%3A00%22%5E%5Exsd%3AdateTime%29+.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5E+strdf%3AWKT%2C+%3FhGeo%29%29+.+%0A++++++++%3Fa+rdf%3Atype+clc%3AArea%3B%0A+++++++++++clc%3AhasLandUse+%3FaLandUse%3B%0A+++++++++++noa%3AhasGeometry+%3FaGeo.%0A++++++++%3FaLandUse+rdf%3Atype+%3FaLandUseType.%0A++++++++FILTER%28%3FaLandUseType+%3D+clc%3AForest%29.%0A++++++++FILTER%28strdf%3Acontains%28%22POLYGON%28%2821.027+38.36%2C+23.77+38.36%2C+23.77+36.05%2C+21.027+36.05%2C+21.027+38.36%29%29%22%5E%5Estrdf%3AWKT%2C%3FaGeo%29%29.+%0A++++++++FILTER%28strdf%3Aoverlap%28%3FaGeo%2C+%3FhGeo%29%29+.+%0A%7D&format=KMZ"title="Find all hotspots located in Pelloponnesian forests and acquired at 2007-08-24T14:45:00 using static thresholds processing chain "> · Query 6: Discover hotspots</a><br/> 1.64 </td> 1.65 1.66 </tr> 1.67 @@ -68,23 +71,49 @@ 1.68 <table cellspacing="5"> 1.69 <tr> 1.70 <td id="output">stSPARQL Query:</td> 1.71 -<td id="output"><textarea name="SPARQLQuery" title="pose your query/update here" rows="15" cols="100"> 1.72 -</textarea></td> 1.73 +<td id="output"><textarea name="query" title="pose your query/update here" rows="15" cols="100"> 1.74 +<%=request.getParameter("query") != null ? request.getParameter("query"):""%></textarea></td> 1.75 </tr> 1.76 <tr> 1.77 -<td id="output"><center>Output Format:<br/><select name="format" title="select one of the following output format types"> 1.78 -<option value="KMLMAP">HTML with google maps (kml)</option> 1.79 -<option value="GEOJSON">GeoJSON</option> 1.80 -<option selected value="HTML">HTML</option> 1.81 -<option value="KMZMAP">HTML with google maps (kmz)</option> 1.82 -<option value="XML">XML</option> 1.83 -<option value="KML">KML plain text</option> 1.84 -<option value="KML file">KML file</option> 1.85 -</select></center></td> 1.86 + <td id="output"><center>Output Format:<br/> 1.87 + <select name="format" title="select one of the following output format types"> 1.88 + <% 1.89 + String selFormat = request.getParameter("format") != null ? request.getParameter("format"):""; 1.90 + for (String format : Common.registeredQueryResultsFormatNames) {%> 1.91 + <OPTION value="<%=format%>"<%=format.equals(selFormat) ? "selected":""%>><%=format%></OPTION> 1.92 + <%}%> 1.93 + </select></center> 1.94 + </td> 1.95 <td colspan=2><br/><center> 1.96 -<input type="submit" title="execute query" value="Query" name="submit" /><br/><input type="submit" title="execute update" value="Update" name="submit" style="width: 400px"/></center><br/></td> 1.97 +<input type="submit" title="execute query" value="Query" name="submit" /><br/> 1.98 +<input type="submit" title="execute update" value="Update" name="submit" style="width: 400px"/></center><br/></td> 1.99 </tr> 1.100 +<tr> 1.101 + <td id="output"><center>View Result:<br/> 1.102 + <SELECT name="handle" title="select how you would like to view the result"> 1.103 + <OPTION value="plain">Plain result</OPTION> 1.104 + <OPTION value="download">Download</OPTION> 1.105 + <OPTION value="map">On a map</OPTION> 1.106 + </SELECT></center> 1.107 + </td> 1.108 + <td colspan=2> </td> 1.109 +</tr> 1.110 +<% if (request.getAttribute("error") != null) {%> 1.111 + <!-- Error Message --> 1.112 + <TR> 1.113 + <TD id="output">Result: </TD><TD id="output"><%=request.getAttribute("error") %></TD> 1.114 + </TR> 1.115 + <!-- Error Message --> 1.116 +<%}%> 1.117 </table></td></tr></table><br/><br/> 1.118 </form> 1.119 +<% if (request.getAttribute("response") != null) {%> 1.120 + <!-- Response --> 1.121 + <PRE><%=request.getAttribute("response") %></PRE> 1.122 + <!-- Response --> 1.123 +<%}%> 1.124 +<% if (request.getAttribute("pathToKML") != null) { %> 1.125 + <div id="map_canvas"></div> 1.126 +<%}%> 1.127 </body> 1.128 </html>
2.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Sat Jul 28 13:26:36 2012 +0300 2.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Sat Jul 28 15:18:25 2012 +0300 2.3 @@ -6,6 +6,8 @@ 2.4 import java.util.ArrayList; 2.5 import java.util.List; 2.6 2.7 +import org.openrdf.query.resultio.TupleQueryResultFormat; 2.8 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 2.9 import org.openrdf.rio.RDFFormat; 2.10 2.11 /** 2.12 @@ -47,6 +49,27 @@ 2.13 } 2.14 } 2.15 2.16 + /** 2.17 + * Keeps the registered and available stSPARQL Query Results Formats. 2.18 + */ 2.19 + public static final List<stSPARQLQueryResultFormat> registeredQueryResultsFormats = new ArrayList<stSPARQLQueryResultFormat>(); 2.20 + 2.21 + /** 2.22 + * Keeps the name of the registered and available stSPARQL Query Results Formats. 2.23 + * (to be used in the drop-down menu in query.jsp) 2.24 + */ 2.25 + public static final List<String> registeredQueryResultsFormatNames = new ArrayList<String>(); 2.26 + 2.27 + // initialize registered and available stSPARQL query results formats 2.28 + static { 2.29 + for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) { 2.30 + if (format instanceof stSPARQLQueryResultFormat) { 2.31 + registeredQueryResultsFormats.add((stSPARQLQueryResultFormat) format); 2.32 + registeredQueryResultsFormatNames.add(format.getName()); 2.33 + } 2.34 + } 2.35 + } 2.36 + 2.37 /** 2.38 * Determines the RDF format to use. We check only for "accept" 2.39 * parameter (present in the header). 2.40 @@ -73,4 +96,31 @@ 2.41 2.42 return null; 2.43 } 2.44 + 2.45 + /** 2.46 + * Determines the stSPARQL query result format to use. We check only for "accept" 2.47 + * parameter (present in the header). 2.48 + * 2.49 + * The use of "format" parameter is now deprecated for using any 2.50 + * Bean as a service. It is only used through the HTML 2.51 + * visual interface, provided with Strabon Endpoint. 2.52 + * 2.53 + * @param request 2.54 + * @return 2.55 + */ 2.56 + public static stSPARQLQueryResultFormat getResultFormatFromAcceptHeader(String acceptHeader) { 2.57 + if (acceptHeader != null) { 2.58 + // check whether the "accept" parameter contains any 2.59 + // of the mime types of any stSPARQL query result format 2.60 + for (stSPARQLQueryResultFormat format : registeredQueryResultsFormats) { 2.61 + for (String mimeType : format.getMIMETypes()) { 2.62 + if (acceptHeader.contains(mimeType)) { 2.63 + return format; 2.64 + } 2.65 + } 2.66 + } 2.67 + } 2.68 + 2.69 + return null; 2.70 + } 2.71 }
3.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Sat Jul 28 13:26:36 2012 +0300 3.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Sat Jul 28 15:18:25 2012 +0300 3.3 @@ -1,45 +1,32 @@ 3.4 package eu.earthobservatory.org.StrabonEndpoint; 3.5 3.6 -import java.io.BufferedWriter; 3.7 +import java.io.ByteArrayOutputStream; 3.8 import java.io.File; 3.9 import java.io.FileOutputStream; 3.10 -import java.io.FileWriter; 3.11 import java.io.IOException; 3.12 -import java.io.PrintWriter; 3.13 -import java.io.UnsupportedEncodingException; 3.14 import java.math.BigInteger; 3.15 import java.net.URLDecoder; 3.16 -import java.net.URLEncoder; 3.17 import java.security.SecureRandom; 3.18 import java.util.Date; 3.19 -import java.util.HashMap; 3.20 import java.util.Iterator; 3.21 -import java.util.List; 3.22 -import java.util.Map; 3.23 -import java.util.zip.ZipEntry; 3.24 -import java.util.zip.ZipOutputStream; 3.25 3.26 +import javax.servlet.RequestDispatcher; 3.27 import javax.servlet.ServletConfig; 3.28 import javax.servlet.ServletContext; 3.29 import javax.servlet.ServletException; 3.30 +import javax.servlet.ServletOutputStream; 3.31 import javax.servlet.http.HttpServlet; 3.32 import javax.servlet.http.HttpServletRequest; 3.33 import javax.servlet.http.HttpServletResponse; 3.34 3.35 import org.apache.commons.io.FileUtils; 3.36 -import org.openrdf.query.MalformedQueryException; 3.37 -import org.openrdf.query.QueryEvaluationException; 3.38 -import org.openrdf.query.TupleQueryResultHandlerException; 3.39 -import org.openrdf.repository.RepositoryException; 3.40 +import org.apache.commons.lang.StringEscapeUtils; 3.41 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 3.42 import org.slf4j.Logger; 3.43 import org.slf4j.LoggerFactory; 3.44 import org.springframework.web.context.WebApplicationContext; 3.45 import org.springframework.web.context.support.WebApplicationContextUtils; 3.46 3.47 -import eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper.Entry; 3.48 -import eu.earthobservatory.org.StrabonEndpoint.ResponseMessages; 3.49 -import eu.earthobservatory.runtime.generaldb.Strabon; 3.50 - 3.51 3.52 public class QueryBean extends HttpServlet { 3.53 3.54 @@ -47,595 +34,223 @@ 3.55 3.56 private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.org.StrabonEndpoint.QueryBean.class); 3.57 3.58 - private ServletContext context; 3.59 + /** 3.60 + * Attributes carrying values to be rendered by the query.jsp file 3.61 + */ 3.62 + private static final String ERROR = "error"; 3.63 + private static final String RESPONSE = "response"; 3.64 + 3.65 + /** 3.66 + * Error returned by QueryBean 3.67 + */ 3.68 + private static final String PARAM_ERROR = "stSPARQL Query Results Format or SPARQL query are not set or are invalid."; 3.69 + 3.70 + /** 3.71 + * The context of the servlet 3.72 + */ 3.73 + private ServletContext context; 3.74 + 3.75 + /** 3.76 + * Wrapper over Strabon 3.77 + */ 3.78 private StrabonBeanWrapper strabonWrapper; 3.79 + 3.80 + /** 3.81 + * The name of the temporary directory to store KML/KMZ files 3.82 + * for presentation in Google Maps 3.83 + */ 3.84 + private String tempDirectory; 3.85 + 3.86 + /** 3.87 + * The absolute path of the temporary directory 3.88 + */ 3.89 + private String basePath; 3.90 + 3.91 + /** 3.92 + * The name of this web application 3.93 + */ 3.94 + private String appName; 3.95 3.96 - public void doGet(HttpServletRequest request, HttpServletResponse response) 3.97 - throws ServletException, IOException 3.98 - { 3.99 + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 3.100 doPost(request, response); 3.101 } 3.102 3.103 - public void doPost(HttpServletRequest request, HttpServletResponse response) 3.104 - throws ServletException, IOException 3.105 - { 3.106 - final class DataHive{ 3.107 - private String format; 3.108 - private String SPARQLQuery; 3.109 - private String errorMessage; 3.110 - 3.111 - DataHive(){ 3.112 - this.format = null; 3.113 - this.SPARQLQuery = null; 3.114 - this.errorMessage = null; 3.115 - } 3.116 - 3.117 - public String getSPARQLQuery() { 3.118 - return SPARQLQuery; 3.119 - } 3.120 - 3.121 - public void setSPARQLQuery(String sPARQLQuery) { 3.122 - SPARQLQuery = sPARQLQuery; 3.123 - } 3.124 - 3.125 - public String getFormat() { 3.126 - return format; 3.127 - } 3.128 - 3.129 - public void setFormat(String fFormat) { 3.130 - format = fFormat; 3.131 - } 3.132 - 3.133 - public String getErrorMessage() { 3.134 - return errorMessage; 3.135 - } 3.136 - 3.137 - public void setErrorMessage(String error) { 3.138 - this.errorMessage = error; 3.139 - } 3.140 - 3.141 - public String toString() { 3.142 - return "Format: " + (this.format != null ? this.format : " NULL") + 3.143 - ", SPARQLQuery: " + (this.SPARQLQuery != null ? this.SPARQLQuery : " NULL") + 3.144 - ", errormessage: " + (this.errorMessage != null ? this.errorMessage : " NULL") + "."; 3.145 - } 3.146 - } 3.147 - 3.148 - request.setCharacterEncoding("UTF-8"); 3.149 - 3.150 - DataHive hive = new DataHive(); 3.151 - 3.152 - String query = request.getParameter("SPARQLQuery"); 3.153 - String q = (query == null) ? null : URLDecoder.decode(request.getParameter("SPARQLQuery"), "UTF-8"); 3.154 - 3.155 - if (query == null) { 3.156 - query = request.getParameter("query"); 3.157 - q = (query == null) ? null : URLDecoder.decode(request.getParameter("query"), "UTF-8"); 3.158 - } 3.159 - 3.160 - hive.setSPARQLQuery(q); 3.161 - 3.162 - String reqFormat = (request.getParameter("format") == null) ? "" : request.getParameter("format"); 3.163 - String reqAccept = (request.getHeader("accept") == null) ? "" : request.getHeader("accept"); 3.164 - String reqFuncionality = (request.getParameter("submit") == null) ? "" : request.getParameter("submit"); 3.165 - 3.166 - // check whether Update submit button was fired 3.167 - if (reqFuncionality.equals("Update")) { // only for executions from web browsers 3.168 - response.setStatus(HttpServletResponse.SC_TEMPORARY_REDIRECT); 3.169 - response.sendRedirect("Update?SPARQLQuery=" + URLEncoder.encode(hive.getSPARQLQuery(), "UTF-8")); 3.170 - 3.171 - return; 3.172 - } 3.173 - 3.174 - if ((reqFormat == "") && (reqAccept == "")) { 3.175 - hive.setFormat(Strabon.FORMAT_HTML); 3.176 - response.setContentType("text/html; charset=UTF-8"); 3.177 - 3.178 - } else if (reqAccept.contains("application/vnd.google-earth.kml+xml")) { 3.179 - response.setContentType("application/vnd.google-earth.kml+xml"); 3.180 - hive.setFormat(Strabon.FORMAT_KML); 3.181 - 3.182 - } else if (reqAccept.contains("application/vnd.google-earth.kmz")) { 3.183 - response.setContentType("application/vnd.google-earth.kmz"); 3.184 - hive.setFormat(Strabon.FORMAT_KMZ); 3.185 - 3.186 - } else if (reqAccept.contains("application/sparql-results+xml")) { 3.187 - response.setContentType("application/sparql-results+xml; charset=UTF-8"); 3.188 - hive.setFormat(Strabon.FORMAT_XML); 3.189 - 3.190 - } else if (reqAccept.contains("text/xml")) { 3.191 - response.setContentType("text/xml; charset=UTF-8"); 3.192 - hive.setFormat(Strabon.FORMAT_XML); 3.193 - 3.194 - } else if (reqAccept.contains("application/json")) { 3.195 - response.setContentType("application/json; charset=UTF-8"); 3.196 - hive.setFormat(Strabon.FORMAT_GEOJSON); 3.197 - 3.198 - } else if (reqFormat.equalsIgnoreCase("KML file")) { 3.199 - response.setContentType("application/vnd.google-earth.kml+xml; charset=UTF-8"); 3.200 - response.setHeader("Content-Disposition","attachment;filename=doc.kml"); 3.201 - hive.setFormat(Strabon.FORMAT_KML); 3.202 - 3.203 - } else if (reqFormat.equalsIgnoreCase("KML")) { 3.204 - response.setContentType("text/plain; charset=UTF-8"); 3.205 - hive.setFormat(Strabon.FORMAT_KML); 3.206 - 3.207 - } else if (reqFormat.equalsIgnoreCase("KMZ file")) { 3.208 - response.setContentType("application/vnd.google-earth.kmz; charset=UTF-8"); 3.209 - response.setHeader("Content-Disposition","attachment;filename=doc.kmz"); 3.210 - hive.setFormat(Strabon.FORMAT_KMZ); 3.211 - 3.212 - } else if (reqFormat.equalsIgnoreCase("KMZ")) { 3.213 - response.setContentType("text/plain; charset=UTF-8"); 3.214 - hive.setFormat(Strabon.FORMAT_KMZ); 3.215 - 3.216 - } else if (reqFormat.equalsIgnoreCase("SPARQLRESULTS")) { 3.217 - response.setContentType("application/sparql-results+xml; charset=UTF-8"); 3.218 - hive.setFormat(Strabon.FORMAT_XML); 3.219 - 3.220 - } else if (reqFormat.equalsIgnoreCase(Strabon.FORMAT_XML)) { 3.221 - response.setContentType("text/xml; charset=UTF-8"); 3.222 - hive.setFormat(Strabon.FORMAT_XML); 3.223 - 3.224 - } else if (reqFormat.equalsIgnoreCase("KMLMAP")) { 3.225 - response.setContentType("text/html; charset=UTF-8"); 3.226 - hive.setFormat("KMLMAP"); 3.227 - 3.228 - } else if (reqFormat.equalsIgnoreCase("KMZMAP")) { 3.229 - response.setContentType("text/html; charset=UTF-8"); 3.230 - hive.setFormat("KMZMAP"); 3.231 - 3.232 - } else if (reqFormat.equalsIgnoreCase(Strabon.FORMAT_GEOJSON)) { 3.233 - response.setContentType("application/json; charset=UTF-8"); 3.234 - hive.setFormat(Strabon.FORMAT_GEOJSON); 3.235 - 3.236 - } else { 3.237 - response.setContentType("text/html; charset=UTF-8"); 3.238 - hive.setFormat(Strabon.FORMAT_HTML); 3.239 - } 3.240 - 3.241 - PrintWriter out = response.getWriter(); 3.242 - out.flush(); 3.243 - 3.244 - if ((hive.getFormat().equalsIgnoreCase(Strabon.FORMAT_KML)) || (hive.getFormat().equalsIgnoreCase(Strabon.FORMAT_KMZ))) { 3.245 - int status_code = HttpServletResponse.SC_OK; 3.246 - String answer = ""; 3.247 - 3.248 - try { 3.249 - // execute query 3.250 - answer = (String) strabonWrapper.query(hive.getSPARQLQuery(), hive.getFormat()); 3.251 - 3.252 - } catch (MalformedQueryException e) { 3.253 - status_code = HttpServletResponse.SC_BAD_REQUEST; 3.254 - answer = e.getMessage(); 3.255 - 3.256 - } catch (RepositoryException e) { 3.257 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.258 - answer = e.getMessage(); 3.259 - 3.260 - } catch (QueryEvaluationException e) { 3.261 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.262 - answer = e.getMessage(); 3.263 - 3.264 - } catch (TupleQueryResultHandlerException e) { 3.265 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.266 - answer = e.getMessage(); 3.267 - 3.268 - } catch (ClassNotFoundException e) { 3.269 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.270 - answer = e.getMessage(); 3.271 - } 3.272 - 3.273 - response.setStatus(status_code); 3.274 - if (status_code == HttpServletResponse.SC_OK) { 3.275 - out.append(answer.toString()); 3.276 - 3.277 - } else { 3.278 - response.getWriter().append(ResponseMessages.getXMLHeader()); 3.279 - response.getWriter().append(ResponseMessages.getXMLException(answer)); 3.280 - response.getWriter().append(ResponseMessages.getXMLFooter()); 3.281 - 3.282 - } 3.283 - 3.284 - } else if ((hive.getFormat().equalsIgnoreCase("KMLMAP")) || (hive.getFormat().equalsIgnoreCase("KMZMAP"))) { 3.285 - 3.286 - StringBuilder errorMessage = new StringBuilder (); 3.287 - String answer = evaluateQuery(strabonWrapper, Strabon.FORMAT_KML, reqFuncionality, hive.getSPARQLQuery(), errorMessage); 3.288 - hive.setErrorMessage(errorMessage.toString()); 3.289 - SecureRandom random = new SecureRandom(); 3.290 - String temp = new BigInteger(130, random).toString(32); 3.291 - String basePath = context.getRealPath("/") + "/../ROOT/tmp/"; 3.292 - String extension = (hive.format.equalsIgnoreCase("KMLMAP") ? Strabon.FORMAT_KML.toLowerCase() : Strabon.FORMAT_KMZ.toLowerCase()); 3.293 - 3.294 - try{ 3.295 - Date date = new Date(); 3.296 - 3.297 - FileUtils.forceMkdir(new File(basePath)); 3.298 - 3.299 - @SuppressWarnings("unchecked") 3.300 - Iterator<File> it = FileUtils.iterateFiles(new File(basePath), null, false); 3.301 - while(it.hasNext()){ 3.302 - File tbd = new File((it.next()).getAbsolutePath()); 3.303 - if (FileUtils.isFileOlder(new File(tbd.getAbsolutePath()), date.getTime())){ 3.304 - FileUtils.forceDelete(new File(tbd.getAbsolutePath())); 3.305 - } 3.306 - } 3.307 - 3.308 - File file = new File(basePath + temp + "." + extension); 3.309 - 3.310 - //if file doesnt exists, then create it 3.311 - if(!file.exists()){ 3.312 - file.createNewFile(); 3.313 - } 3.314 - 3.315 - FileWriter fw = new FileWriter(basePath + temp + "." + extension); 3.316 - BufferedWriter bw = new BufferedWriter(fw); 3.317 - if (hive.getFormat().equalsIgnoreCase("KMLMAP")) { 3.318 - bw.write(answer); 3.319 - } 3.320 - else { 3.321 - FileOutputStream fos = new FileOutputStream(file); 3.322 - ZipOutputStream kmzout = new ZipOutputStream(fos); 3.323 - ZipEntry entry = new ZipEntry("doc.kml"); 3.324 - 3.325 - //kmzout.setLevel(6); 3.326 - kmzout.putNextEntry(entry); 3.327 - kmzout.write(answer.getBytes()); 3.328 - kmzout.closeEntry(); 3.329 - kmzout.close(); 3.330 - } 3.331 - bw.close(); 3.332 - //FileUtils.forceDeleteOnExit(new File((String) context.getRealPath("/") + "/../ROOT/tmp/" + temp + ".kml")); 3.333 - 3.334 - } catch(IOException e) { 3.335 - logger.error("[StrabonEndpoint.QueryBean] Error during querying.", e); 3.336 - } 3.337 - 3.338 - //response.setDateHeader("Expires", 0); 3.339 - //response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); 3.340 - 3.341 - String pathToKML = ""; 3.342 - //response.setHeader("Location", request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + "."+extension); 3.343 - 3.344 - if (answer!="") 3.345 - pathToKML = request.getScheme() + "://" + request.getServerName() +":" + request.getServerPort() +"/tmp/" + temp + "."+extension; 3.346 - 3.347 - appendHTML1a(out,pathToKML); 3.348 - 3.349 - appendHTMLQ(out, strabonWrapper); 3.350 - 3.351 - appendHTML1b(out); 3.352 - 3.353 - if (hive.getSPARQLQuery() != null) 3.354 - out.write(hive.getSPARQLQuery()); 3.355 - 3.356 - appendHTML2(out, hive.getFormat()); 3.357 - 3.358 - out.append("</table></td></tr></table>"); 3.359 - 3.360 - appendHTML4(out); 3.361 - if (answer!="") 3.362 - out.append("<div id=\"map_canvas\"></div>"); 3.363 - appendHTML5(out); 3.364 - } else if ((hive.getFormat().equalsIgnoreCase("XML"))||(hive.getFormat().equalsIgnoreCase("GEOJSON"))) { 3.365 - int status_code = HttpServletResponse.SC_OK; 3.366 - String answer = ""; 3.367 - 3.368 - try { 3.369 - // execute query 3.370 - answer = (String) strabonWrapper.query(hive.getSPARQLQuery(), hive.getFormat()); 3.371 - 3.372 - } catch (MalformedQueryException e) { 3.373 - status_code = HttpServletResponse.SC_BAD_REQUEST; 3.374 - answer = e.getMessage(); 3.375 - 3.376 - } catch (RepositoryException e) { 3.377 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.378 - answer = e.getMessage(); 3.379 - 3.380 - } catch (QueryEvaluationException e) { 3.381 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.382 - answer = e.getMessage(); 3.383 - 3.384 - } catch (TupleQueryResultHandlerException e) { 3.385 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.386 - answer = e.getMessage(); 3.387 - 3.388 - } catch (ClassNotFoundException e) { 3.389 - status_code = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; 3.390 - answer = e.getMessage(); 3.391 - } 3.392 - 3.393 - // write response to client 3.394 - if(hive.getFormat().equalsIgnoreCase(Strabon.FORMAT_XML)) 3.395 - { 3.396 - response.setContentType("text/xml; charset=UTF-8"); 3.397 - } 3.398 - else //GeoJSON 3.399 - { 3.400 - response.setContentType("application/json; charset=UTF-8"); 3.401 - } 3.402 - response.setStatus(status_code); 3.403 - if (status_code == HttpServletResponse.SC_OK) { 3.404 - response.getWriter().append(answer); 3.405 - 3.406 - } else { 3.407 - response.getWriter().append(ResponseMessages.getXMLHeader()); 3.408 - response.getWriter().append(ResponseMessages.getXMLException(answer)); 3.409 - response.getWriter().append(ResponseMessages.getXMLFooter()); 3.410 - } 3.411 - 3.412 - } 3.413 - else { // HTML 3.414 - 3.415 - appendHTML1a(out, ""); 3.416 - 3.417 - appendHTMLQ(out, strabonWrapper); 3.418 - 3.419 - appendHTML1b(out); 3.420 - 3.421 - if (hive.getSPARQLQuery() != null) 3.422 - out.write(hive.getSPARQLQuery()); 3.423 - 3.424 - appendHTML2(out, hive.getFormat()); 3.425 - 3.426 - String answer = ""; 3.427 - if (hive.getSPARQLQuery() != null) { 3.428 - StringBuilder errorMessage = new StringBuilder (); 3.429 - answer = evaluateQuery(strabonWrapper, hive.getFormat(), reqFuncionality, hive.getSPARQLQuery(), errorMessage); 3.430 - hive.setErrorMessage(errorMessage.toString()); 3.431 - if (hive.getErrorMessage() != null) { 3.432 - appendHTML3(out, hive.getErrorMessage()); 3.433 - } 3.434 - } 3.435 - 3.436 - out.append("</table></td></tr></table>"); 3.437 - if (!answer.equals("")) { 3.438 - out.println("<style type=\"text/css\">"); 3.439 - out.println("table.result {border:1px solid #777777;}"); 3.440 - out.println("table.result tr {border:1px dashed grey;}"); 3.441 - out.println("table.result th {background-color:grey;color:black;}"); 3.442 - out.println("</style>"); 3.443 - out.println("<table class=\"result\">"); 3.444 - out.append(answer); 3.445 - out.append("</table>"); 3.446 - } 3.447 - appendHTML4(out); 3.448 - appendHTML5(out); 3.449 - } 3.450 - out.flush(); 3.451 - } 3.452 - 3.453 public void init(ServletConfig servletConfig) throws ServletException { 3.454 super.init(servletConfig); 3.455 3.456 - // get StrabonWrapper 3.457 + // get the context of the servlet 3.458 context = getServletContext(); 3.459 + 3.460 + // get the context of the application 3.461 WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context); 3.462 3.463 + // the the strabon wrapper 3.464 strabonWrapper = (StrabonBeanWrapper) applicationContext.getBean("strabonBean"); 3.465 + 3.466 + // get the name of this web application 3.467 + appName = context.getContextPath().replace("/", ""); 3.468 + 3.469 + // fix the temporary directory for this web application 3.470 + tempDirectory = appName + "-temp"; 3.471 + 3.472 + // get the absolute path of the temporary directory 3.473 + basePath = context.getRealPath("/") + "/../ROOT/" + tempDirectory + "/"; 3.474 } 3.475 3.476 - public String evaluateQuery(StrabonBeanWrapper strabonWrapper, String resultFormat, String reqFunctionality, String SPARQLQuery, StringBuilder errorMessage) { 3.477 - String answer = ""; 3.478 + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 3.479 + request.setCharacterEncoding("UTF-8"); 3.480 + 3.481 + if (Common.VIEW_TYPE.equals(request.getParameter(Common.VIEW))) { 3.482 + // HTML visual interface 3.483 + processVIEWRequest(request, response); 3.484 + 3.485 3.486 - try { 3.487 - if (SPARQLQuery == null) { 3.488 - answer = ""; 3.489 - } else { 3.490 - answer = (String) strabonWrapper.query(SPARQLQuery, resultFormat); 3.491 - } 3.492 - } catch (Exception e) { 3.493 - logger.error("[StrabonEndpoint.QueryBean] Error during querying.", e); 3.494 - errorMessage.append(e.getMessage()); 3.495 - } 3.496 - 3.497 - return answer; 3.498 + } else {// invoked as a service 3.499 + processRequest(request, response); 3.500 + } 3.501 } 3.502 3.503 - protected static void appendHTML1a(PrintWriter out, String pathToKML) { 3.504 - out.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"); 3.505 - out.println("<html>"); 3.506 - out.println("<head>"); 3.507 - out.println("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />"); 3.508 - out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"); 3.509 - out.println("<link href=\"http://code.google.com/apis/maps/documentation/javascript/examples/default.css\" rel=\"stylesheet\" type=\"text/css\" />"); 3.510 - out.println("<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" /> "); 3.511 - out.println("<script type=\"text/javascript\" src=\"http://maps.googleapis.com/maps/api/js?sensor=false\"></script>"); 3.512 - out.println("<script type=\"text/javascript\">" + 3.513 - "function toggleMe(a){" + 3.514 - "var e=document.getElementById(a);" + 3.515 - "if(!e)return true;" + 3.516 - "if(e.style.display==\"none\"){" + 3.517 - "e.style.display=\"block\"" + 3.518 - "}else{" + 3.519 - "e.style.display=\"none\"}" + 3.520 - "return true;}" + 3.521 - "</script>"); 3.522 - out.println("<script type=\"text/javascript\">"); 3.523 - out.println("function initialize() {"); 3.524 - out.println(" var brahames = new google.maps.LatLng(37.92253, 23.72275);"); 3.525 - out.println(" var myOptions = {"); 3.526 - out.println(" zoom: 11,"); 3.527 - out.println(" center: brahames,"); 3.528 - out.println(" mapTypeId: google.maps.MapTypeId.ROADMAP"); 3.529 - out.println(" }"); 3.530 - out.println(""); 3.531 - out.println(" var map = new google.maps.Map(document.getElementById(\"map_canvas\"), myOptions);"); 3.532 - out.println(""); 3.533 - out.println(" var ctaLayer = new google.maps.KmlLayer('" + pathToKML + "');"); 3.534 - out.println(" ctaLayer.setMap(map);"); 3.535 - out.println("}"); 3.536 - out.println("</script>"); 3.537 - out.println("<style type=\"text/css\"> "); 3.538 - out.println("<!--"); 3.539 - out.println(".style3 {font-size: 15px}"); 3.540 - out.println(".style4 {font-size: 12px}"); 3.541 - out.println(".style5 {font-size: 15px;font-weight: bold;}"); 3.542 - out.println(".style6 {color: #FF0000}"); 3.543 - out.println(".style7 {font-size: 14px}"); 3.544 - out.println(" .hidden { visibility: hidden }"); 3.545 - out.println("-->"); 3.546 - out.println("</style> "); 3.547 - out.println("<title>TELEIOS: Strabon Endpoint</title>"); 3.548 - out.println("</head>"); 3.549 - out.println("<body topmargin=\"0\" leftmargin=\"0\" link=\"#FFFFFF\" vlink=\"#FFFFFF\" alink=\"#FFFFFF\" onload=\"initialize()\">"); 3.550 - out.println(" <TABLE width=\"100%\" BORDER=0 CELLPADDING=0 CELLSPACING=0>"); 3.551 - out.println(" <TR>"); 3.552 - out.println(" "); 3.553 - out.println(" <TD height=\"16\" background=\"images/pixi_white.gif\"><img src=\"images/pixi_white.gif\" width=\"16\" height=\"16\"></TD>"); 3.554 - out.println(" </TR>"); 3.555 - out.println(" <TR>"); 3.556 - out.println(" <TD height=\"1\"></TD>"); 3.557 - out.println(" </TR> "); 3.558 - out.println(" <TR>"); 3.559 - out.println(" <TD height=\"60\" background=\"images/nav2_bg.gif\"> "); 3.560 - out.println(" <table width=\"100%\" border=\"0\">"); 3.561 - out.println(" <tr>"); 3.562 - out.println(" <td width=\"1\"><img src=\"images/nav2_bg.gif\" width=\"1\" height=\"60\"></td>"); 3.563 - out.println(" <td valign=\"top\" width=\"80px\"><img border=\"0\" src=\"images/teleios_logo.png\" /></td>"); 3.564 - out.println(" <td valign=\"top\" align=\"left\">"); 3.565 - out.println(" <span class=\"logo\">   stSPARQL Endpoint</span><br><span class=\"style4\"></span></td>"); 3.566 - out.println(" </tr>"); 3.567 - out.println(" </table> </TD>"); 3.568 - out.println(" </TR>"); 3.569 - //out.println(" <TR>"); 3.570 - //out.println(" </TD>"); 3.571 - //out.println(" </TR>"); 3.572 - out.println(" <TR>"); 3.573 - out.println(" <TD height=\"50\" id=\"intro\">"); 3.574 - out.println("On this page you can execute stSPARQL queries against the Strabon backend. " + 3.575 - "The dataset is based on the following ontologies: " + 3.576 - "<a href=\"http://harmonisa.uni-klu.ac.at/content/land-use-land-cover-ontologies\" > Corine Land Cover </a>, " + 3.577 - "<a > Greek Administrative Geography(Kallikratis), </a>" + 3.578 - "<a href=\"http://labs.mondeca.com/dataset/lov/details/vocabulary_lgdo.html\" > Linked Geodata </a> " + 3.579 - " and <a href=\"http://www.geonames.org/search.html?q=ontology&country=\" > geonames </a>." + 3.580 - "We also use the <a href=\"images/graph.png\">NOA ontology</a> we developed for the <a href=\"http://www.space.noa.gr/ \">NOA </a> use case of the European FP7 project " + 3.581 - "<a href=\"http://www.earthobservatory.eu/\" >TELEIOS </a>. ") ; 3.582 - out.println("<a onclick=\"return toggleMe('par')\" />(More) </a> <br>"); 3.583 - out.println(" <p id=\"par\"> In this context NOA has been developing a real-time fire hotspot detection service for effectively monitoring a " + 3.584 - "fire-front. The technique is based on the use of acquisitions originating from the SEVIRI (Spinning Enhanced Visible and " + 3.585 - "Infrared Imager) sensor, on top of MSG-1 (Meteosat Second Generation satellite, renamed to Meteosat-8) and MSG-2 (renamed to " + 3.586 - "Meteosat-9) satellite platforms. Since 2007, NOA operates an MSG/SEVIRI acquisition station, and has been systematically archiving" + 3.587 - " raw satellite images on a 5 and 15 minutes basis, the respective temporal resolutions of MSG-1 and MSG-2. The acquired data are then annotated " + 3.588 - "using the stRDF model and can be queried using the stSPARQL query language. </p> "); 3.589 - out.println("On the left sidebar, some example stSPARQL queries are provided. The NOA use case is described in more detail in the VLDB application paper " + 3.590 - "<a href=\"\"> here. </a> "); 3.591 - out.println(" </TD>"); 3.592 - out.println(" </TR>"); 3.593 - out.println("</TABLE>"); 3.594 - out.println("<form " + 3.595 - "enctype=\"UTF-8\" " + 3.596 - "accept-charset=\"UTF-8\" "+ 3.597 - //"accept-charset=\"UTF-8\" " + 3.598 - //"enctype=\"application/x-www-form-urlencoded;charset=UTF-8\" " + 3.599 - //"enctype=\"text/plain\" " + 3.600 - 3.601 - //"method=\"get\"" + 3.602 - "method=\"post\"" + 3.603 - ">"); 3.604 - 3.605 - out.println("<table border=\"0\" width=\"100%\"><tr> "); 3.606 - out.println("<td width=\"90\" valign=\"top\" bgcolor=\"#dfe8f0\"> "); 3.607 - out.println("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"165\" id=\"navigation\"> "); 3.608 - out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"Query\" class=\"navText\">Query</a></td></tr> "); 3.609 - out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"Describe?format=HTML\" class=\"navText\">Describe</a></td></tr> "); 3.610 + /** 3.611 + * Processes the request made by a client of the endpoint that uses it as a service. 3.612 + * 3.613 + * @param request 3.614 + * @param response 3.615 + * @throws IOException 3.616 + */ 3.617 + private void processRequest(HttpServletRequest request, HttpServletResponse response) { 3.618 + 3.619 } 3.620 3.621 - protected static void appendHTML1b(PrintWriter out) { 3.622 - out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"store.jsp\" class=\"navText\" title=\"Store triples\">Store</a></td></tr> "); 3.623 - out.println("<tr><td width=\"90\" class=\"style4\"><a href=\"javascript:history.go(0)\" class=\"navText\" title=\"Clear editor\">Clear</a></td></tr> "); 3.624 - out.println("</table>"); 3.625 - out.println("</td>"); 3.626 - out.println("<td width=\"*\" valign=\"top\" >"); 3.627 + /** 3.628 + * Processes the request made from the HTML visual interface of Strabon Endpoint. 3.629 + * 3.630 + * @param request 3.631 + * @param response 3.632 + * @throws ServletException 3.633 + * @throws IOException 3.634 + */ 3.635 + private void processVIEWRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 3.636 + RequestDispatcher dispatcher; 3.637 3.638 - out.println("<table cellspacing=\"5\">"); 3.639 - out.println("<tr>"); 3.640 - out.println("<td id=\"output\" \">stSPARQL Query:</td>"); 3.641 - out.println("<td id=\"output\" \"><textarea name=\"SPARQLQuery\" title=\"pose your query/update here\" rows=\"15\" cols=\"100\">"); 3.642 - } 3.643 + // check whether Update submit button was fired 3.644 + String reqFuncionality = (request.getParameter("submit") == null) ? "" : request.getParameter("submit"); 3.645 3.646 - protected static void appendHTML2(PrintWriter out, String format) { 3.647 - out.println("</textarea></td>"); 3.648 - // out.println("<td style=\"border: 1px dashed #bbbbbb;\"><input type=\"radio\" name=\"format\" value=\"KML\">KML<br/>"); 3.649 - // out.println("<input type=\"radio\" name=\"format\" value=\"HTML\">HTML</td>"); 3.650 - out.println("</tr>"); 3.651 - out.println("<tr>"); 3.652 + if (reqFuncionality.equals("Update")) { 3.653 + // get the dispatcher for forwarding the rendering of the response 3.654 + dispatcher = request.getRequestDispatcher("Describe/"); 3.655 + dispatcher.forward(request, response); 3.656 + 3.657 + } else { 3.658 + String query = URLDecoder.decode(request.getParameter("query"), "UTF-8"); 3.659 + String format = request.getParameter("format"); 3.660 + String handle = request.getParameter("handle"); 3.661 + 3.662 + // get stSPARQLQueryResultFormat from given format name 3.663 + stSPARQLQueryResultFormat queryResultFormat = stSPARQLQueryResultFormat.valueOf(format); 3.664 + 3.665 + if (query == null || format == null || queryResultFormat == null) { 3.666 + dispatcher = request.getRequestDispatcher("query.jsp"); 3.667 + request.setAttribute(ERROR, PARAM_ERROR); 3.668 + dispatcher.forward(request, response); 3.669 + 3.670 + } else { 3.671 + if ("download".equals(handle)) { // download as attachment 3.672 + ServletOutputStream out = response.getOutputStream(); 3.673 + 3.674 + response.setContentType(queryResultFormat.getDefaultMIMEType()); 3.675 + response.setHeader("Content-Disposition", 3.676 + "attachment; filename=results." + 3.677 + queryResultFormat.getDefaultFileExtension() + "; " + 3.678 + queryResultFormat.getCharset()); 3.679 + 3.680 + try { 3.681 + strabonWrapper.query(query, format, out); 3.682 + response.setStatus(HttpServletResponse.SC_OK); 3.683 + 3.684 + } catch (Exception e) { 3.685 + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); 3.686 + out.print(ResponseMessages.getXMLHeader()); 3.687 + out.print(ResponseMessages.getXMLException(e.getMessage())); 3.688 + out.print(ResponseMessages.getXMLFooter()); 3.689 + } 3.690 + 3.691 + out.flush(); 3.692 + 3.693 + } else if ("map".equals(handle) && 3.694 + (queryResultFormat == stSPARQLQueryResultFormat.KML || 3.695 + queryResultFormat == stSPARQLQueryResultFormat.KMZ) ) { 3.696 + // show map (only valid for KML/KMZ) 3.697 + 3.698 + // get dispatcher 3.699 + dispatcher = request.getRequestDispatcher("query.jsp"); 3.700 + 3.701 + SecureRandom random = new SecureRandom(); 3.702 + String temp = new BigInteger(130, random).toString(32); 3.703 + 3.704 + // the temporary KML/KMZ file to create in the server 3.705 + String tempKMLFile = temp + "." + queryResultFormat.getDefaultFileExtension();; 3.706 + 3.707 + try{ 3.708 + Date date = new Date(); 3.709 3.710 - out.println("<td id=\"output\";\"><center>Output Format:<br/><select name=\"format\" title=\"select one of the following output format types\">"); 3.711 - 3.712 - Map<String, String> selections = new HashMap<String, String>(); 3.713 - selections.put("KMZMAP", "HTML with google maps (kmz)"); 3.714 - selections.put("KMLMAP", "HTML with google maps (kml)"); 3.715 - selections.put("HTML", "HTML"); 3.716 - //selections.put("KMZ", "KZM file"); 3.717 - selections.put("KML file", "KML file"); 3.718 - selections.put("KML", "KML plain text"); 3.719 - selections.put("XML", "XML"); 3.720 - selections.put("GEOJSON", "GeoJSON"); 3.721 - 3.722 - Iterator <String> it = selections.keySet().iterator(); 3.723 - 3.724 - while (it.hasNext()) { 3.725 - String key = it.next(); 3.726 - String value = selections.get(key); 3.727 - out.print("<option "); 3.728 - if (key.equalsIgnoreCase(format)) 3.729 - out.print("selected"); 3.730 - 3.731 - out.println(" value=\"" + key + "\">" + value + "</option>"); 3.732 + FileUtils.forceMkdir(new File(basePath)); 3.733 + 3.734 + @SuppressWarnings("unchecked") 3.735 + Iterator<File> it = FileUtils.iterateFiles(new File(basePath), null, false); 3.736 + while(it.hasNext()){ 3.737 + File tbd = new File((it.next()).getAbsolutePath()); 3.738 + if (FileUtils.isFileOlder(new File(tbd.getAbsolutePath()), date.getTime())){ 3.739 + FileUtils.forceDelete(new File(tbd.getAbsolutePath())); 3.740 + } 3.741 + } 3.742 + 3.743 + // create temporary KML/KMZ file 3.744 + File file = new File(basePath + tempKMLFile); 3.745 + 3.746 + // if file does not exist, then create it 3.747 + if(!file.exists()){ 3.748 + file.createNewFile(); 3.749 + } 3.750 + 3.751 + try { 3.752 + // query and write the result in the temporary KML/KMZ file 3.753 + FileOutputStream fos = new FileOutputStream(basePath + tempKMLFile); 3.754 + strabonWrapper.query(query, format, fos); 3.755 + fos.close(); 3.756 + 3.757 + request.setAttribute("pathToKML", 3.758 + request.getScheme() + "://" + 3.759 + request.getServerName() + ":" + request.getServerPort() + 3.760 + "/" + tempDirectory + "/" + tempKMLFile); 3.761 + 3.762 + } catch (Exception e) { 3.763 + logger.error("[StrabonEndpoint.QueryBean] Error during querying.", e); 3.764 + request.setAttribute(ERROR, e.getMessage()); 3.765 + } 3.766 + 3.767 + dispatcher.forward(request, response); 3.768 + 3.769 + } catch(IOException e) { 3.770 + logger.error("[StrabonEndpoint.QueryBean] Error during querying.", e); 3.771 + } 3.772 + 3.773 + } else { // "plain" is assumed as the default 3.774 + dispatcher = request.getRequestDispatcher("query.jsp"); 3.775 + ByteArrayOutputStream bos = new ByteArrayOutputStream(); 3.776 + 3.777 + try { 3.778 + strabonWrapper.query(query, format, bos); 3.779 + request.setAttribute(RESPONSE, StringEscapeUtils.escapeHtml(bos.toString())); 3.780 + 3.781 + } catch (Exception e) { 3.782 + logger.error("[StrabonEndpoint.QueryBean] Error during querying.", e); 3.783 + request.setAttribute(ERROR, e.getMessage()); 3.784 + 3.785 + } finally { 3.786 + dispatcher.forward(request, response); 3.787 + } 3.788 + } 3.789 + } 3.790 } 3.791 - 3.792 - out.println("</select></center></td>"); 3.793 - //out.println("</tr>"); 3.794 - //out.println("<tr>"); 3.795 - out.println("<td colspan=2 \"><br/><center><input type=\"submit\" title=\"execute query\" value=\"Query\" name=\"submit\" /><br/><input type=\"submit\" title=\"execute update\" value=\"Update\" name=\"submit\" style=\"width: 400px\"/></center><br/></td>"); 3.796 - out.println("</tr>"); 3.797 - } 3.798 - 3.799 - protected static void appendHTML3(PrintWriter out, String errorMessage) { 3.800 - out.println("<tr>"); 3.801 - out.println("<td id=\"output\" \">Result: </td>"); 3.802 - out.println("<td id=\"output\" \">"); 3.803 - out.println(errorMessage); 3.804 - out.println("</td>"); 3.805 - out.println("</tr>"); 3.806 - } 3.807 - 3.808 - protected static void appendHTML4(PrintWriter out) { 3.809 - out.println("<br/><br/>"); 3.810 - out.println("</form>"); 3.811 - } 3.812 - 3.813 - protected static void appendHTML5(PrintWriter out) { 3.814 - out.println("</body>"); 3.815 - out.println("</html>"); 3.816 - } 3.817 - 3.818 - protected static void appendHTMLQ(PrintWriter out, StrabonBeanWrapper strabonWrapper) throws UnsupportedEncodingException { 3.819 - out.println("<tr><td id=\"twidth\">"); 3.820 - List<Entry> entries = strabonWrapper.getEntries(); 3.821 - Iterator<Entry> it = entries.iterator(); 3.822 - while (it.hasNext()) { 3.823 - Entry entry = it.next(); 3.824 - out.println(createLink(entry)); 3.825 - } 3.826 - out.println("</td></tr> "); 3.827 - } 3.828 - 3.829 - private static String createLink(Entry entry) throws UnsupportedEncodingException { 3.830 - StringBuffer buf = new StringBuffer(1024); 3.831 - buf.append("<a href=\""); 3.832 - buf.append(entry.getBean()); 3.833 - buf.append("?SPARQLQuery="); 3.834 - buf.append(URLEncoder.encode(entry.getStatement(), "UTF-8")); 3.835 - buf.append("&format="); 3.836 - buf.append(entry.getFormat()+"\""); 3.837 - buf.append("title="+"\""+entry.getTitle()); 3.838 - buf.append("\"> · "); 3.839 - buf.append(entry.getLabel()); 3.840 - buf.append("</a><br/>"); 3.841 - 3.842 - return buf.toString(); 3.843 } 3.844 }
4.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java Sat Jul 28 13:26:36 2012 +0300 4.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java Sat Jul 28 15:18:25 2012 +0300 4.3 @@ -1,6 +1,5 @@ 4.4 package eu.earthobservatory.org.StrabonEndpoint; 4.5 4.6 -import java.io.ByteArrayOutputStream; 4.7 import java.io.IOException; 4.8 import java.io.OutputStream; 4.9 import java.io.StringReader; 4.10 @@ -202,18 +201,15 @@ 4.11 } 4.12 } 4.13 4.14 - public String query(String queryString, String answerFormatStrabon) 4.15 + public void query(String queryString, String answerFormatStrabon, OutputStream out) 4.16 throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, ClassNotFoundException { 4.17 logger.info("[StrabonEndpoint] Received SELECT query."); 4.18 if ((this.strabon == null) && (!init())) { 4.19 throw new RepositoryException("Could not connect to Strabon."); 4.20 } 4.21 4.22 - ByteArrayOutputStream answer = new ByteArrayOutputStream(); 4.23 + strabon.query(queryString, Format.fromString(answerFormatStrabon), strabon.getSailRepoConnection(), out); 4.24 4.25 - strabon.query(queryString, Format.fromString(answerFormatStrabon), strabon.getSailRepoConnection(), answer); 4.26 - 4.27 - return answer.toString(); 4.28 } 4.29 4.30 /**
5.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/UpdateBean.java Sat Jul 28 13:26:36 2012 +0300 5.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/UpdateBean.java Sat Jul 28 15:18:25 2012 +0300 5.3 @@ -46,15 +46,16 @@ 5.4 } 5.5 5.6 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 5.7 - String query = request.getParameter("SPARQLQuery"); 5.8 + String query = request.getParameter("query"); 5.9 5.10 String answer = ""; 5.11 try { 5.12 + logger.info("[StrabonEndpoint.UpdateBean] Received UPDATE query."); 5.13 + 5.14 if (query == null) { 5.15 throw new MalformedQueryException("No SPARQL Update query specified."); 5.16 } 5.17 5.18 - logger.info("[StrabonEndpoint.UpdateBean] Received UPDATE query."); 5.19 strabonWrapper.getStrabon().update(query, strabonWrapper.getStrabon().getSailRepoConnection()); 5.20 response.setStatus(HttpServletResponse.SC_OK); 5.21 answer = "true";
6.1 --- a/resultio/src/main/java/org/openrdf/query/resultio/Format.java Sat Jul 28 13:26:36 2012 +0300 6.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/Format.java Sat Jul 28 15:18:25 2012 +0300 6.3 @@ -48,6 +48,11 @@ 6.4 HTML("HTML"), 6.5 6.6 /** 6.7 + * TSV (tab-separated values) format 6.8 + */ 6.9 + TSV("TSV"), 6.10 + 6.11 + /** 6.12 * Invalid format. 6.13 */ 6.14 INVALID("INVALID");
7.1 --- a/resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Sat Jul 28 13:26:36 2012 +0300 7.2 +++ b/resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Sat Jul 28 15:18:25 2012 +0300 7.3 @@ -7,7 +7,6 @@ 7.4 7.5 import javax.xml.bind.JAXBException; 7.6 import javax.xml.namespace.QName; 7.7 -import javax.xml.parsers.ParserConfigurationException; 7.8 7.9 import org.geotools.kml.KML; 7.10 import org.geotools.kml.KMLConfiguration; 7.11 @@ -29,7 +28,6 @@ 7.12 import org.openrdf.sail.generaldb.model.XMLGSDatatypeUtil; 7.13 import org.slf4j.Logger; 7.14 import org.slf4j.LoggerFactory; 7.15 -import org.xml.sax.SAXException; 7.16 7.17 import com.vividsolutions.jts.geom.Geometry; 7.18 import com.vividsolutions.jts.geom.GeometryCollection;