Strabon
changeset 1398:08acbf7620dc
Fixes bug #32: implements geof:getSRID properly (now returns the URI of the corresponding SRID of the given geometry)
line diff
1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java Fri Sep 19 10:40:06 2014 +0300 1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java Fri Sep 19 12:22:04 2014 +0300 1.3 @@ -13,10 +13,16 @@ 1.4 1.5 private String fieldName; 1.6 private ResultType type; 1.7 + private boolean sridFunc; 1.8 1.9 - public GeneralDBSpatialFuncInfo(String fieldName, ResultType type) { 1.10 + public GeneralDBSpatialFuncInfo(String fieldName, ResultType type, boolean sridFunc) { 1.11 this.fieldName = fieldName; 1.12 this.type = type; 1.13 + this.sridFunc = sridFunc; 1.14 + } 1.15 + 1.16 + public boolean isSRIDFunc() { 1.17 + return sridFunc; 1.18 } 1.19 1.20 public String getFieldName() {
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlAbstractGeoSrid.java Fri Sep 19 12:22:04 2014 +0300 2.3 @@ -0,0 +1,37 @@ 2.4 +/** 2.5 + * This Source Code Form is subject to the terms of the Mozilla Public 2.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 2.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 2.8 + * 2.9 + * Copyright (C) 2012, 2013 Pyravlos Team 2.10 + * 2.11 + * http://www.sextant.di.uoa.gr/ 2.12 + */ 2.13 +package org.openrdf.sail.generaldb.algebra; 2.14 + 2.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 2.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 2.17 + 2.18 +/** 2.19 + * This class is used as a superclass for the classes {@link GeneralDBSqlGeoSPARQLSrid} 2.20 + * and {@link GeneralDBSqlGeoSrid}. This is needed because the corresponding functions 2.21 + * differ only in the types of the returning results, so we do not want to duplicate 2.22 + * code for computing them. Instead, we will compute them based on this abstract 2.23 + * function, and then, when converting the result set, we will differentiate our 2.24 + * behavior based on the actual instantiation. 2.25 + * 2.26 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 2.27 + */ 2.28 +public class GeneralDBSqlAbstractGeoSrid extends GeneralDBSqlSpatialProperty { 2.29 + 2.30 + public GeneralDBSqlAbstractGeoSrid(GeneralDBSqlExpr expr) { 2.31 + super(expr); 2.32 + } 2.33 + 2.34 + @Override 2.35 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 2.36 + throws X 2.37 + { 2.38 + visitor.meet(this); 2.39 + } 2.40 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoSPARQLSrid.java Fri Sep 19 12:22:04 2014 +0300 3.3 @@ -0,0 +1,32 @@ 3.4 +/** 3.5 + * This Source Code Form is subject to the terms of the Mozilla Public 3.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 3.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 3.8 + * 3.9 + * Copyright (C) 2012, 2013 Pyravlos Team 3.10 + * 3.11 + * http://www.sextant.di.uoa.gr/ 3.12 + */ 3.13 +package org.openrdf.sail.generaldb.algebra; 3.14 + 3.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 3.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 3.17 + 3.18 +/** 3.19 + * @see {@link org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property.GeoSparqlGetSRIDFunc} 3.20 + * 3.21 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 3.22 + */ 3.23 +public class GeneralDBSqlGeoSPARQLSrid extends GeneralDBSqlAbstractGeoSrid { 3.24 + 3.25 + public GeneralDBSqlGeoSPARQLSrid(GeneralDBSqlExpr expr) { 3.26 + super(expr); 3.27 + } 3.28 + 3.29 + @Override 3.30 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 3.31 + throws X 3.32 + { 3.33 + visitor.meet(this); 3.34 + } 3.35 +}
4.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoSrid.java Fri Sep 19 10:40:06 2014 +0300 4.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoSrid.java Fri Sep 19 12:22:04 2014 +0300 4.3 @@ -14,7 +14,7 @@ 4.4 * 4.5 * @author Manos Karpathiotakis <mk@di.uoa.gr> 4.6 */ 4.7 -public class GeneralDBSqlGeoSrid extends GeneralDBSqlSpatialProperty { 4.8 +public class GeneralDBSqlGeoSrid extends GeneralDBSqlAbstractGeoSrid { 4.9 4.10 public GeneralDBSqlGeoSrid(GeneralDBSqlExpr expr) { 4.11 super(expr);
5.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Fri Sep 19 10:40:06 2014 +0300 5.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Fri Sep 19 12:22:04 2014 +0300 5.3 @@ -22,6 +22,7 @@ 5.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 5.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 5.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 5.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 5.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 5.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 5.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 5.11 @@ -456,6 +457,10 @@ 5.12 public static GeneralDBSqlExpr srid(GeneralDBSqlExpr expr) { 5.13 return new GeneralDBSqlGeoSrid(expr); 5.14 } 5.15 + 5.16 + public static GeneralDBSqlExpr geofSRID(GeneralDBSqlExpr expr) { 5.17 + return new GeneralDBSqlGeoSPARQLSrid(expr); 5.18 + } 5.19 5.20 public static GeneralDBSqlExpr isEmpty(GeneralDBSqlExpr expr) { 5.21 return new GeneralDBSqlGeoIsEmpty(expr);
6.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Fri Sep 19 10:40:06 2014 +0300 6.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Fri Sep 19 12:22:04 2014 +0300 6.3 @@ -41,6 +41,7 @@ 6.4 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoSymDifference; 6.5 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoTransform; 6.6 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoUnion; 6.7 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geofSRID; 6.8 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geometryType; 6.9 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.gt; 6.10 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.intersects; 6.11 @@ -129,8 +130,8 @@ 6.12 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc; 6.13 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc; 6.14 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc; 6.15 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.IntersectionFunc; 6.16 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc; 6.17 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.IntersectionFunc; 6.18 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc; 6.19 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RelateFunc; 6.20 import org.openrdf.query.algebra.helpers.QueryModelVisitorBase; 6.21 @@ -1323,10 +1324,13 @@ 6.22 { 6.23 return asText(arg); 6.24 } 6.25 - else if(function.getURI().equals(GeoConstants.stSPARQLsrid) || 6.26 - function.getURI().equals(GeoConstants.geoSparqlGetSRID)) 6.27 + else if(function.getURI().equals(GeoConstants.stSPARQLsrid)) 6.28 { 6.29 return srid(arg); 6.30 + } 6.31 + else if (function.getURI().equals(GeoConstants.geoSparqlGetSRID)) 6.32 + { 6.33 + return geofSRID(arg); 6.34 } 6.35 else if(function.getURI().equals(GeoConstants.stSPARQLisEmpty)) 6.36 {
7.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Sep 19 10:40:06 2014 +0300 7.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Sep 19 12:22:04 2014 +0300 7.3 @@ -22,7 +22,6 @@ 7.4 import org.openrdf.model.Value; 7.5 import org.openrdf.model.impl.BooleanLiteralImpl; 7.6 import org.openrdf.model.impl.LiteralImpl; 7.7 -import org.openrdf.model.impl.NumericLiteralImpl; 7.8 import org.openrdf.model.impl.URIImpl; 7.9 import org.openrdf.query.BindingSet; 7.10 import org.openrdf.query.Dataset; 7.11 @@ -80,6 +79,7 @@ 7.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectProjection; 7.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery; 7.14 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery.OrderElem; 7.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbstractGeoSrid; 7.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 7.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDateTimeMetricBinary; 7.18 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsGML; 7.19 @@ -88,6 +88,7 @@ 7.20 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoGeometryType; 7.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 7.22 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 7.23 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 7.24 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 7.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 7.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 7.27 @@ -145,7 +146,7 @@ 7.28 * Enumeration of the possible types of the results of spatial functions. 7.29 * A <tt>NULL</tt> result type is to be interpreted as error. 7.30 */ 7.31 - public enum ResultType { INTEGER, STRING, BOOLEAN, WKT, WKTLITERAL, DOUBLE, NULL}; 7.32 + public enum ResultType { INTEGER, STRING, BOOLEAN, WKT, WKTLITERAL, DOUBLE, URI, NULL}; 7.33 7.34 //used to retrieve the appropriate column in the Binding Iteration 7.35 protected HashMap<GeneralDBSpatialFuncInfo, Integer> constructIndexesAndNames = new HashMap<GeneralDBSpatialFuncInfo, Integer>(); 7.36 @@ -859,8 +860,8 @@ 7.37 throw new UnsupportedRdbmsOperatorException("No such spatial expression exists!"); 7.38 7.39 } else { 7.40 - info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type); 7.41 - 7.42 + info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type, expr instanceof GeneralDBSqlAbstractGeoSrid); 7.43 + 7.44 // set increaseIndex to <tt>true</tt> for geometries only (see commend below) 7.45 if (type == ResultType.WKT || type == ResultType.WKTLITERAL) { 7.46 increaseIndex = true; 7.47 @@ -1099,6 +1100,9 @@ 7.48 expr instanceof GeneralDBSqlGeoIsEmpty ) 7.49 { 7.50 return ResultType.BOOLEAN; 7.51 + 7.52 + } else if (expr instanceof GeneralDBSqlGeoSPARQLSrid) { 7.53 + return ResultType.URI; 7.54 } 7.55 7.56 }
8.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Fri Sep 19 10:40:06 2014 +0300 8.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Fri Sep 19 12:22:04 2014 +0300 8.3 @@ -35,6 +35,7 @@ 8.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 8.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 8.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 8.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 8.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 8.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 8.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 8.11 @@ -125,7 +126,6 @@ 8.12 */ 8.13 public abstract class GeneralDBQueryBuilder { 8.14 8.15 - 8.16 protected GeneralDBSqlQueryBuilder query; 8.17 8.18 protected GeneralDBValueFactory vf; 8.19 @@ -748,8 +748,8 @@ 8.20 } 8.21 8.22 protected void dispatchUnarySqlOperator(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter) 8.23 - throws UnsupportedRdbmsOperatorException 8.24 - { 8.25 + throws UnsupportedRdbmsOperatorException 8.26 + { 8.27 if (expr instanceof GeneralDBSqlAbs) { 8.28 append((GeneralDBSqlAbs)expr, filter); 8.29 } 8.30 @@ -797,6 +797,9 @@ 8.31 } 8.32 else if (expr instanceof GeneralDBSqlGeoSrid) { 8.33 append((GeneralDBSqlGeoSrid)expr, filter); 8.34 + 8.35 + } else if (expr instanceof GeneralDBSqlGeoSPARQLSrid) { 8.36 + append((GeneralDBSqlGeoSPARQLSrid)expr, filter); 8.37 } 8.38 else if (expr instanceof GeneralDBSqlGeoIsEmpty) { 8.39 append((GeneralDBSqlGeoIsEmpty)expr, filter); 8.40 @@ -808,7 +811,7 @@ 8.41 else { 8.42 throw unsupported(expr); 8.43 } 8.44 - } 8.45 + } 8.46 8.47 protected void dispatchValueColumnBase(GeneralDBValueColumnBase expr, GeneralDBSqlExprBuilder filter) 8.48 throws UnsupportedRdbmsOperatorException 8.49 @@ -1138,6 +1141,9 @@ 8.50 8.51 protected abstract void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 8.52 throws UnsupportedRdbmsOperatorException; 8.53 + 8.54 + protected abstract void append(GeneralDBSqlGeoSPARQLSrid expr, GeneralDBSqlExprBuilder filter) 8.55 + throws UnsupportedRdbmsOperatorException; 8.56 8.57 protected abstract void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter) 8.58 throws UnsupportedRdbmsOperatorException;
9.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Fri Sep 19 10:40:06 2014 +0300 9.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Fri Sep 19 12:22:04 2014 +0300 9.3 @@ -15,6 +15,7 @@ 9.4 import org.openrdf.query.BindingSet; 9.5 import org.openrdf.query.QueryEvaluationException; 9.6 import org.openrdf.query.algebra.evaluation.QueryBindingSet; 9.7 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 9.8 import org.openrdf.sail.generaldb.GeneralDBSpatialFuncInfo; 9.9 import org.openrdf.sail.generaldb.GeneralDBValueFactory; 9.10 import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar; 9.11 @@ -98,7 +99,6 @@ 9.12 protected BindingSet convert(ResultSet rs) 9.13 throws SQLException 9.14 { 9.15 - 9.16 /// debug 9.17 /*for(int i=1; i<12;i++) { 9.18 Object o = rs.getObject(i); 9.19 @@ -155,8 +155,8 @@ 9.20 case INTEGER: 9.21 value = createIntegerGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 9.22 break; 9.23 - case STRING: 9.24 - value = createStringGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 9.25 + case STRING: 9.26 + value = createStringGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 9.27 break; 9.28 case WKT: 9.29 value = createWellKnownTextGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 9.30 @@ -164,6 +164,9 @@ 9.31 case WKTLITERAL: 9.32 value = createWellKnownTextLiteralGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 9.33 break; 9.34 + case URI: 9.35 + value = createURIGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct), construct.isSRIDFunc()); 9.36 + break; 9.37 } 9.38 //Value value = createGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 9.39 result.addBinding(construct.getFieldName(), value); 9.40 @@ -200,15 +203,6 @@ 9.41 } 9.42 9.43 /** 9.44 - * FIXME the implementation of this function for PostGIS and MonetDB 9.45 - * uses by default the {@link GeoConstants#WKT} datatype when creating WKT 9.46 - * literals. What about geo:wktLiteral? 9.47 - * However, this method is called by {@link convert} method only, which 9.48 - * in turn is not called by any method! 9.49 - * 9.50 - */ 9.51 - 9.52 - /** 9.53 * Creates a geospatial value from the given result set and index position. 9.54 * When projecting on a geospatial value, we get also its SRID, and its 9.55 * datatype, so that we are able to assign that datatype to the new value. 9.56 @@ -267,4 +261,23 @@ 9.57 return vf.asRdbmsLiteral(vf.createLiteral(spProperty)); 9.58 9.59 } 9.60 + 9.61 + protected RdbmsResource createURIGeoValueForSelectConstructs(ResultSet rs, int index, boolean sridTransform) 9.62 + throws SQLException 9.63 + { 9.64 + String uri; 9.65 + 9.66 + if (sridTransform) { 9.67 + // we have to differentiate here for geoSPARQL's getSRID function, since we need to transform 9.68 + // the result to a URI 9.69 + // this is called for GeoSPARQL's getSRID, thus the column would be of type Integer 9.70 + int srid = rs.getInt(index + 1); 9.71 + uri = WKTHelper.getURI_forSRID(srid); 9.72 + 9.73 + } else { // we get this as a string first, and then we shall construct the URI 9.74 + uri = rs.getString(index + 1); 9.75 + } 9.76 + 9.77 + return vf.asRdbmsURI(vf.createURI(uri)); 9.78 + } 9.79 }
10.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Fri Sep 19 10:40:06 2014 +0300 10.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Fri Sep 19 12:22:04 2014 +0300 10.3 @@ -15,6 +15,7 @@ 10.4 import org.openrdf.sail.generaldb.algebra.GeneralDBLabelColumn; 10.5 import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 10.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 10.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbstractGeoSrid; 10.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 10.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 10.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 10.11 @@ -37,6 +38,7 @@ 10.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIntersection; 10.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 10.14 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 10.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 10.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 10.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 10.18 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 10.19 @@ -372,9 +374,8 @@ 10.20 10.21 //FIXME my addition from here on 10.22 @Override 10.23 - public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr) 10.24 - throws UnsupportedRdbmsOperatorException 10.25 - { 10.26 + public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr) throws UnsupportedRdbmsOperatorException 10.27 + { 10.28 if(!(expr instanceof GeneralDBSqlSpatialMetricBinary) 10.29 &&!(expr instanceof GeneralDBSqlSpatialMetricUnary) 10.30 &&!(expr instanceof GeneralDBSqlMathExpr) 10.31 @@ -813,10 +814,26 @@ 10.32 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_AsGML); 10.33 } 10.34 10.35 + /** 10.36 + * This will call the method below: 10.37 + * {@link org.openrdf.sail.postgis.evaluation.MonetDBQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 10.38 + */ 10.39 @Override 10.40 - protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 10.41 - throws UnsupportedRdbmsOperatorException 10.42 - { 10.43 + protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 10.44 + appendSrid(expr, filter); 10.45 + } 10.46 + 10.47 + /** 10.48 + * This will call the method below: 10.49 + * {@link org.openrdf.sail.postgis.evaluation.MonetDBQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 10.50 + */ 10.51 + @Override 10.52 + protected void append(GeneralDBSqlGeoSPARQLSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 10.53 + appendSrid(expr, filter); 10.54 + } 10.55 + 10.56 + protected void appendSrid(GeneralDBSqlAbstractGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 10.57 + { 10.58 // appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_SRID); 10.59 10.60 boolean sridNeeded = true; 10.61 @@ -927,13 +944,12 @@ 10.62 } 10.63 else 10.64 { 10.65 - //4326 by default - Software House additions 10.66 filter.append(String.valueOf(GeoConstants.defaultSRID)); 10.67 } 10.68 } 10.69 10.70 filter.closeBracket(); 10.71 - } 10.72 + } 10.73 10.74 @Override 10.75 protected void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter)
11.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Sep 19 10:40:06 2014 +0300 11.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Sep 19 12:22:04 2014 +0300 11.3 @@ -22,6 +22,7 @@ 11.4 import org.openrdf.sail.generaldb.algebra.GeneralDBNumberValue; 11.5 import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 11.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 11.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbstractGeoSrid; 11.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 11.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 11.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 11.11 @@ -44,6 +45,7 @@ 11.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIntersection; 11.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 11.14 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 11.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 11.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 11.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 11.18 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 11.19 @@ -837,11 +839,28 @@ 11.20 } 11.21 */ 11.22 /** 11.23 + * This will call the method below: 11.24 + * {@link org.openrdf.sail.postgis.evaluation.PostGISQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 11.25 + */ 11.26 + @Override 11.27 + protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 11.28 + appendSrid(expr, filter); 11.29 + } 11.30 + 11.31 + /** 11.32 + * This will call the method below: 11.33 + * {@link org.openrdf.sail.postgis.evaluation.PostGISQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 11.34 + */ 11.35 + @Override 11.36 + protected void append(GeneralDBSqlGeoSPARQLSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 11.37 + appendSrid(expr, filter); 11.38 + } 11.39 + 11.40 + /** 11.41 * Special case because I need to retrieve a single different column from geo_values when this function occurs 11.42 * in the select clause and not call the st_srid() function, which will always give me 4326. 11.43 */ 11.44 - @Override 11.45 - protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 11.46 + protected void appendSrid(GeneralDBSqlAbstractGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 11.47 boolean sridNeeded = true; 11.48 filter.openBracket(); 11.49