Strabon
changeset 1387:a110fd2b1880
properly construct stRDF WKT literals (CRS URI should not be placed into <> characters); greek characters in the endpoint-client where not encoded appropriately when run from the console (Unit Testin); endpoint-client was encoding the query based on the return value of "Charset.defaultCharset()". We change excplicitly to UTF-8
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Wed Sep 17 16:19:46 2014 +0300 (2014-09-17) |
parents | 800df0b6eca9 |
children | 3368376972f5 |
files | endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithStrabon.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java |
line diff
1.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java Wed Sep 17 15:05:15 2014 +0300 1.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java Wed Sep 17 16:19:46 2014 +0300 1.3 @@ -18,15 +18,11 @@ 1.4 import java.util.ArrayList; 1.5 import java.util.List; 1.6 1.7 -import org.apache.commons.httpclient.params.HostParams; 1.8 -import org.apache.commons.httpclient.params.HttpMethodParams; 1.9 -import org.apache.commons.httpclient.params.HttpParams; 1.10 import org.apache.http.HttpEntity; 1.11 import org.apache.http.HttpResponse; 1.12 import org.apache.http.NameValuePair; 1.13 import org.apache.http.client.entity.UrlEncodedFormEntity; 1.14 import org.apache.http.client.methods.HttpPost; 1.15 -import org.apache.http.entity.StringEntity; 1.16 import org.apache.http.message.BasicNameValuePair; 1.17 import org.apache.xerces.impl.dv.util.Base64; 1.18 import org.openrdf.query.resultio.TupleQueryResultFormat; 1.19 @@ -70,7 +66,7 @@ 1.20 // set the query parameter 1.21 List<NameValuePair> params = new ArrayList<NameValuePair>(); 1.22 params.add(new BasicNameValuePair("query", sparqlQuery)); 1.23 - UrlEncodedFormEntity encodedEntity = new UrlEncodedFormEntity(params, Charset.defaultCharset()); 1.24 + UrlEncodedFormEntity encodedEntity = new UrlEncodedFormEntity(params, Charset.forName("UTF-8")); 1.25 method.setEntity(encodedEntity); 1.26 1.27 // set the content type
2.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithStrabon.java Wed Sep 17 15:05:15 2014 +0300 2.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithStrabon.java Wed Sep 17 16:19:46 2014 +0300 2.3 @@ -39,12 +39,9 @@ 2.4 "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + 2.5 "PREFIX gag: <http://geo.linkedopendata.gr/gag/ontology/> " + 2.6 2.7 - "SELECT ?geometry " + 2.8 + "SELECT ?g " + 2.9 "WHERE {" + 2.10 - 2.11 - " ?m rdf:type gag:Δήμος . " + 2.12 - " ?m rdfs:label \"ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ\" . " + 2.13 - " ?m gag:έχει_γεωμετρία ?geometry. " + 2.14 + " <http://geo.linkedopendata.gr/gag/id/9186> rdf:έχει_γεωμετρία ?g . " + 2.15 " } " ; 2.16 2.17 // initialized formats
3.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Wed Sep 17 15:05:15 2014 +0300 3.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Wed Sep 17 16:19:46 2014 +0300 3.3 @@ -26,11 +26,13 @@ 3.4 private static Logger logger = LoggerFactory.getLogger(org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper.class); 3.5 3.6 public static String STRDF_SRID_DELIM = ";"; 3.7 - private static String CUT_DELIM = "/"; 3.8 - private static String URI_ENDING = ">"; 3.9 + private static String CUT_DELIM = "/"; 3.10 + private static String URI_ENDING = ">"; 3.11 3.12 /** 3.13 * Returns the given WKT without the SRID (if any). 3.14 + * 3.15 + * FIXME I think that this works only for stRDF. If this is its purpose, rename it to reflect it. 3.16 * 3.17 * @param wkt 3.18 * @return 3.19 @@ -51,6 +53,8 @@ 3.20 * Returns the SRID of the given WKT (if any). If the WKT 3.21 * does not contain any, then the default is returned. 3.22 * 3.23 + * FIXME I think that this works only for stRDF. If this is its purpose, rename it to reflect it. 3.24 + * 3.25 * @param wkt 3.26 * @return 3.27 */ 3.28 @@ -130,7 +134,7 @@ 3.29 return plainWKT; 3.30 3.31 } else { 3.32 - return getURI_forSRID(srid) + " " + plainWKT; 3.33 + return "<" + getURI_forSRID(srid) + "> " + plainWKT; 3.34 } 3.35 } 3.36 3.37 @@ -152,10 +156,6 @@ 3.38 uri = GeoConstants.EPSG_URI_PREFIX + srid; 3.39 } 3.40 3.41 - if (uri.length() > 0) { 3.42 - uri = "<" + uri + ">"; 3.43 - } 3.44 - 3.45 return uri; 3.46 } 3.47 }