Strabon

changeset 1194:9fbbd9a8d724

merge
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Mon Jul 08 16:49:39 2013 +0300 (2013-07-08)
parents 363ef97fb003 98aae21ffe72
children a8ef6491cd0e
files endpoint/WebContent/WEB-INF/connection.properties endpoint/WebContent/query.jsp endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java resultio-spatial/api/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java
line diff
     1.1 --- a/endpoint/WebContent/WEB-INF/connection.properties	Mon Jul 08 16:45:22 2013 +0300
     1.2 +++ b/endpoint/WebContent/WEB-INF/connection.properties	Mon Jul 08 16:49:39 2013 +0300
     1.3 @@ -1,4 +1,4 @@
     1.4 -hostname=localhost
     1.5 +hostname=manolee.di.uoa.gr
     1.6  port=5432
     1.7  dbengine=postgis
     1.8  password=postgres
     2.1 --- a/endpoint/WebContent/query.jsp	Mon Jul 08 16:45:22 2013 +0300
     2.2 +++ b/endpoint/WebContent/query.jsp	Mon Jul 08 16:49:39 2013 +0300
     2.3 @@ -8,6 +8,7 @@
     2.4  <%@page import="java.util.ArrayList"%>
     2.5  <%@page import="java.util.Iterator"%>
     2.6  <%@page import="org.openrdf.query.TupleQueryResult"%>
     2.7 +<%@page import="org.openrdf.query.BindingSet"%>
     2.8  <jsp:directive.page import="eu.earthobservatory.org.StrabonEndpoint.Common"/>
     2.9  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    2.10  <html>
    2.11 @@ -71,6 +72,7 @@
    2.12  	//String arr = new String[2];
    2.13  	List<String[]> results = new ArrayList<String[]>();
    2.14  	String[] arr = new String[2];
    2.15 +	
    2.16  	ServletContext context;
    2.17  	context = getServletContext();
    2.18  	WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context);
    2.19 @@ -213,7 +215,8 @@
    2.20  
    2.21        // Set a callback to run when the Google Visualization API is loaded.
    2.22  
    2.23 -
    2.24 +   		google.setOnLoadCallback(drawChart);
    2.25 +   		
    2.26        // Callback that creates and populates a data table,
    2.27        // instantiates the pie chart, passes in the data and
    2.28        // draws it.
    2.29 @@ -221,6 +224,13 @@
    2.30       
    2.31          	
    2.32        function drawChart() {
    2.33 +      
    2.34 +         <% if (request.getAttribute("response") != null) {
    2.35 +        	if (request.getParameter("format").equals("CHART")) {
    2.36 +        		 StrabonBeanWrapper sw = (StrabonBeanWrapper) request.getAttribute("response");
    2.37 +        		 result = sw.getResult();
    2.38 +        		 label1 = result.getBindingNames().get(0).toString();
    2.39 +        		 label2 = result.getBindingNames().get(1).toString();%>
    2.40   		
    2.41          // Create the data table.
    2.42          var data = new google.visualization.DataTable();
     3.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java	Mon Jul 08 16:45:22 2013 +0300
     3.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java	Mon Jul 08 16:49:39 2013 +0300
     3.3 @@ -16,6 +16,8 @@
     3.4  import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
     3.5  import org.openrdf.rio.RDFFormat;
     3.6  
     3.7 +import eu.earthobservatory.utils.Format;
     3.8 +
     3.9  /**
    3.10   * Keeps common variables shared by beans and .jsp pages.
    3.11   *
    3.12 @@ -86,6 +88,7 @@
    3.13  				registeredQueryResultsFormatNames.add(format.getName());
    3.14  			//}
    3.15  		}
    3.16 +		
    3.17  	}
    3.18  	
    3.19  	/**
     4.1 --- a/resultio-spatial/api/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java	Mon Jul 08 16:45:22 2013 +0300
     4.2 +++ b/resultio-spatial/api/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java	Mon Jul 08 16:49:39 2013 +0300
     4.3 @@ -72,6 +72,9 @@
     4.4  	public static final stSPARQLQueryResultFormat HTML = new stSPARQLQueryResultFormat("HTML", 
     4.5  			Arrays.asList("text/html"), Charset.forName("UTF-8"), Arrays.asList("html", "htm"));
     4.6  	
     4.7 +	public static final stSPARQLQueryResultFormat CHART = new stSPARQLQueryResultFormat("CHART", 
     4.8 +			Arrays.asList("text/plain"), Charset.forName("UTF-8"), Arrays.asList("chart", "chart"));
     4.9 +	
    4.10  	/**
    4.11  	 * CHART format (so that results can be displayed using google charts)  
    4.12  	 */
    4.13 @@ -92,6 +95,7 @@
    4.14  		register(TSV);
    4.15  		register(HTML);
    4.16  		register(CHART);
    4.17 +
    4.18  	}
    4.19  	
    4.20  	/**