Strabon
changeset 1227:33a5a1ae743a
#32 changed the result type of select constructs from wkb to wkt or wktliteral.
As a result, a geosparql construct function returns http://www.opengis.net/ont/geosparql#wktLiteral
and an stsparql contruct returns http://strdf.di.uoa.gr/ontology#WKT.
As a result, a geosparql construct function returns http://www.opengis.net/ont/geosparql#wktLiteral
and an stsparql contruct returns http://strdf.di.uoa.gr/ontology#WKT.
author | Stella Giannakopoulou <sgian@di.uoa.gr> |
---|---|
date | Wed Jul 17 13:39:41 2013 +0300 (2013-07-17) |
parents | 7d77478a877f |
children | d41dcbd64b02 |
files | generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java |
line diff
1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Tue Jul 16 19:21:12 2013 +0300 1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Wed Jul 17 13:39:41 2013 +0300 1.3 @@ -139,7 +139,7 @@ 1.4 * Enumeration of the possible types of the results of spatial functions. 1.5 * A <tt>NULL</tt> result type is to be interpreted as error. 1.6 */ 1.7 - public enum ResultType { INTEGER, STRING, BOOLEAN, WKB, DOUBLE, NULL}; 1.8 + public enum ResultType { INTEGER, STRING, BOOLEAN, WKT, WKTLITERAL, DOUBLE, NULL}; 1.9 1.10 //used to retrieve the appropriate column in the Binding Iteration 1.11 protected HashMap<GeneralDBSpatialFuncInfo, Integer> constructIndexesAndNames = new HashMap<GeneralDBSpatialFuncInfo, Integer>(); 1.12 @@ -762,7 +762,7 @@ 1.13 info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type); 1.14 1.15 // set increaseIndex to <tt>true</tt> for geometries only (see commend below) 1.16 - if (type == ResultType.WKB) { 1.17 + if (type == ResultType.WKT || type == ResultType.WKTLITERAL) { 1.18 increaseIndex = true; 1.19 } 1.20 1.21 @@ -996,10 +996,32 @@ 1.22 } 1.23 1.24 } 1.25 - else if(expr instanceof GeneralDBSqlSpatialConstructBinary || expr instanceof GeneralDBSqlSpatialConstructUnary || expr instanceof GeneralDBSqlSpatialConstructTriple) 1.26 - { 1.27 - return ResultType.WKB; 1.28 + 1.29 + else if(expr instanceof GeneralDBSqlSpatialConstructUnary) 1.30 + { 1.31 + GeneralDBSqlSpatialConstructUnary exprUnary = (GeneralDBSqlSpatialConstructUnary) expr; 1.32 + if(exprUnary.getResultType() == GeoConstants.WKT) 1.33 + return ResultType.WKT; 1.34 + else 1.35 + return ResultType.WKTLITERAL; 1.36 } 1.37 + else if(expr instanceof GeneralDBSqlSpatialConstructBinary) 1.38 + { 1.39 + GeneralDBSqlSpatialConstructBinary exprBinary = (GeneralDBSqlSpatialConstructBinary) expr; 1.40 + if(exprBinary.getResultType() == GeoConstants.WKT) 1.41 + return ResultType.WKT; 1.42 + else 1.43 + return ResultType.WKTLITERAL; 1.44 + } 1.45 + else if(expr instanceof GeneralDBSqlSpatialConstructTriple) 1.46 + { 1.47 + GeneralDBSqlSpatialConstructTriple exprTriple = (GeneralDBSqlSpatialConstructTriple) expr; 1.48 + if(exprTriple.getResultType() == GeoConstants.WKT) 1.49 + return ResultType.WKT; 1.50 + else 1.51 + return ResultType.WKTLITERAL; 1.52 + } 1.53 + 1.54 else if(expr instanceof GeneralDBSqlSpatialMetricBinary || 1.55 expr instanceof GeneralDBSqlSpatialMetricUnary || 1.56 expr instanceof GeneralDBSqlMathExpr ||
2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Tue Jul 16 19:21:12 2013 +0300 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Wed Jul 17 13:39:41 2013 +0300 2.3 @@ -159,10 +159,12 @@ 2.4 case STRING: 2.5 value = createStringGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 2.6 break; 2.7 - case WKB: 2.8 - value = createBinaryGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 2.9 + case WKT: 2.10 + value = createWellKnownTextGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 2.11 break; 2.12 - 2.13 + case WKTLITERAL: 2.14 + value = createWellKnownTextLiteralGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 2.15 + break; 2.16 } 2.17 //Value value = createGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 2.18 result.addBinding(construct.getFieldName(), value); 2.19 @@ -207,19 +209,12 @@ 2.20 */ 2.21 protected abstract RdbmsValue createGeoValue(ResultSet rs, int index) 2.22 throws SQLException; 2.23 + 2.24 + protected abstract RdbmsValue createWellKnownTextGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException; 2.25 + 2.26 + protected abstract RdbmsValue createWellKnownTextLiteralGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException; 2.27 2.28 - /** 2.29 - * FIXME the implementation of this function for PostGIS and MonetDB 2.30 - * uses by default the {@link GeoConstants#WKT} datatype when creating WKT 2.31 - * literals. What about geo:wktLiteral? 2.32 - * However, this method is called by {@link convert} method only, which 2.33 - * in turn is not called by any method! 2.34 - */ 2.35 - protected abstract RdbmsValue createBinaryGeoValueForSelectConstructs(ResultSet rs, int index) 2.36 - throws SQLException; 2.37 - 2.38 - protected RdbmsValue createDoubleGeoValueForSelectConstructs(ResultSet rs, int index) 2.39 - throws SQLException 2.40 + protected RdbmsValue createDoubleGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException 2.41 { 2.42 double potentialMetric; 2.43 //case of metrics
3.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java Tue Jul 16 19:21:12 2013 +0300 3.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java Wed Jul 17 13:39:41 2013 +0300 3.3 @@ -24,8 +24,7 @@ 3.4 */ 3.5 public class MonetDBBindingIteration extends GeneralDBBindingIteration { 3.6 3.7 - public MonetDBBindingIteration(PreparedStatement stmt) 3.8 - throws SQLException 3.9 + public MonetDBBindingIteration(PreparedStatement stmt) throws SQLException 3.10 { 3.11 super(stmt); 3.12 } 3.13 @@ -47,10 +46,18 @@ 3.14 return createResource(rs, index); 3.15 } 3.16 3.17 - 3.18 @Override 3.19 - protected RdbmsValue createBinaryGeoValueForSelectConstructs(ResultSet rs, int index) 3.20 - throws SQLException 3.21 + protected RdbmsValue createWellKnownTextGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException 3.22 + { 3.23 + //Case of spatial constructs 3.24 + Blob labelBlob = rs.getBlob(index + 1); 3.25 + byte[] label = labelBlob.getBytes((long)1, (int)labelBlob.length()); 3.26 + int srid = rs.getInt(index + 2); 3.27 + return vf.getRdbmsPolyhedron(114, GeoConstants.WKT, label, srid); 3.28 + } 3.29 + 3.30 + @Override 3.31 + protected RdbmsValue createWellKnownTextLiteralGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException 3.32 { 3.33 //Case of spatial constructs 3.34 Blob labelBlob = rs.getBlob(index + 1);
4.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java Tue Jul 16 19:21:12 2013 +0300 4.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java Wed Jul 17 13:39:41 2013 +0300 4.3 @@ -44,15 +44,22 @@ 4.4 4.5 return createResource(rs, index); 4.6 } 4.7 - 4.8 + 4.9 @Override 4.10 - protected RdbmsValue createBinaryGeoValueForSelectConstructs(ResultSet rs, int index) 4.11 - throws SQLException 4.12 + protected RdbmsValue createWellKnownTextGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException 4.13 { 4.14 //Case of spatial constructs 4.15 byte[] label = rs.getBytes(index + 1); 4.16 int srid = rs.getInt(index + 2); 4.17 return vf.getRdbmsPolyhedron(114, GeoConstants.WKT, label, srid); 4.18 - 4.19 + } 4.20 + 4.21 + @Override 4.22 + protected RdbmsValue createWellKnownTextLiteralGeoValueForSelectConstructs(ResultSet rs, int index) throws SQLException 4.23 + { 4.24 + //Case of spatial constructs 4.25 + byte[] label = rs.getBytes(index + 1); 4.26 + int srid = rs.getInt(index + 2); 4.27 + return vf.getRdbmsPolyhedron(114, GeoConstants.WKTLITERAL, label, srid); 4.28 } 4.29 } 4.30 \ No newline at end of file