# HG changeset patch # User Babis Nikolaou # Date 1411470326 -10800 # Node ID f86d1129ce7929ecd3af155568cba4cf1c0fc2c8 # Parent b1ad88fdf4a6446d1aaa931f22e1ac2e297677d9 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. diff -r b1ad88fdf4a6 -r f86d1129ce79 generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Tue Sep 23 13:16:47 2014 +0300 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Tue Sep 23 14:05:26 2014 +0300 @@ -293,7 +293,7 @@ ResultSetMetaData meta = rs.getMetaData(); String aliasSRID = meta.getColumnName(index + 1); - // get the index of the column containing the exression for the reference geometry + // get the index of the column containing the expression for the reference geometry Integer indexOfGeometry = geoNames.get(aliasSRID.replace("_srid", "")); if (indexOfGeometry != null) { // index + 2 would have the datatype @@ -303,6 +303,12 @@ if (GeoConstants.WKTLITERAL.equals(datatype)) { uri = GeoConstants.CRS84_URI; } + + } else { // we didn't manage to locate the datatype column, so this is probably + // a constant for which it is not possible to determine its datatype + // since this function is geof:getSRID, we assume a geo:wktLiteral datatype, sorry + uri = GeoConstants.CRS84_URI; + } } diff -r b1ad88fdf4a6 -r f86d1129ce79 postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Tue Sep 23 13:16:47 2014 +0300 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Tue Sep 23 14:05:26 2014 +0300 @@ -944,6 +944,7 @@ // we have to compute it filter.appendFunction("ST_SRID"); filter.openBracket(); + if(expr.getArg() instanceof GeneralDBStringValue) { appendWKT(expr.getArg(),filter); @@ -963,7 +964,7 @@ else if(expr.getArg() instanceof GeneralDBSqlCase) { GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); - appendMBB(onlyLabel,filter); + appendMBB(onlyLabel, filter); } else { @@ -1004,7 +1005,7 @@ // parse raw WKT AbstractWKT wkt = new AbstractWKT(raw); filter.append(" ST_GeomFromText('" + wkt.getWKT() + "'," + String.valueOf(wkt.getSRID()) + ")"); - + return raw; } diff -r b1ad88fdf4a6 -r f86d1129ce79 testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx --- a/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx Tue Sep 23 13:16:47 2014 +0300 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx Tue Sep 23 14:05:26 2014 +0300 @@ -6,7 +6,7 @@ - http://www.opengis.net/def/crs/EPSG/0/4326 + http://www.opengis.net/def/crs/OGC/1.3/CRS84 diff -r b1ad88fdf4a6 -r f86d1129ce79 testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx --- a/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx Tue Sep 23 13:16:47 2014 +0300 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx Tue Sep 23 14:05:26 2014 +0300 @@ -6,7 +6,7 @@ - http://www.opengis.net/def/crs/EPSG/0/4326 + http://www.opengis.net/def/crs/OGC/1.3/CRS84 diff -r b1ad88fdf4a6 -r f86d1129ce79 testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryWithConstantTest.srx --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryWithConstantTest.srx Tue Sep 23 13:16:47 2014 +0300 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryWithConstantTest.srx Tue Sep 23 14:05:26 2014 +0300 @@ -6,7 +6,7 @@ - LINEARRING (0 0, 1 0, 1 1, 0 1, 0 0);http://www.opengis.net/def/crs/EPSG/0/2100 + LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0);http://www.opengis.net/def/crs/EPSG/0/2100