Strabon
changeset 1422:f86d1129ce79
it turns out that there is no simple way of having the datatype of a constant geometry available in the query builder, thus it is not easy for geof:getSRID to determine the correct datatype and return the appropriate URI for the CRS, when that has SRID 4326. Therefore, we choose to always return CRS84, even for strdf:WKT arguments. Notice, that when geof:getSRID is called evaluated in Java, we have such information available and we can return the correct result. However, we chose in changeset 1420:37792dd7041b to always push the evaluation of all spatial functions in the database. The respective tests have been updated as well.
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Tue Sep 23 14:05:26 2014 +0300 (2014-09-23) |
parents | b1ad88fdf4a6 |
children | e46723dfc769 |
files | generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryWithConstantTest.srx |
line diff
1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Tue Sep 23 13:16:47 2014 +0300 1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Tue Sep 23 14:05:26 2014 +0300 1.3 @@ -293,7 +293,7 @@ 1.4 ResultSetMetaData meta = rs.getMetaData(); 1.5 String aliasSRID = meta.getColumnName(index + 1); 1.6 1.7 - // get the index of the column containing the exression for the reference geometry 1.8 + // get the index of the column containing the expression for the reference geometry 1.9 Integer indexOfGeometry = geoNames.get(aliasSRID.replace("_srid", "")); 1.10 if (indexOfGeometry != null) { 1.11 // index + 2 would have the datatype 1.12 @@ -303,6 +303,12 @@ 1.13 if (GeoConstants.WKTLITERAL.equals(datatype)) { 1.14 uri = GeoConstants.CRS84_URI; 1.15 } 1.16 + 1.17 + } else { // we didn't manage to locate the datatype column, so this is probably 1.18 + // a constant for which it is not possible to determine its datatype 1.19 + // since this function is geof:getSRID, we assume a geo:wktLiteral datatype, sorry 1.20 + uri = GeoConstants.CRS84_URI; 1.21 + 1.22 } 1.23 } 1.24
2.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Tue Sep 23 13:16:47 2014 +0300 2.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Tue Sep 23 14:05:26 2014 +0300 2.3 @@ -944,6 +944,7 @@ 2.4 // we have to compute it 2.5 filter.appendFunction("ST_SRID"); 2.6 filter.openBracket(); 2.7 + 2.8 if(expr.getArg() instanceof GeneralDBStringValue) 2.9 { 2.10 appendWKT(expr.getArg(),filter); 2.11 @@ -963,7 +964,7 @@ 2.12 else if(expr.getArg() instanceof GeneralDBSqlCase) 2.13 { 2.14 GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 2.15 - appendMBB(onlyLabel,filter); 2.16 + appendMBB(onlyLabel, filter); 2.17 } 2.18 else 2.19 { 2.20 @@ -1004,7 +1005,7 @@ 2.21 // parse raw WKT 2.22 AbstractWKT wkt = new AbstractWKT(raw); 2.23 filter.append(" ST_GeomFromText('" + wkt.getWKT() + "'," + String.valueOf(wkt.getSRID()) + ")"); 2.24 - 2.25 + 2.26 return raw; 2.27 } 2.28
3.1 --- a/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx Tue Sep 23 13:16:47 2014 +0300 3.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx Tue Sep 23 14:05:26 2014 +0300 3.3 @@ -6,7 +6,7 @@ 3.4 <results> 3.5 <result> 3.6 <binding name='srid'> 3.7 - <uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 3.8 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 3.9 </binding> 3.10 </result> 3.11 </results>
4.1 --- a/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx Tue Sep 23 13:16:47 2014 +0300 4.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx Tue Sep 23 14:05:26 2014 +0300 4.3 @@ -6,7 +6,7 @@ 4.4 <results> 4.5 <result> 4.6 <binding name='srid'> 4.7 - <uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 4.8 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 4.9 </binding> 4.10 </result> 4.11 </results>
5.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryWithConstantTest.srx Tue Sep 23 13:16:47 2014 +0300 5.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryWithConstantTest.srx Tue Sep 23 14:05:26 2014 +0300 5.3 @@ -6,7 +6,7 @@ 5.4 <results> 5.5 <result> 5.6 <binding name='boundary'> 5.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>LINEARRING (0 0, 1 0, 1 1, 0 1, 0 0);http://www.opengis.net/def/crs/EPSG/0/2100</literal> 5.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0);http://www.opengis.net/def/crs/EPSG/0/2100</literal> 5.9 </binding> 5.10 </result> 5.11 </results>