Strabon
changeset 429:ea79024a3e30
Added 3 stSPARQL functions:
* strdf:intersects
* strdf:mbbIntersects
* strdf:mbbEquals
In the case of MonetDB, the last two function operate on the actual geometries and not their MBRs
* strdf:intersects
* strdf:mbbIntersects
* strdf:mbbEquals
In the case of MonetDB, the last two function operate on the actual geometries and not their MBRs
line diff
1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java Thu Jul 12 14:23:48 2012 +0300 1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java Thu Jul 12 15:53:34 2012 +0300 1.3 @@ -67,6 +67,7 @@ 1.4 * */ 1.5 // Spatial Relationships 1.6 public static final String anyInteract = stRDF + "anyInteract"; 1.7 + public static final String intersects = stRDF + "intersects"; 1.8 public static final String contains = stRDF + "contains"; 1.9 public static final String coveredBy = stRDF + "coveredBy"; 1.10 public static final String covers = stRDF + "covers"; 1.11 @@ -81,6 +82,10 @@ 1.12 public static final String above = stRDF + "above"; 1.13 public static final String below = stRDF + "below"; 1.14 1.15 + // Spatial Relationships utilizing mbb 1.16 + public static final String mbbIntersects = stRDF + "mbbIntersects"; 1.17 + public static final String mbbEquals = stRDF + "mbbEquals"; 1.18 + 1.19 // Spatial Constructs 1.20 public static final String union = stRDF + "union"; 1.21 public static final String buffer = stRDF + "buffer";
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/IntersectsFunc.java Thu Jul 12 15:53:34 2012 +0300 2.3 @@ -0,0 +1,22 @@ 2.4 +/* 2.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2007. 2.6 + * 2.7 + * Licensed under the Aduna BSD-style license. 2.8 + */ 2.9 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 2.10 + 2.11 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 2.12 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 2.13 + 2.14 +/** 2.15 + * 2.16 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 2.17 + */ 2.18 +public class IntersectsFunc extends SpatialRelationshipFunc { 2.19 + 2.20 + @Override 2.21 + public String getURI() { 2.22 + return GeoConstants.intersects; 2.23 + } 2.24 + 2.25 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbEqualsFunc.java Thu Jul 12 15:53:34 2012 +0300 3.3 @@ -0,0 +1,22 @@ 3.4 +/* 3.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2007. 3.6 + * 3.7 + * Licensed under the Aduna BSD-style license. 3.8 + */ 3.9 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 3.10 + 3.11 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 3.12 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 3.13 + 3.14 +/** 3.15 + * 3.16 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 3.17 + */ 3.18 +public class MbbEqualsFunc extends SpatialRelationshipFunc { 3.19 + 3.20 + @Override 3.21 + public String getURI() { 3.22 + return GeoConstants.mbbEquals; 3.23 + } 3.24 + 3.25 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbIntersectsFunc.java Thu Jul 12 15:53:34 2012 +0300 4.3 @@ -0,0 +1,22 @@ 4.4 +/* 4.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2007. 4.6 + * 4.7 + * Licensed under the Aduna BSD-style license. 4.8 + */ 4.9 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 4.10 + 4.11 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 4.12 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 4.13 + 4.14 +/** 4.15 + * 4.16 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 4.17 + */ 4.18 +public class MbbIntersectsFunc extends SpatialRelationshipFunc { 4.19 + 4.20 + @Override 4.21 + public String getURI() { 4.22 + return GeoConstants.mbbIntersects; 4.23 + } 4.24 + 4.25 +}
5.1 --- a/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function Thu Jul 12 14:23:48 2012 +0300 5.2 +++ b/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function Thu Jul 12 15:53:34 2012 +0300 5.3 @@ -6,6 +6,9 @@ 5.4 org.openrdf.query.algebra.evaluation.function.BooleanCast 5.5 org.openrdf.query.algebra.evaluation.function.DateTimeCast 5.6 org.openrdf.query.algebra.evaluation.function.link.SimilarTermFunc 5.7 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbIntersectsFunc 5.8 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbEqualsFunc 5.9 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.IntersectsFunc 5.10 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.AnyInteractFunc 5.11 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.ContainsFunc 5.12 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CoveredByFunc
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlIntersects.java Thu Jul 12 15:53:34 2012 +0300 6.3 @@ -0,0 +1,19 @@ 6.4 +/* 6.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 6.6 + * 6.7 + * Licensed under the Aduna BSD-style license. 6.8 + */ 6.9 +package org.openrdf.sail.generaldb.algebra; 6.10 + 6.11 + 6.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 6.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 6.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 6.15 + 6.16 +public class GeneralDBSqlIntersects extends GeneralDBSqlGeoSpatial{ 6.17 + 6.18 + public GeneralDBSqlIntersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 6.19 + super(left, right); 6.20 + } 6.21 + 6.22 +} 6.23 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlMbbEquals.java Thu Jul 12 15:53:34 2012 +0300 7.3 @@ -0,0 +1,19 @@ 7.4 +/* 7.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 7.6 + * 7.7 + * Licensed under the Aduna BSD-style license. 7.8 + */ 7.9 +package org.openrdf.sail.generaldb.algebra; 7.10 + 7.11 + 7.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 7.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 7.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 7.15 + 7.16 +public class GeneralDBSqlMbbEquals extends GeneralDBSqlGeoSpatial{ 7.17 + 7.18 + public GeneralDBSqlMbbEquals(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 7.19 + super(left, right); 7.20 + } 7.21 + 7.22 +} 7.23 \ No newline at end of file
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlMbbIntersects.java Thu Jul 12 15:53:34 2012 +0300 8.3 @@ -0,0 +1,19 @@ 8.4 +/* 8.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 8.6 + * 8.7 + * Licensed under the Aduna BSD-style license. 8.8 + */ 8.9 +package org.openrdf.sail.generaldb.algebra; 8.10 + 8.11 + 8.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 8.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 8.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 8.15 + 8.16 +public class GeneralDBSqlMbbIntersects extends GeneralDBSqlGeoSpatial{ 8.17 + 8.18 + public GeneralDBSqlMbbIntersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 8.19 + super(left, right); 8.20 + } 8.21 + 8.22 +} 8.23 \ No newline at end of file
9.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Thu Jul 12 14:23:48 2012 +0300 9.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Thu Jul 12 15:53:34 2012 +0300 9.3 @@ -47,11 +47,14 @@ 9.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 9.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 9.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 9.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 9.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 9.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 9.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLike; 9.11 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLowerCase; 9.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 9.13 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 9.14 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 9.15 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 9.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 9.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 9.18 @@ -282,6 +285,18 @@ 9.19 public static GeneralDBSqlExpr touch(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 9.20 return new GeneralDBSqlTouch(left, right); 9.21 } 9.22 + 9.23 + public static GeneralDBSqlExpr intersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 9.24 + return new GeneralDBSqlIntersects(left, right); 9.25 + } 9.26 + 9.27 + public static GeneralDBSqlExpr mbbIntersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 9.28 + return new GeneralDBSqlMbbIntersects(left, right); 9.29 + } 9.30 + 9.31 + public static GeneralDBSqlExpr mbbEqualsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 9.32 + return new GeneralDBSqlMbbEquals(left, right); 9.33 + } 9.34 9.35 public static GeneralDBSqlExpr equalsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 9.36 return new GeneralDBSqlEqualsSpatial(left, right);
10.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Thu Jul 12 14:23:48 2012 +0300 10.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Thu Jul 12 15:53:34 2012 +0300 10.3 @@ -45,6 +45,7 @@ 10.4 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geometryType; 10.5 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.gt; 10.6 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.inside; 10.7 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.intersects; 10.8 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isEmpty; 10.9 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isNotNull; 10.10 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isNull; 10.11 @@ -52,6 +53,8 @@ 10.12 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.left; 10.13 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.like; 10.14 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.lowercase; 10.15 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.mbbEqualsGeo; 10.16 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.mbbIntersects; 10.17 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.neq; 10.18 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.not; 10.19 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.num; 10.20 @@ -934,11 +937,15 @@ 10.21 GeneralDBSqlExpr spatialRelationshipPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, 10.22 GeneralDBSqlExpr thirdArg) 10.23 { 10.24 - //XXX stSPARQL++ 10.25 + //XXX stSPARQL 10.26 if(function.getURI().equals(GeoConstants.anyInteract)) 10.27 { 10.28 return anyInteract(leftArg,rightArg); 10.29 } 10.30 + if(function.getURI().equals(GeoConstants.intersects)) 10.31 + { 10.32 + return intersects(leftArg,rightArg); 10.33 + } 10.34 else if(function.getURI().equals(GeoConstants.contains)) 10.35 { 10.36 return contains(leftArg,rightArg); 10.37 @@ -991,6 +998,18 @@ 10.38 { 10.39 return below(leftArg,rightArg); 10.40 } 10.41 + else if(function.getURI().equals(GeoConstants.touch)) 10.42 + { 10.43 + return touch(leftArg,rightArg); 10.44 + } 10.45 + else if(function.getURI().equals(GeoConstants.mbbIntersects)) 10.46 + { 10.47 + return mbbIntersects(leftArg,rightArg); 10.48 + } 10.49 + else if(function.getURI().equals(GeoConstants.mbbEquals)) 10.50 + { 10.51 + return mbbEqualsGeo(leftArg,rightArg); 10.52 + } 10.53 //XXX GeoSPARQL 10.54 //Simple Features 10.55 else if(function.getURI().equals(GeoConstants.sfContains))
11.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java Thu Jul 12 14:23:48 2012 +0300 11.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java Thu Jul 12 15:53:34 2012 +0300 11.3 @@ -5,33 +5,24 @@ 11.4 */ 11.5 package org.openrdf.sail.generaldb.algebra.factories; 11.6 11.7 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.anyInteract; 11.8 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.asText; 11.9 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.contains; 11.10 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.coveredBy; 11.11 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.covers; 11.12 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.dimension; 11.13 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.disjoint; 11.14 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.equalsGeo; 11.15 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoArea; 11.16 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBoundary; 11.17 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBuffer; 11.18 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoTransform; 11.19 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoConvexHull; 11.20 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDifference; 11.21 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDistance; 11.22 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoEnvelope; 11.23 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoIntersection; 11.24 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoSymDifference; 11.25 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoTransform; 11.26 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoUnion; 11.27 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geometryType; 11.28 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.inside; 11.29 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isEmpty; 11.30 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isSimple; 11.31 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.overlap; 11.32 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sqlNull; 11.33 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.srid; 11.34 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.touch; 11.35 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.unsupported; 11.36 11.37 import org.openrdf.model.Literal; 11.38 @@ -42,19 +33,18 @@ 11.39 import org.openrdf.query.algebra.FunctionCall; 11.40 import org.openrdf.query.algebra.Lang; 11.41 import org.openrdf.query.algebra.MathExpr; 11.42 +import org.openrdf.query.algebra.MathExpr.MathOp; 11.43 import org.openrdf.query.algebra.QueryModelNode; 11.44 import org.openrdf.query.algebra.Str; 11.45 import org.openrdf.query.algebra.ValueConstant; 11.46 import org.openrdf.query.algebra.ValueExpr; 11.47 import org.openrdf.query.algebra.Var; 11.48 -import org.openrdf.query.algebra.MathExpr.MathOp; 11.49 import org.openrdf.query.algebra.evaluation.function.Function; 11.50 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 11.51 import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 11.52 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 11.53 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 11.54 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 11.55 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 11.56 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlBoundaryFunc; 11.57 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc; 11.58 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlEnvelopeFunc;
12.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Thu Jul 12 14:23:48 2012 +0300 12.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Thu Jul 12 15:53:34 2012 +0300 12.3 @@ -51,10 +51,13 @@ 12.4 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.DisjointFunc; 12.5 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.EqualsFunc; 12.6 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.InsideFunc; 12.7 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.IntersectsFunc; 12.8 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.LeftFunc; 12.9 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.OverlapFunc; 12.10 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RightFunc; 12.11 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.TouchFunc; 12.12 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbEqualsFunc; 12.13 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbIntersectsFunc; 12.14 import org.openrdf.query.algebra.evaluation.impl.EvaluationStrategyImpl; 12.15 import org.openrdf.query.algebra.evaluation.iterator.OrderIterator; 12.16 import org.openrdf.query.algebra.evaluation.iterator.StSPARQLGroupIterator; 12.17 @@ -347,6 +350,13 @@ 12.18 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 12.19 funcResult = leftGeom.intersects(rightConverted); 12.20 } 12.21 + else if(function instanceof IntersectsFunc) 12.22 + { 12.23 + int targetSRID = leftGeom.getSRID(); 12.24 + int sourceSRID = rightGeom.getSRID(); 12.25 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 12.26 + funcResult = leftGeom.intersects(rightConverted); 12.27 + } 12.28 else if(function instanceof BelowFunc) 12.29 { 12.30 int targetSRID = leftGeom.getSRID(); 12.31 @@ -424,6 +434,20 @@ 12.32 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 12.33 funcResult = leftGeom.touches(rightConverted); 12.34 } 12.35 + else if(function instanceof MbbIntersectsFunc) 12.36 + { 12.37 + int targetSRID = leftGeom.getSRID(); 12.38 + int sourceSRID = rightGeom.getSRID(); 12.39 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 12.40 + funcResult = leftGeom.getEnvelope().intersects(rightConverted.getEnvelope()); 12.41 + } 12.42 + else if(function instanceof MbbEqualsFunc) 12.43 + { 12.44 + int targetSRID = leftGeom.getSRID(); 12.45 + int sourceSRID = rightGeom.getSRID(); 12.46 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 12.47 + funcResult = leftGeom.getEnvelope().equals(rightConverted.getEnvelope()); 12.48 + } 12.49 12.50 return funcResult ? BooleanLiteralImpl.TRUE : BooleanLiteralImpl.FALSE; 12.51 }
13.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Thu Jul 12 14:23:48 2012 +0300 13.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Thu Jul 12 15:53:34 2012 +0300 13.3 @@ -60,11 +60,14 @@ 13.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 13.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 13.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 13.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 13.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 13.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 13.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLike; 13.11 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLowerCase; 13.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 13.13 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 13.14 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 13.15 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 13.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 13.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 13.18 @@ -528,10 +531,13 @@ 13.19 * my additions 13.20 * FIXME 13.21 */ 13.22 - //Relationships - all 9 boolean of them - stSPARQL++ 13.23 + //Relationships - boolean - stSPARQL 13.24 else if (expr instanceof GeneralDBSqlAnyInteract) { 13.25 append((GeneralDBSqlAnyInteract)expr, filter); 13.26 } 13.27 + else if (expr instanceof GeneralDBSqlIntersects) { 13.28 + append((GeneralDBSqlIntersects)expr, filter); 13.29 + } 13.30 else if (expr instanceof GeneralDBSqlContains) { 13.31 append((GeneralDBSqlContains)expr, filter); 13.32 } 13.33 @@ -568,6 +574,12 @@ 13.34 else if (expr instanceof GeneralDBSqlBelow) { 13.35 append((GeneralDBSqlBelow)expr, filter); 13.36 } 13.37 + else if (expr instanceof GeneralDBSqlMbbIntersects) { 13.38 + append((GeneralDBSqlMbbIntersects)expr, filter); 13.39 + } 13.40 + else if (expr instanceof GeneralDBSqlMbbEquals) { 13.41 + append((GeneralDBSqlMbbEquals)expr, filter); 13.42 + } 13.43 //GeoSPARQL 13.44 //Simple Features 13.45 else if (expr instanceof GeneralDBSqlSF_Contains) { 13.46 @@ -931,6 +943,9 @@ 13.47 //Spatial Relationship Functions 13.48 protected abstract void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 13.49 throws UnsupportedRdbmsOperatorException; 13.50 + 13.51 + protected abstract void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 13.52 + throws UnsupportedRdbmsOperatorException; 13.53 13.54 protected abstract void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter) 13.55 throws UnsupportedRdbmsOperatorException; 13.56 @@ -970,6 +985,10 @@ 13.57 13.58 protected abstract void append(GeneralDBSqlBelow expr, GeneralDBSqlExprBuilder filter) 13.59 throws UnsupportedRdbmsOperatorException; 13.60 + protected abstract void append(GeneralDBSqlMbbIntersects expr, GeneralDBSqlExprBuilder filter) 13.61 + throws UnsupportedRdbmsOperatorException; 13.62 + protected abstract void append(GeneralDBSqlMbbEquals expr, GeneralDBSqlExprBuilder filter) 13.63 + throws UnsupportedRdbmsOperatorException; 13.64 13.65 //GeoSPARQL - Spatial Relationship Functions 13.66 //Simple Features
14.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBSqlExprBuilder.java Thu Jul 12 14:23:48 2012 +0300 14.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBSqlExprBuilder.java Thu Jul 12 15:53:34 2012 +0300 14.3 @@ -267,43 +267,43 @@ 14.4 where.append(")"); 14.5 } 14.6 14.7 - public void anyInteract() { 14.8 + public void intersectsMBB() { 14.9 14.10 //XXX 14.11 //edw prepei na ginei allou eidous douleia!! oxi na mpei to anyinteract, 14.12 //alla na prostethei kati pou tha mou pei o kwstis 14.13 where.append(" && "); 14.14 } 14.15 - 14.16 - public void equals() { 14.17 + 14.18 + public void equalsMBB() { 14.19 14.20 where.append(" = "); 14.21 } 14.22 14.23 - public void contains() { 14.24 + public void containsMBB() { 14.25 14.26 where.append(" ~ "); 14.27 } 14.28 14.29 - public void inside() { 14.30 + public void insideMBB() { 14.31 14.32 //den xerw akoma ti symbolo xreiazetai 14.33 where.append(" @ "); 14.34 } 14.35 14.36 - public void left() { 14.37 + public void leftMBB() { 14.38 where.append(" << "); 14.39 } 14.40 14.41 - public void right() { 14.42 + public void rightMBB() { 14.43 where.append(" >> "); 14.44 } 14.45 14.46 - public void above() { 14.47 + public void aboveMBB() { 14.48 where.append(" |>> "); 14.49 } 14.50 14.51 - public void below() { 14.52 + public void belowMBB() { 14.53 where.append(" <<|"); 14.54 } 14.55
15.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBSqlExprBuilderInterface.java Thu Jul 12 14:23:48 2012 +0300 15.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBSqlExprBuilderInterface.java Thu Jul 12 15:53:34 2012 +0300 15.3 @@ -15,6 +15,7 @@ 15.4 * Assemblies an SQL expression. 15.5 * 15.6 * @author James Leigh 15.7 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 15.8 * 15.9 */ 15.10 public interface GeneralDBSqlExprBuilderInterface { 15.11 @@ -100,23 +101,23 @@ 15.12 15.13 public void closeBracket(); 15.14 15.15 - public void anyInteract(); 15.16 + public void intersectsMBB(); 15.17 15.18 - public void equals(); 15.19 + public void equalsMBB(); 15.20 15.21 - public void contains(); 15.22 + public void containsMBB(); 15.23 15.24 - public void inside(); 15.25 + public void insideMBB(); 15.26 15.27 - public void left(); 15.28 + public void leftMBB(); 15.29 15.30 15.31 - public void right(); 15.32 + public void rightMBB(); 15.33 15.34 - public void above(); 15.35 + public void aboveMBB(); 15.36 15.37 - public void below(); 15.38 - 15.39 + public void belowMBB(); 15.40 + 15.41 public void doubleCast(); 15.42 15.43 // public void overlap();
16.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Thu Jul 12 14:23:48 2012 +0300 16.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Thu Jul 12 15:53:34 2012 +0300 16.3 @@ -43,9 +43,12 @@ 16.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 16.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 16.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 16.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 16.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 16.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 16.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 16.11 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 16.12 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 16.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 16.14 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 16.15 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 16.16 @@ -110,9 +113,9 @@ 16.17 * If (spatial) label column met is null, I must not try to retrieve its srid. 16.18 * Opting to ask for 'null' instead 16.19 */ 16.20 - 16.21 + 16.22 boolean nullLabel = false; 16.23 - 16.24 + 16.25 public enum SpatialOperandsMonetDB { left, right, above, below; } 16.26 public enum SpatialFunctionsMonetDB 16.27 { //Spatial Relationships 16.28 @@ -122,13 +125,13 @@ 16.29 ST_CoveredBy, 16.30 ST_Overlaps, 16.31 ST_Relate, 16.32 - 16.33 + 16.34 // These Spatial Relations are implemented in MonetDB as operands and they apply in MBB of a geometry 16.35 anyInteract, 16.36 equals, 16.37 contains, 16.38 inside, 16.39 - 16.40 + 16.41 //Spatial Constructs - Binary 16.42 ST_Union, 16.43 ST_Intersection, 16.44 @@ -136,18 +139,18 @@ 16.45 ST_Buffer, 16.46 ST_Transform, 16.47 ST_SymDifference, 16.48 - 16.49 + 16.50 //Spatial Constructs - Unary 16.51 ST_Envelope, 16.52 ST_ConvexHull, 16.53 ST_Boundary, 16.54 - 16.55 + 16.56 //Spatial Metrics - Binary 16.57 ST_Distance, 16.58 - 16.59 + 16.60 //Spatial Metrics - Unary 16.61 ST_Area, 16.62 - 16.63 + 16.64 //Spatial Properties - All Unary 16.65 ST_Dimension, 16.66 ST_GeometryType, 16.67 @@ -156,7 +159,7 @@ 16.68 ST_SRID, 16.69 ST_IsEmpty, 16.70 ST_IsSimple, 16.71 - 16.72 + 16.73 //GeoSPARQL 16.74 //Simple Features 16.75 SF_Equals, 16.76 @@ -176,7 +179,7 @@ 16.77 RCC8_Tpp, 16.78 RCC8_Ntppi, 16.79 RCC8_Ntpp, 16.80 - 16.81 + 16.82 //Egenhofer 16.83 EH_Equals, 16.84 EH_Disjoint, 16.85 @@ -192,32 +195,32 @@ 16.86 public MonetDBQueryBuilder() { 16.87 super(); 16.88 } 16.89 - 16.90 + 16.91 public MonetDBQueryBuilder(GeneralDBSqlQueryBuilder builder) { 16.92 super(builder); 16.93 this.query = builder; 16.94 } 16.95 - 16.96 + 16.97 @Override 16.98 protected void append(GeneralDBSqlNull expr, GeneralDBSqlExprBuilder filter) { 16.99 QueryModelNode parent = expr.getParentNode(); 16.100 String before = null, 16.101 after = null; 16.102 - 16.103 + 16.104 if ( parent instanceof GeneralDBSqlOr || 16.105 parent instanceof GeneralDBSqlAnd 16.106 - ) { 16.107 + ) { 16.108 before = " CAST("; 16.109 after= " AS boolean) "; 16.110 } 16.111 - 16.112 + 16.113 if ( before != null ) 16.114 filter.append(before); 16.115 filter.appendNull(); 16.116 if ( after != null ) 16.117 filter.append(after); 16.118 } 16.119 - 16.120 + 16.121 protected void appendWithCastDouble(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) { 16.122 if (var.getRdbmsVar().isResource()) { 16.123 filter.appendNull(); 16.124 @@ -230,7 +233,7 @@ 16.125 filter.append(" AS DOUBLE) "); 16.126 } 16.127 } 16.128 - 16.129 + 16.130 @Override 16.131 protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) { 16.132 if (var.getRdbmsVar().isResource()) { 16.133 @@ -269,29 +272,29 @@ 16.134 } 16.135 16.136 protected void append(GeneralDBSqlAnd expr, GeneralDBSqlExprBuilder filter) 16.137 - throws UnsupportedRdbmsOperatorException 16.138 - { 16.139 + throws UnsupportedRdbmsOperatorException 16.140 + { 16.141 GeneralDBSqlBracketBuilder open = filter.open(); 16.142 dispatch(expr.getLeftArg(), (GeneralDBSqlExprBuilder) open); 16.143 open.and(); 16.144 dispatch(expr.getRightArg(), (GeneralDBSqlExprBuilder) open); 16.145 open.close(); 16.146 - } 16.147 - 16.148 + } 16.149 + 16.150 @Override 16.151 protected void append(GeneralDBSqlIsNull expr, GeneralDBSqlExprBuilder filter) 16.152 - throws UnsupportedRdbmsOperatorException 16.153 - { 16.154 + throws UnsupportedRdbmsOperatorException 16.155 + { 16.156 GeneralDBSqlBracketBuilder open = filter.open(); 16.157 dispatch(expr.getArg(), (GeneralDBSqlExprBuilder) open); 16.158 open.isNull(); 16.159 open.close(); 16.160 - } 16.161 - 16.162 + } 16.163 + 16.164 @Override 16.165 protected void append(GeneralDBSqlNot expr, GeneralDBSqlExprBuilder filter) 16.166 - throws UnsupportedRdbmsOperatorException 16.167 - { 16.168 + throws UnsupportedRdbmsOperatorException 16.169 + { 16.170 if (expr.getArg() instanceof GeneralDBSqlIsNull) { 16.171 GeneralDBSqlBracketBuilder open = filter.open(); 16.172 GeneralDBSqlIsNull arg = (GeneralDBSqlIsNull)expr.getArg(); 16.173 @@ -304,12 +307,12 @@ 16.174 dispatch(expr.getArg(), (GeneralDBSqlExprBuilder) open); 16.175 open.close(); 16.176 } 16.177 - } 16.178 + } 16.179 16.180 @Override 16.181 protected GeneralDBSqlJoinBuilder subJoinAndFilter(GeneralDBSqlJoinBuilder query, GeneralDBFromItem from) 16.182 - throws RdbmsException, UnsupportedRdbmsOperatorException 16.183 - { 16.184 + throws RdbmsException, UnsupportedRdbmsOperatorException 16.185 + { 16.186 if (from instanceof GeneralDBUnionItem) { 16.187 GeneralDBUnionItem union = (GeneralDBUnionItem)from; 16.188 List<String> names = union.getSelectVarNames(); 16.189 @@ -343,14 +346,14 @@ 16.190 dispatch(expr, query.on().and()); 16.191 } 16.192 return query; 16.193 - } 16.194 + } 16.195 16.196 - 16.197 + 16.198 //FIXME my addition from here on 16.199 @Override 16.200 public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr) 16.201 - throws UnsupportedRdbmsOperatorException 16.202 - { 16.203 + throws UnsupportedRdbmsOperatorException 16.204 + { 16.205 if(!(expr instanceof GeneralDBSqlSpatialMetricBinary) 16.206 &&!(expr instanceof GeneralDBSqlSpatialMetricUnary) 16.207 &&!(expr instanceof GeneralDBSqlMathExpr) 16.208 @@ -370,408 +373,435 @@ 16.209 { 16.210 dispatchUnarySqlOperator((UnaryGeneralDBOperator) expr, (MonetDBSqlExprBuilder)query.select); 16.211 } 16.212 - 16.213 + 16.214 //SRID support must be explicitly added! 16.215 return this; 16.216 - } 16.217 + } 16.218 16.219 //Spatial Relationship Functions 16.220 @Override 16.221 protected void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 16.222 - throws UnsupportedRdbmsOperatorException 16.223 - { 16.224 + throws UnsupportedRdbmsOperatorException 16.225 + { 16.226 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.anyInteract); 16.227 -// appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.anyInteract); 16.228 + // appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.anyInteract); 16.229 + } 16.230 + 16.231 + 16.232 + @Override 16.233 + protected void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 16.234 + throws UnsupportedRdbmsOperatorException { 16.235 + appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.anyInteract); 16.236 + 16.237 } 16.238 16.239 @Override 16.240 protected void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter) 16.241 - throws UnsupportedRdbmsOperatorException { 16.242 + throws UnsupportedRdbmsOperatorException { 16.243 16.244 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.contains); 16.245 -// appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.contains); 16.246 + // appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.contains); 16.247 } 16.248 16.249 @Override 16.250 protected void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter) 16.251 - throws UnsupportedRdbmsOperatorException { 16.252 + throws UnsupportedRdbmsOperatorException { 16.253 16.254 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.equals); 16.255 -// appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.inside); 16.256 + // appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.inside); 16.257 } 16.258 16.259 @Override 16.260 protected void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter) 16.261 - throws UnsupportedRdbmsOperatorException { 16.262 + throws UnsupportedRdbmsOperatorException { 16.263 16.264 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.inside); 16.265 -// appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.inside); 16.266 + // appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.inside); 16.267 } 16.268 16.269 @Override 16.270 protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 16.271 - throws UnsupportedRdbmsOperatorException { 16.272 + throws UnsupportedRdbmsOperatorException { 16.273 16.274 appendgeoSPARQLSpatialRelation(expr, filter, SpatialFunctionsMonetDB.ST_Covers); 16.275 } 16.276 16.277 @Override 16.278 protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 16.279 - throws UnsupportedRdbmsOperatorException { 16.280 + throws UnsupportedRdbmsOperatorException { 16.281 16.282 appendgeoSPARQLSpatialRelation(expr, filter, SpatialFunctionsMonetDB.ST_CoveredBy); 16.283 } 16.284 16.285 @Override 16.286 protected void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter) 16.287 - throws UnsupportedRdbmsOperatorException { 16.288 + throws UnsupportedRdbmsOperatorException { 16.289 16.290 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Touches); 16.291 } 16.292 16.293 @Override 16.294 protected void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter) 16.295 - throws UnsupportedRdbmsOperatorException { 16.296 + throws UnsupportedRdbmsOperatorException { 16.297 16.298 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Overlaps); 16.299 } 16.300 16.301 @Override 16.302 protected void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter) 16.303 - throws UnsupportedRdbmsOperatorException { 16.304 + throws UnsupportedRdbmsOperatorException { 16.305 16.306 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Disjoint); 16.307 } 16.308 16.309 @Override 16.310 protected void append(GeneralDBSqlRelate expr, GeneralDBSqlExprBuilder filter) 16.311 - throws UnsupportedRdbmsOperatorException 16.312 - { 16.313 + throws UnsupportedRdbmsOperatorException 16.314 + { 16.315 appendMonetDBSpatialFunctionTriple(expr, filter, SpatialFunctionsMonetDB.ST_Relate); 16.316 + } 16.317 + 16.318 + @Override 16.319 + protected void append(GeneralDBSqlLeft expr, GeneralDBSqlExprBuilder filter) 16.320 + throws UnsupportedRdbmsOperatorException 16.321 + { 16.322 + // FIXME 16.323 + throw new UnsupportedRdbmsOperatorException("left operator not supported in MonetDB"); 16.324 + // appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.left); 16.325 + } 16.326 + 16.327 + @Override 16.328 + protected void append(GeneralDBSqlRight expr, GeneralDBSqlExprBuilder filter) 16.329 + throws UnsupportedRdbmsOperatorException 16.330 + { 16.331 + // FIXME 16.332 + throw new UnsupportedRdbmsOperatorException("right operator not supported in MonetDB"); 16.333 + // appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.right); 16.334 + } 16.335 + 16.336 + @Override 16.337 + protected void append(GeneralDBSqlAbove expr, GeneralDBSqlExprBuilder filter) 16.338 + throws UnsupportedRdbmsOperatorException 16.339 + { 16.340 + // FIXME 16.341 + throw new UnsupportedRdbmsOperatorException("above operator not supported in MonetDB"); 16.342 + // appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.above); 16.343 + } 16.344 + 16.345 + 16.346 + //XXX Careful: These two functions work with the actual geometries in MonetDB!! 16.347 + //The only function in MonetDB that works on mbbs is mbrOverlaps! 16.348 + @Override 16.349 + protected void append(GeneralDBSqlMbbIntersects expr, 16.350 + GeneralDBSqlExprBuilder filter) 16.351 + throws UnsupportedRdbmsOperatorException { 16.352 + appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.anyInteract); 16.353 + 16.354 } 16.355 16.356 @Override 16.357 - protected void append(GeneralDBSqlLeft expr, GeneralDBSqlExprBuilder filter) 16.358 - throws UnsupportedRdbmsOperatorException 16.359 - { 16.360 - // FIXME 16.361 - throw new UnsupportedRdbmsOperatorException("left operator not supported in MonetDB"); 16.362 -// appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.left); 16.363 - } 16.364 - 16.365 - @Override 16.366 - protected void append(GeneralDBSqlRight expr, GeneralDBSqlExprBuilder filter) 16.367 - throws UnsupportedRdbmsOperatorException 16.368 - { 16.369 - // FIXME 16.370 - throw new UnsupportedRdbmsOperatorException("right operator not supported in MonetDB"); 16.371 -// appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.right); 16.372 - } 16.373 - 16.374 - @Override 16.375 - protected void append(GeneralDBSqlAbove expr, GeneralDBSqlExprBuilder filter) 16.376 - throws UnsupportedRdbmsOperatorException 16.377 - { 16.378 - // FIXME 16.379 - throw new UnsupportedRdbmsOperatorException("above operator not supported in MonetDB"); 16.380 -// appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.above); 16.381 + protected void append(GeneralDBSqlMbbEquals expr, 16.382 + GeneralDBSqlExprBuilder filter) 16.383 + throws UnsupportedRdbmsOperatorException { 16.384 + appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.equals); 16.385 + 16.386 } 16.387 16.388 @Override 16.389 protected void append(GeneralDBSqlBelow expr, GeneralDBSqlExprBuilder filter) 16.390 - throws UnsupportedRdbmsOperatorException 16.391 - { 16.392 + throws UnsupportedRdbmsOperatorException 16.393 + { 16.394 // FIXME 16.395 throw new UnsupportedRdbmsOperatorException("below operator not supported in MonetDB"); 16.396 -// appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.above); 16.397 - } 16.398 - 16.399 + // appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsMonetDB.above); 16.400 + } 16.401 + 16.402 //GeoSPARQL - Spatial Relationship Functions 16.403 //Simple Features 16.404 @Override 16.405 protected void append(GeneralDBSqlSF_Contains expr, GeneralDBSqlExprBuilder filter) 16.406 - throws UnsupportedRdbmsOperatorException 16.407 - { 16.408 + throws UnsupportedRdbmsOperatorException 16.409 + { 16.410 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Contains); 16.411 - } 16.412 + } 16.413 16.414 @Override 16.415 protected void append(GeneralDBSqlSF_Crosses expr, GeneralDBSqlExprBuilder filter) 16.416 - throws UnsupportedRdbmsOperatorException 16.417 - { 16.418 + throws UnsupportedRdbmsOperatorException 16.419 + { 16.420 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Crosses); 16.421 - } 16.422 + } 16.423 16.424 @Override 16.425 protected void append(GeneralDBSqlSF_Disjoint expr, GeneralDBSqlExprBuilder filter) 16.426 - throws UnsupportedRdbmsOperatorException 16.427 - { 16.428 + throws UnsupportedRdbmsOperatorException 16.429 + { 16.430 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Disjoint); 16.431 - } 16.432 + } 16.433 16.434 @Override 16.435 protected void append(GeneralDBSqlSF_Equals expr, GeneralDBSqlExprBuilder filter) 16.436 - throws UnsupportedRdbmsOperatorException 16.437 - { 16.438 + throws UnsupportedRdbmsOperatorException 16.439 + { 16.440 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Equals); 16.441 - } 16.442 + } 16.443 16.444 @Override 16.445 protected void append(GeneralDBSqlSF_Intersects expr, GeneralDBSqlExprBuilder filter) 16.446 - throws UnsupportedRdbmsOperatorException 16.447 - { 16.448 + throws UnsupportedRdbmsOperatorException 16.449 + { 16.450 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Intersects); 16.451 - } 16.452 + } 16.453 16.454 @Override 16.455 protected void append(GeneralDBSqlSF_Overlaps expr, GeneralDBSqlExprBuilder filter) 16.456 - throws UnsupportedRdbmsOperatorException 16.457 - { 16.458 + throws UnsupportedRdbmsOperatorException 16.459 + { 16.460 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Overlaps); 16.461 - } 16.462 + } 16.463 16.464 @Override 16.465 protected void append(GeneralDBSqlSF_Touches expr, GeneralDBSqlExprBuilder filter) 16.466 - throws UnsupportedRdbmsOperatorException 16.467 - { 16.468 + throws UnsupportedRdbmsOperatorException 16.469 + { 16.470 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Touches); 16.471 - } 16.472 + } 16.473 16.474 @Override 16.475 protected void append(GeneralDBSqlSF_Within expr, GeneralDBSqlExprBuilder filter) 16.476 - throws UnsupportedRdbmsOperatorException 16.477 - { 16.478 + throws UnsupportedRdbmsOperatorException 16.479 + { 16.480 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.SF_Within); 16.481 - } 16.482 + } 16.483 16.484 //Egenhofer 16.485 @Override 16.486 protected void append(GeneralDBSqlEgenhofer_CoveredBy expr, GeneralDBSqlExprBuilder filter) 16.487 - throws UnsupportedRdbmsOperatorException 16.488 - { 16.489 + throws UnsupportedRdbmsOperatorException 16.490 + { 16.491 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_CoveredBy); 16.492 - } 16.493 - 16.494 + } 16.495 + 16.496 @Override 16.497 protected void append(GeneralDBSqlEgenhofer_Covers expr, GeneralDBSqlExprBuilder filter) 16.498 - throws UnsupportedRdbmsOperatorException 16.499 - { 16.500 + throws UnsupportedRdbmsOperatorException 16.501 + { 16.502 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Covers); 16.503 - } 16.504 - 16.505 + } 16.506 + 16.507 @Override 16.508 protected void append(GeneralDBSqlEgenhofer_Contains expr, GeneralDBSqlExprBuilder filter) 16.509 - throws UnsupportedRdbmsOperatorException 16.510 - { 16.511 + throws UnsupportedRdbmsOperatorException 16.512 + { 16.513 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Contains); 16.514 - } 16.515 - 16.516 + } 16.517 + 16.518 @Override 16.519 protected void append(GeneralDBSqlEgenhofer_Disjoint expr, GeneralDBSqlExprBuilder filter) 16.520 - throws UnsupportedRdbmsOperatorException 16.521 - { 16.522 + throws UnsupportedRdbmsOperatorException 16.523 + { 16.524 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Disjoint); 16.525 - } 16.526 - 16.527 + } 16.528 + 16.529 @Override 16.530 protected void append(GeneralDBSqlEgenhofer_Equals expr, GeneralDBSqlExprBuilder filter) 16.531 - throws UnsupportedRdbmsOperatorException 16.532 - { 16.533 + throws UnsupportedRdbmsOperatorException 16.534 + { 16.535 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Equals); 16.536 - } 16.537 - 16.538 + } 16.539 + 16.540 @Override 16.541 protected void append(GeneralDBSqlEgenhofer_Inside expr, GeneralDBSqlExprBuilder filter) 16.542 - throws UnsupportedRdbmsOperatorException 16.543 - { 16.544 + throws UnsupportedRdbmsOperatorException 16.545 + { 16.546 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Inside); 16.547 - } 16.548 - 16.549 + } 16.550 + 16.551 @Override 16.552 protected void append(GeneralDBSqlEgenhofer_Meet expr, GeneralDBSqlExprBuilder filter) 16.553 - throws UnsupportedRdbmsOperatorException 16.554 - { 16.555 + throws UnsupportedRdbmsOperatorException 16.556 + { 16.557 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Meet); 16.558 - } 16.559 + } 16.560 16.561 @Override 16.562 protected void append(GeneralDBSqlEgenhofer_Overlap expr, GeneralDBSqlExprBuilder filter) 16.563 - throws UnsupportedRdbmsOperatorException 16.564 - { 16.565 + throws UnsupportedRdbmsOperatorException 16.566 + { 16.567 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.EH_Overlap); 16.568 - } 16.569 - 16.570 + } 16.571 + 16.572 //RCC8 16.573 16.574 @Override 16.575 protected void append(GeneralDBSqlRCC8_Dc expr, GeneralDBSqlExprBuilder filter) 16.576 - throws UnsupportedRdbmsOperatorException 16.577 - { 16.578 + throws UnsupportedRdbmsOperatorException 16.579 + { 16.580 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Dc); 16.581 - } 16.582 + } 16.583 16.584 @Override 16.585 protected void append(GeneralDBSqlRCC8_Eq expr, GeneralDBSqlExprBuilder filter) 16.586 - throws UnsupportedRdbmsOperatorException 16.587 - { 16.588 + throws UnsupportedRdbmsOperatorException 16.589 + { 16.590 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Eq); 16.591 - } 16.592 + } 16.593 16.594 @Override 16.595 protected void append(GeneralDBSqlRCC8_Ec expr, GeneralDBSqlExprBuilder filter) 16.596 - throws UnsupportedRdbmsOperatorException 16.597 - { 16.598 + throws UnsupportedRdbmsOperatorException 16.599 + { 16.600 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Ec); 16.601 - } 16.602 + } 16.603 16.604 @Override 16.605 protected void append(GeneralDBSqlRCC8_Po expr, GeneralDBSqlExprBuilder filter) 16.606 - throws UnsupportedRdbmsOperatorException 16.607 - { 16.608 + throws UnsupportedRdbmsOperatorException 16.609 + { 16.610 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Po); 16.611 - } 16.612 + } 16.613 16.614 @Override 16.615 protected void append(GeneralDBSqlRCC8_Tppi expr, GeneralDBSqlExprBuilder filter) 16.616 - throws UnsupportedRdbmsOperatorException 16.617 - { 16.618 + throws UnsupportedRdbmsOperatorException 16.619 + { 16.620 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Tppi); 16.621 - } 16.622 + } 16.623 16.624 @Override 16.625 protected void append(GeneralDBSqlRCC8_Tpp expr, GeneralDBSqlExprBuilder filter) 16.626 - throws UnsupportedRdbmsOperatorException 16.627 - { 16.628 + throws UnsupportedRdbmsOperatorException 16.629 + { 16.630 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Tpp); 16.631 - } 16.632 + } 16.633 16.634 @Override 16.635 protected void append(GeneralDBSqlRCC8_Ntpp expr, GeneralDBSqlExprBuilder filter) 16.636 - throws UnsupportedRdbmsOperatorException 16.637 - { 16.638 + throws UnsupportedRdbmsOperatorException 16.639 + { 16.640 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Ntpp); 16.641 - } 16.642 + } 16.643 16.644 @Override 16.645 protected void append(GeneralDBSqlRCC8_Ntppi expr, GeneralDBSqlExprBuilder filter) 16.646 - throws UnsupportedRdbmsOperatorException 16.647 - { 16.648 + throws UnsupportedRdbmsOperatorException 16.649 + { 16.650 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsMonetDB.RCC8_Ntppi); 16.651 - } 16.652 - 16.653 + } 16.654 + 16.655 //Spatial Construct Functions 16.656 @Override 16.657 protected void append(GeneralDBSqlGeoUnion expr, GeneralDBSqlExprBuilder filter) 16.658 - throws UnsupportedRdbmsOperatorException 16.659 - { 16.660 + throws UnsupportedRdbmsOperatorException 16.661 + { 16.662 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Union); 16.663 - } 16.664 + } 16.665 16.666 @Override 16.667 protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) 16.668 - throws UnsupportedRdbmsOperatorException 16.669 - { 16.670 + throws UnsupportedRdbmsOperatorException 16.671 + { 16.672 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Buffer); 16.673 - } 16.674 - 16.675 + } 16.676 + 16.677 //XXX Different Behavior 16.678 @Override 16.679 protected void append(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) 16.680 - throws UnsupportedRdbmsOperatorException 16.681 - { 16.682 -// appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Transform); 16.683 + throws UnsupportedRdbmsOperatorException 16.684 + { 16.685 + // appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Transform); 16.686 appendTransformFunc(expr, filter); 16.687 - } 16.688 + } 16.689 16.690 @Override 16.691 protected void append(GeneralDBSqlGeoEnvelope expr, GeneralDBSqlExprBuilder filter) 16.692 - throws UnsupportedRdbmsOperatorException 16.693 - { 16.694 + throws UnsupportedRdbmsOperatorException 16.695 + { 16.696 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_Envelope); 16.697 - } 16.698 + } 16.699 16.700 @Override 16.701 protected void append(GeneralDBSqlGeoConvexHull expr, GeneralDBSqlExprBuilder filter) 16.702 - throws UnsupportedRdbmsOperatorException 16.703 - { 16.704 + throws UnsupportedRdbmsOperatorException 16.705 + { 16.706 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_ConvexHull); 16.707 - } 16.708 + } 16.709 16.710 @Override 16.711 protected void append(GeneralDBSqlGeoBoundary expr, GeneralDBSqlExprBuilder filter) 16.712 - throws UnsupportedRdbmsOperatorException 16.713 - { 16.714 + throws UnsupportedRdbmsOperatorException 16.715 + { 16.716 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_Boundary); 16.717 - } 16.718 + } 16.719 16.720 @Override 16.721 protected void append(GeneralDBSqlGeoIntersection expr, GeneralDBSqlExprBuilder filter) 16.722 - throws UnsupportedRdbmsOperatorException 16.723 - { 16.724 + throws UnsupportedRdbmsOperatorException 16.725 + { 16.726 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Intersection); 16.727 - } 16.728 + } 16.729 16.730 @Override 16.731 protected void append(GeneralDBSqlGeoDifference expr, GeneralDBSqlExprBuilder filter) 16.732 - throws UnsupportedRdbmsOperatorException 16.733 - { 16.734 + throws UnsupportedRdbmsOperatorException 16.735 + { 16.736 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Difference); 16.737 - } 16.738 + } 16.739 16.740 @Override 16.741 protected void append(GeneralDBSqlGeoSymDifference expr, GeneralDBSqlExprBuilder filter) 16.742 - throws UnsupportedRdbmsOperatorException 16.743 - { 16.744 + throws UnsupportedRdbmsOperatorException 16.745 + { 16.746 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_SymDifference); 16.747 - } 16.748 + } 16.749 16.750 @Override 16.751 //Spatial Metric Functions 16.752 protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 16.753 - throws UnsupportedRdbmsOperatorException 16.754 - { 16.755 + throws UnsupportedRdbmsOperatorException 16.756 + { 16.757 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Distance); 16.758 - } 16.759 + } 16.760 16.761 @Override 16.762 protected void append(GeneralDBSqlGeoArea expr, GeneralDBSqlExprBuilder filter) 16.763 - throws UnsupportedRdbmsOperatorException 16.764 - { 16.765 + throws UnsupportedRdbmsOperatorException 16.766 + { 16.767 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_Area); 16.768 - } 16.769 + } 16.770 16.771 @Override 16.772 //Spatial Property Functions 16.773 protected void append(GeneralDBSqlGeoDimension expr, GeneralDBSqlExprBuilder filter) 16.774 - throws UnsupportedRdbmsOperatorException 16.775 - { 16.776 + throws UnsupportedRdbmsOperatorException 16.777 + { 16.778 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_Dimension); 16.779 - } 16.780 + } 16.781 16.782 @Override 16.783 protected void append(GeneralDBSqlGeoGeometryType expr, GeneralDBSqlExprBuilder filter) 16.784 - throws UnsupportedRdbmsOperatorException 16.785 - { 16.786 + throws UnsupportedRdbmsOperatorException 16.787 + { 16.788 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_GeometryType); 16.789 - } 16.790 + } 16.791 16.792 @Override 16.793 protected void append(GeneralDBSqlGeoAsText expr, GeneralDBSqlExprBuilder filter) 16.794 - throws UnsupportedRdbmsOperatorException 16.795 - { 16.796 + throws UnsupportedRdbmsOperatorException 16.797 + { 16.798 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_AsText); 16.799 - } 16.800 - 16.801 + } 16.802 + 16.803 @Override 16.804 protected void append(GeneralDBSqlGeoAsGML expr, GeneralDBSqlExprBuilder filter) 16.805 - throws UnsupportedRdbmsOperatorException { 16.806 + throws UnsupportedRdbmsOperatorException { 16.807 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_AsGML); 16.808 } 16.809 16.810 @Override 16.811 protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 16.812 - throws UnsupportedRdbmsOperatorException 16.813 - { 16.814 + throws UnsupportedRdbmsOperatorException 16.815 + { 16.816 // appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_SRID); 16.817 16.818 boolean sridNeeded = true; 16.819 @@ -888,21 +918,21 @@ 16.820 } 16.821 16.822 filter.closeBracket(); 16.823 - } 16.824 + } 16.825 16.826 @Override 16.827 protected void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter) 16.828 - throws UnsupportedRdbmsOperatorException 16.829 - { 16.830 + throws UnsupportedRdbmsOperatorException 16.831 + { 16.832 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_IsSimple); 16.833 - } 16.834 + } 16.835 16.836 @Override 16.837 protected void append(GeneralDBSqlGeoIsEmpty expr, GeneralDBSqlExprBuilder filter) 16.838 - throws UnsupportedRdbmsOperatorException 16.839 - { 16.840 + throws UnsupportedRdbmsOperatorException 16.841 + { 16.842 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_IsEmpty); 16.843 - } 16.844 + } 16.845 16.846 16.847 /** 16.848 @@ -929,8 +959,8 @@ 16.849 16.850 //Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 16.851 protected void appendTransformFunc(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) 16.852 - throws UnsupportedRdbmsOperatorException 16.853 - { 16.854 + throws UnsupportedRdbmsOperatorException 16.855 + { 16.856 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 16.857 boolean sridNeeded = true; 16.858 //XXX Incorporating SRID 16.859 @@ -1067,19 +1097,19 @@ 16.860 filter.append(sridExpr); 16.861 } 16.862 16.863 - } 16.864 - 16.865 - 16.866 + } 16.867 + 16.868 + 16.869 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 16.870 //EXCEPT ST_Transform!!! 16.871 protected void appendMonetDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) 16.872 - throws UnsupportedRdbmsOperatorException 16.873 - { 16.874 + throws UnsupportedRdbmsOperatorException 16.875 + { 16.876 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 16.877 boolean sridNeeded = true; 16.878 //XXX Incorporating SRID 16.879 String sridExpr = null; 16.880 - 16.881 + 16.882 filter.openBracket(); 16.883 16.884 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 16.885 @@ -1090,7 +1120,7 @@ 16.886 } 16.887 else 16.888 { 16.889 - 16.890 + 16.891 GeneralDBSqlExpr tmp = expr; 16.892 if(tmp instanceof GeneralDBSqlSpatialConstructBinary && tmp.getParentNode() == null) 16.893 { 16.894 @@ -1139,8 +1169,8 @@ 16.895 } 16.896 } 16.897 ///// 16.898 - 16.899 - 16.900 + 16.901 + 16.902 switch(func) 16.903 { 16.904 //XXX Careful: ST_Transform support MISSING!!! 16.905 @@ -1227,8 +1257,8 @@ 16.906 else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 16.907 { 16.908 appendWithCastDouble(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.909 -// append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.910 -// appendCastToDouble(filter); 16.911 + // append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.912 + // appendCastToDouble(filter); 16.913 } 16.914 else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 16.915 { 16.916 @@ -1263,16 +1293,16 @@ 16.917 filter.appendComma(); 16.918 filter.append(sridExpr); 16.919 } 16.920 - } 16.921 + } 16.922 16.923 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 16.924 protected void appendMonetDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) 16.925 - throws UnsupportedRdbmsOperatorException 16.926 - { 16.927 + throws UnsupportedRdbmsOperatorException 16.928 + { 16.929 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 16.930 boolean sridNeeded = true; 16.931 String sridExpr = null; 16.932 - 16.933 + 16.934 filter.openBracket(); 16.935 16.936 boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 16.937 @@ -1339,7 +1369,7 @@ 16.938 } 16.939 } 16.940 ///// 16.941 - 16.942 + 16.943 switch(func) 16.944 { 16.945 case ST_Envelope: filter.appendFunction("Envelope"); break; 16.946 @@ -1377,7 +1407,7 @@ 16.947 } 16.948 16.949 filter.closeBracket(); 16.950 -// //SRID Support 16.951 + // //SRID Support 16.952 if(sridNeeded) 16.953 { 16.954 if(expr instanceof GeneralDBSqlSpatialConstructUnary && expr.getParentNode() == null) 16.955 @@ -1398,12 +1428,12 @@ 16.956 filter.appendComma(); 16.957 filter.append(sridExpr); 16.958 } 16.959 - } 16.960 - 16.961 + } 16.962 + 16.963 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 16.964 protected void appendMonetDBSpatialFunctionTriple(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) 16.965 - throws UnsupportedRdbmsOperatorException 16.966 - { 16.967 + throws UnsupportedRdbmsOperatorException 16.968 + { 16.969 filter.openBracket(); 16.970 16.971 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 16.972 @@ -1477,8 +1507,8 @@ 16.973 else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 16.974 { 16.975 appendWithCastDouble(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.976 -// append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.977 -// appendCastToDouble(filter); 16.978 + // append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.979 + // appendCastToDouble(filter); 16.980 } 16.981 else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 16.982 { 16.983 @@ -1503,7 +1533,7 @@ 16.984 } 16.985 else 16.986 { 16.987 - 16.988 + 16.989 if(expr.getThirdArg() instanceof GeneralDBStringValue) 16.990 { 16.991 append(((GeneralDBStringValue)expr.getThirdArg()),filter); 16.992 @@ -1515,24 +1545,24 @@ 16.993 //case met in buffer when in select -> buffer(?spatial,?thematic) 16.994 else if(expr.getThirdArg() instanceof GeneralDBLabelColumn )//&& !((GeneralDBLabelColumn)expr.getThirdArg()).isSpatial()) 16.995 { 16.996 - 16.997 + 16.998 append(((GeneralDBLabelColumn)expr.getThirdArg()),filter); 16.999 } 16.1000 - 16.1001 + 16.1002 16.1003 } 16.1004 filter.closeBracket(); 16.1005 } 16.1006 16.1007 filter.closeBracket(); 16.1008 - } 16.1009 - 16.1010 + } 16.1011 + 16.1012 //GeoSPARQL 16.1013 //XXX 16.1014 - 16.1015 + 16.1016 protected void appendRelate(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, char[] intersectionPattern) 16.1017 - throws UnsupportedRdbmsOperatorException 16.1018 - { 16.1019 + throws UnsupportedRdbmsOperatorException 16.1020 + { 16.1021 filter.openBracket(); 16.1022 16.1023 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.GeneralDBSqlNull"); 16.1024 @@ -1605,8 +1635,8 @@ 16.1025 else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 16.1026 { 16.1027 appendWithCastDouble(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.1028 -// append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.1029 -// appendCastToDouble(filter); 16.1030 + // append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 16.1031 + // appendCastToDouble(filter); 16.1032 } 16.1033 else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 16.1034 { 16.1035 @@ -1637,12 +1667,12 @@ 16.1036 } 16.1037 16.1038 filter.closeBracket(); 16.1039 - } 16.1040 - 16.1041 - 16.1042 + } 16.1043 + 16.1044 + 16.1045 protected void appendgeoSPARQLSpatialRelation(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) 16.1046 - throws UnsupportedRdbmsOperatorException 16.1047 - { 16.1048 + throws UnsupportedRdbmsOperatorException 16.1049 + { 16.1050 filter.openBracket(); 16.1051 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.GeneralDBSqlNull"); 16.1052 if(check1) 16.1053 @@ -2041,5 +2071,6 @@ 16.1054 // filter.closeBracket(); 16.1055 } 16.1056 filter.closeBracket(); 16.1057 - } 16.1058 + } 16.1059 + 16.1060 } 16.1061 \ No newline at end of file
17.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Thu Jul 12 14:23:48 2012 +0300 17.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Thu Jul 12 15:53:34 2012 +0300 17.3 @@ -42,9 +42,12 @@ 17.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 17.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 17.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 17.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 17.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 17.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 17.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 17.11 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 17.12 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 17.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 17.14 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 17.15 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 17.16 @@ -126,7 +129,7 @@ 17.17 ST_Intersects, 17.18 ST_Equals, 17.19 ST_Relate, 17.20 - 17.21 + 17.22 //Spatial Constructs - Binary 17.23 ST_Union, 17.24 ST_Intersection, 17.25 @@ -134,18 +137,18 @@ 17.26 ST_Buffer, 17.27 ST_Transform, 17.28 ST_SymDifference, 17.29 - 17.30 + 17.31 //Spatial Constructs - Unary 17.32 ST_Envelope, 17.33 ST_ConvexHull, 17.34 ST_Boundary, 17.35 - 17.36 + 17.37 //Spatial Metrics - Binary 17.38 ST_Distance, 17.39 - 17.40 + 17.41 //Spatial Metrics - Unary 17.42 ST_Area, 17.43 - 17.44 + 17.45 //Spatial Properties - All Unary 17.46 ST_Dimension, 17.47 ST_GeometryType, 17.48 @@ -154,7 +157,7 @@ 17.49 ST_SRID, 17.50 ST_IsEmpty, 17.51 ST_IsSimple, 17.52 - 17.53 + 17.54 //GeoSPARQL 17.55 //Simple Features 17.56 SF_Equals, 17.57 @@ -165,7 +168,7 @@ 17.58 SF_Contains, 17.59 SF_Overlaps, 17.60 SF_Crosses, 17.61 - 17.62 + 17.63 //RCC8 17.64 RCC8_Eq, 17.65 RCC8_Dc, 17.66 @@ -175,7 +178,7 @@ 17.67 RCC8_Tpp, 17.68 RCC8_Ntppi, 17.69 RCC8_Ntpp, 17.70 - 17.71 + 17.72 //Egenhofer 17.73 EH_Equals, 17.74 EH_Disjoint, 17.75 @@ -204,16 +207,16 @@ 17.76 17.77 @Override 17.78 protected void append(GeneralDBSqlIsNull expr, GeneralDBSqlExprBuilder filter) 17.79 - throws UnsupportedRdbmsOperatorException 17.80 - { 17.81 + throws UnsupportedRdbmsOperatorException 17.82 + { 17.83 dispatch(expr.getArg(), filter); 17.84 filter.isNull(); 17.85 - } 17.86 + } 17.87 17.88 @Override 17.89 protected void append(GeneralDBSqlNot expr, GeneralDBSqlExprBuilder filter) 17.90 - throws UnsupportedRdbmsOperatorException 17.91 - { 17.92 + throws UnsupportedRdbmsOperatorException 17.93 + { 17.94 if (expr.getArg() instanceof GeneralDBSqlIsNull) { 17.95 GeneralDBSqlIsNull arg = (GeneralDBSqlIsNull)expr.getArg(); 17.96 dispatch(arg.getArg(), filter); 17.97 @@ -224,7 +227,7 @@ 17.98 dispatch(expr.getArg(), (GeneralDBSqlExprBuilder) open); 17.99 open.close(); 17.100 } 17.101 - } 17.102 + } 17.103 17.104 @Override 17.105 protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) { 17.106 @@ -266,16 +269,16 @@ 17.107 17.108 @Override 17.109 protected void append(GeneralDBSqlAnd expr, GeneralDBSqlExprBuilder filter) 17.110 - throws UnsupportedRdbmsOperatorException 17.111 - { 17.112 + throws UnsupportedRdbmsOperatorException 17.113 + { 17.114 dispatch(expr.getLeftArg(), filter); 17.115 filter.and(); 17.116 dispatch(expr.getRightArg(), filter); 17.117 - } 17.118 + } 17.119 17.120 protected GeneralDBSqlJoinBuilder subJoinAndFilter(GeneralDBSqlJoinBuilder query, GeneralDBFromItem from) 17.121 - throws RdbmsException, UnsupportedRdbmsOperatorException 17.122 - { 17.123 + throws RdbmsException, UnsupportedRdbmsOperatorException 17.124 + { 17.125 if (from instanceof GeneralDBUnionItem) { 17.126 GeneralDBUnionItem union = (GeneralDBUnionItem)from; 17.127 List<String> names = union.getSelectVarNames(); 17.128 @@ -307,7 +310,7 @@ 17.129 dispatch(expr, query.on().and()); 17.130 } 17.131 return query; 17.132 - } 17.133 + } 17.134 17.135 //FIXME my addition from here on 17.136 17.137 @@ -343,382 +346,401 @@ 17.138 //Spatial Relationship Functions 17.139 @Override 17.140 protected void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 17.141 - throws UnsupportedRdbmsOperatorException 17.142 - { 17.143 + throws UnsupportedRdbmsOperatorException 17.144 + { 17.145 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersects); 17.146 + } 17.147 + 17.148 + 17.149 + @Override 17.150 + protected void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 17.151 + throws UnsupportedRdbmsOperatorException { 17.152 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersects); 17.153 } 17.154 17.155 @Override 17.156 protected void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter) 17.157 - throws UnsupportedRdbmsOperatorException { 17.158 + throws UnsupportedRdbmsOperatorException { 17.159 17.160 appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.contains); 17.161 } 17.162 17.163 @Override 17.164 protected void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter) 17.165 - throws UnsupportedRdbmsOperatorException { 17.166 + throws UnsupportedRdbmsOperatorException { 17.167 17.168 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Equals); 17.169 } 17.170 17.171 @Override 17.172 protected void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter) 17.173 - throws UnsupportedRdbmsOperatorException { 17.174 + throws UnsupportedRdbmsOperatorException { 17.175 17.176 appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.inside); 17.177 } 17.178 17.179 @Override 17.180 protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 17.181 - throws UnsupportedRdbmsOperatorException { 17.182 + throws UnsupportedRdbmsOperatorException { 17.183 17.184 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Covers); 17.185 } 17.186 17.187 @Override 17.188 protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 17.189 - throws UnsupportedRdbmsOperatorException { 17.190 + throws UnsupportedRdbmsOperatorException { 17.191 17.192 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_CoveredBy); 17.193 } 17.194 17.195 @Override 17.196 protected void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter) 17.197 - throws UnsupportedRdbmsOperatorException { 17.198 + throws UnsupportedRdbmsOperatorException { 17.199 17.200 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Touches); 17.201 } 17.202 17.203 @Override 17.204 protected void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter) 17.205 - throws UnsupportedRdbmsOperatorException { 17.206 + throws UnsupportedRdbmsOperatorException { 17.207 17.208 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Overlaps); 17.209 } 17.210 17.211 @Override 17.212 protected void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter) 17.213 - throws UnsupportedRdbmsOperatorException { 17.214 + throws UnsupportedRdbmsOperatorException { 17.215 17.216 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Disjoint); 17.217 } 17.218 17.219 @Override 17.220 protected void append(GeneralDBSqlRelate expr, GeneralDBSqlExprBuilder filter) 17.221 - throws UnsupportedRdbmsOperatorException 17.222 - { 17.223 + throws UnsupportedRdbmsOperatorException 17.224 + { 17.225 appendGeneralDBSpatialFunctionTriple(expr, filter, SpatialFunctionsPostGIS.ST_Relate); 17.226 - } 17.227 + } 17.228 17.229 @Override 17.230 protected void append(GeneralDBSqlLeft expr, GeneralDBSqlExprBuilder filter) 17.231 - throws UnsupportedRdbmsOperatorException 17.232 - { 17.233 + throws UnsupportedRdbmsOperatorException 17.234 + { 17.235 appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.left); 17.236 + } 17.237 + 17.238 + @Override 17.239 + protected void append(GeneralDBSqlRight expr, GeneralDBSqlExprBuilder filter) 17.240 + throws UnsupportedRdbmsOperatorException 17.241 + { 17.242 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.right); 17.243 + } 17.244 + 17.245 + @Override 17.246 + protected void append(GeneralDBSqlAbove expr, GeneralDBSqlExprBuilder filter) 17.247 + throws UnsupportedRdbmsOperatorException 17.248 + { 17.249 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.above); 17.250 + } 17.251 + 17.252 + @Override 17.253 + protected void append(GeneralDBSqlBelow expr, GeneralDBSqlExprBuilder filter) 17.254 + throws UnsupportedRdbmsOperatorException 17.255 + { 17.256 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.below); 17.257 + } 17.258 + 17.259 + @Override 17.260 + protected void append(GeneralDBSqlMbbIntersects expr, GeneralDBSqlExprBuilder filter) 17.261 + throws UnsupportedRdbmsOperatorException { 17.262 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.anyInteract); 17.263 } 17.264 17.265 @Override 17.266 - protected void append(GeneralDBSqlRight expr, GeneralDBSqlExprBuilder filter) 17.267 - throws UnsupportedRdbmsOperatorException 17.268 - { 17.269 - appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.right); 17.270 - } 17.271 - 17.272 - @Override 17.273 - protected void append(GeneralDBSqlAbove expr, GeneralDBSqlExprBuilder filter) 17.274 - throws UnsupportedRdbmsOperatorException 17.275 - { 17.276 - appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.above); 17.277 - } 17.278 - 17.279 - @Override 17.280 - protected void append(GeneralDBSqlBelow expr, GeneralDBSqlExprBuilder filter) 17.281 - throws UnsupportedRdbmsOperatorException 17.282 - { 17.283 - appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.below); 17.284 + protected void append(GeneralDBSqlMbbEquals expr, GeneralDBSqlExprBuilder filter) 17.285 + throws UnsupportedRdbmsOperatorException { 17.286 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.equals); 17.287 } 17.288 17.289 //GeoSPARQL - Spatial Relationship Functions 17.290 //Simple Features 17.291 @Override 17.292 protected void append(GeneralDBSqlSF_Contains expr, GeneralDBSqlExprBuilder filter) 17.293 - throws UnsupportedRdbmsOperatorException 17.294 - { 17.295 + throws UnsupportedRdbmsOperatorException 17.296 + { 17.297 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Contains); 17.298 - } 17.299 + } 17.300 17.301 @Override 17.302 protected void append(GeneralDBSqlSF_Crosses expr, GeneralDBSqlExprBuilder filter) 17.303 - throws UnsupportedRdbmsOperatorException 17.304 - { 17.305 + throws UnsupportedRdbmsOperatorException 17.306 + { 17.307 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Crosses); 17.308 - } 17.309 + } 17.310 17.311 @Override 17.312 protected void append(GeneralDBSqlSF_Disjoint expr, GeneralDBSqlExprBuilder filter) 17.313 - throws UnsupportedRdbmsOperatorException 17.314 - { 17.315 + throws UnsupportedRdbmsOperatorException 17.316 + { 17.317 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Disjoint); 17.318 - } 17.319 + } 17.320 17.321 @Override 17.322 protected void append(GeneralDBSqlSF_Equals expr, GeneralDBSqlExprBuilder filter) 17.323 - throws UnsupportedRdbmsOperatorException 17.324 - { 17.325 + throws UnsupportedRdbmsOperatorException 17.326 + { 17.327 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Equals); 17.328 - } 17.329 + } 17.330 17.331 @Override 17.332 protected void append(GeneralDBSqlSF_Intersects expr, GeneralDBSqlExprBuilder filter) 17.333 - throws UnsupportedRdbmsOperatorException 17.334 - { 17.335 + throws UnsupportedRdbmsOperatorException 17.336 + { 17.337 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Intersects); 17.338 - } 17.339 + } 17.340 17.341 @Override 17.342 protected void append(GeneralDBSqlSF_Overlaps expr, GeneralDBSqlExprBuilder filter) 17.343 - throws UnsupportedRdbmsOperatorException 17.344 - { 17.345 + throws UnsupportedRdbmsOperatorException 17.346 + { 17.347 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Overlaps); 17.348 - } 17.349 + } 17.350 17.351 @Override 17.352 protected void append(GeneralDBSqlSF_Touches expr, GeneralDBSqlExprBuilder filter) 17.353 - throws UnsupportedRdbmsOperatorException 17.354 - { 17.355 + throws UnsupportedRdbmsOperatorException 17.356 + { 17.357 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Touches); 17.358 - } 17.359 + } 17.360 17.361 @Override 17.362 protected void append(GeneralDBSqlSF_Within expr, GeneralDBSqlExprBuilder filter) 17.363 - throws UnsupportedRdbmsOperatorException 17.364 - { 17.365 + throws UnsupportedRdbmsOperatorException 17.366 + { 17.367 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Within); 17.368 - } 17.369 + } 17.370 17.371 //Egenhofer 17.372 @Override 17.373 protected void append(GeneralDBSqlEgenhofer_CoveredBy expr, GeneralDBSqlExprBuilder filter) 17.374 - throws UnsupportedRdbmsOperatorException 17.375 - { 17.376 + throws UnsupportedRdbmsOperatorException 17.377 + { 17.378 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_CoveredBy); 17.379 - } 17.380 + } 17.381 17.382 @Override 17.383 protected void append(GeneralDBSqlEgenhofer_Covers expr, GeneralDBSqlExprBuilder filter) 17.384 - throws UnsupportedRdbmsOperatorException 17.385 - { 17.386 + throws UnsupportedRdbmsOperatorException 17.387 + { 17.388 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Covers); 17.389 - } 17.390 + } 17.391 17.392 @Override 17.393 protected void append(GeneralDBSqlEgenhofer_Contains expr, GeneralDBSqlExprBuilder filter) 17.394 - throws UnsupportedRdbmsOperatorException 17.395 - { 17.396 + throws UnsupportedRdbmsOperatorException 17.397 + { 17.398 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Contains); 17.399 - } 17.400 + } 17.401 17.402 @Override 17.403 protected void append(GeneralDBSqlEgenhofer_Disjoint expr, GeneralDBSqlExprBuilder filter) 17.404 - throws UnsupportedRdbmsOperatorException 17.405 - { 17.406 + throws UnsupportedRdbmsOperatorException 17.407 + { 17.408 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Disjoint); 17.409 - } 17.410 + } 17.411 17.412 @Override 17.413 protected void append(GeneralDBSqlEgenhofer_Equals expr, GeneralDBSqlExprBuilder filter) 17.414 - throws UnsupportedRdbmsOperatorException 17.415 - { 17.416 + throws UnsupportedRdbmsOperatorException 17.417 + { 17.418 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Equals); 17.419 - } 17.420 + } 17.421 17.422 @Override 17.423 protected void append(GeneralDBSqlEgenhofer_Inside expr, GeneralDBSqlExprBuilder filter) 17.424 - throws UnsupportedRdbmsOperatorException 17.425 - { 17.426 + throws UnsupportedRdbmsOperatorException 17.427 + { 17.428 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Inside); 17.429 - } 17.430 + } 17.431 17.432 @Override 17.433 protected void append(GeneralDBSqlEgenhofer_Meet expr, GeneralDBSqlExprBuilder filter) 17.434 - throws UnsupportedRdbmsOperatorException 17.435 - { 17.436 + throws UnsupportedRdbmsOperatorException 17.437 + { 17.438 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Meet); 17.439 - } 17.440 + } 17.441 17.442 @Override 17.443 protected void append(GeneralDBSqlEgenhofer_Overlap expr, GeneralDBSqlExprBuilder filter) 17.444 - throws UnsupportedRdbmsOperatorException 17.445 - { 17.446 + throws UnsupportedRdbmsOperatorException 17.447 + { 17.448 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Overlap); 17.449 - } 17.450 + } 17.451 17.452 //RCC8 17.453 @Override 17.454 protected void append(GeneralDBSqlRCC8_Dc expr, GeneralDBSqlExprBuilder filter) 17.455 - throws UnsupportedRdbmsOperatorException 17.456 - { 17.457 + throws UnsupportedRdbmsOperatorException 17.458 + { 17.459 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Dc); 17.460 - } 17.461 + } 17.462 17.463 @Override 17.464 protected void append(GeneralDBSqlRCC8_Eq expr, GeneralDBSqlExprBuilder filter) 17.465 - throws UnsupportedRdbmsOperatorException 17.466 - { 17.467 + throws UnsupportedRdbmsOperatorException 17.468 + { 17.469 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Eq); 17.470 - } 17.471 + } 17.472 17.473 @Override 17.474 protected void append(GeneralDBSqlRCC8_Ec expr, GeneralDBSqlExprBuilder filter) 17.475 - throws UnsupportedRdbmsOperatorException 17.476 - { 17.477 + throws UnsupportedRdbmsOperatorException 17.478 + { 17.479 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ec); 17.480 - } 17.481 + } 17.482 17.483 @Override 17.484 protected void append(GeneralDBSqlRCC8_Po expr, GeneralDBSqlExprBuilder filter) 17.485 - throws UnsupportedRdbmsOperatorException 17.486 - { 17.487 + throws UnsupportedRdbmsOperatorException 17.488 + { 17.489 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Po); 17.490 - } 17.491 + } 17.492 17.493 @Override 17.494 protected void append(GeneralDBSqlRCC8_Tppi expr, GeneralDBSqlExprBuilder filter) 17.495 - throws UnsupportedRdbmsOperatorException 17.496 - { 17.497 + throws UnsupportedRdbmsOperatorException 17.498 + { 17.499 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Tppi); 17.500 - } 17.501 + } 17.502 17.503 @Override 17.504 protected void append(GeneralDBSqlRCC8_Tpp expr, GeneralDBSqlExprBuilder filter) 17.505 - throws UnsupportedRdbmsOperatorException 17.506 - { 17.507 + throws UnsupportedRdbmsOperatorException 17.508 + { 17.509 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Tpp); 17.510 - } 17.511 + } 17.512 17.513 @Override 17.514 protected void append(GeneralDBSqlRCC8_Ntpp expr, GeneralDBSqlExprBuilder filter) 17.515 - throws UnsupportedRdbmsOperatorException 17.516 - { 17.517 + throws UnsupportedRdbmsOperatorException 17.518 + { 17.519 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ntpp); 17.520 - } 17.521 + } 17.522 17.523 @Override 17.524 protected void append(GeneralDBSqlRCC8_Ntppi expr, GeneralDBSqlExprBuilder filter) 17.525 - throws UnsupportedRdbmsOperatorException 17.526 - { 17.527 + throws UnsupportedRdbmsOperatorException 17.528 + { 17.529 appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ntppi); 17.530 - } 17.531 + } 17.532 17.533 //Spatial Construct Functions 17.534 @Override 17.535 protected void append(GeneralDBSqlGeoUnion expr, GeneralDBSqlExprBuilder filter) 17.536 - throws UnsupportedRdbmsOperatorException 17.537 - { 17.538 + throws UnsupportedRdbmsOperatorException 17.539 + { 17.540 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Union); 17.541 - } 17.542 + } 17.543 17.544 @Override 17.545 protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) 17.546 - throws UnsupportedRdbmsOperatorException 17.547 - { 17.548 + throws UnsupportedRdbmsOperatorException 17.549 + { 17.550 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Buffer); 17.551 - } 17.552 + } 17.553 17.554 //XXX Different Behavior 17.555 @Override 17.556 protected void append(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) 17.557 - throws UnsupportedRdbmsOperatorException 17.558 - { 17.559 + throws UnsupportedRdbmsOperatorException 17.560 + { 17.561 appendTransformFunc(expr, filter); 17.562 - } 17.563 + } 17.564 17.565 @Override 17.566 protected void append(GeneralDBSqlGeoEnvelope expr, GeneralDBSqlExprBuilder filter) 17.567 - throws UnsupportedRdbmsOperatorException 17.568 - { 17.569 + throws UnsupportedRdbmsOperatorException 17.570 + { 17.571 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Envelope); 17.572 - } 17.573 + } 17.574 17.575 @Override 17.576 protected void append(GeneralDBSqlGeoConvexHull expr, GeneralDBSqlExprBuilder filter) 17.577 - throws UnsupportedRdbmsOperatorException 17.578 - { 17.579 + throws UnsupportedRdbmsOperatorException 17.580 + { 17.581 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_ConvexHull); 17.582 - } 17.583 + } 17.584 17.585 @Override 17.586 protected void append(GeneralDBSqlGeoBoundary expr, GeneralDBSqlExprBuilder filter) 17.587 - throws UnsupportedRdbmsOperatorException 17.588 - { 17.589 + throws UnsupportedRdbmsOperatorException 17.590 + { 17.591 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Boundary); 17.592 - } 17.593 + } 17.594 17.595 @Override 17.596 protected void append(GeneralDBSqlGeoIntersection expr, GeneralDBSqlExprBuilder filter) 17.597 - throws UnsupportedRdbmsOperatorException 17.598 - { 17.599 + throws UnsupportedRdbmsOperatorException 17.600 + { 17.601 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersection); 17.602 - } 17.603 + } 17.604 17.605 @Override 17.606 protected void append(GeneralDBSqlGeoDifference expr, GeneralDBSqlExprBuilder filter) 17.607 - throws UnsupportedRdbmsOperatorException 17.608 - { 17.609 + throws UnsupportedRdbmsOperatorException 17.610 + { 17.611 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Difference); 17.612 - } 17.613 + } 17.614 17.615 @Override 17.616 protected void append(GeneralDBSqlGeoSymDifference expr, GeneralDBSqlExprBuilder filter) 17.617 - throws UnsupportedRdbmsOperatorException 17.618 - { 17.619 + throws UnsupportedRdbmsOperatorException 17.620 + { 17.621 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_SymDifference); 17.622 - } 17.623 + } 17.624 17.625 //Spatial Metric Functions 17.626 @Override 17.627 protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 17.628 - throws UnsupportedRdbmsOperatorException 17.629 - { 17.630 + throws UnsupportedRdbmsOperatorException 17.631 + { 17.632 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Distance); 17.633 - } 17.634 + } 17.635 17.636 @Override 17.637 protected void append(GeneralDBSqlGeoArea expr, GeneralDBSqlExprBuilder filter) 17.638 - throws UnsupportedRdbmsOperatorException 17.639 - { 17.640 + throws UnsupportedRdbmsOperatorException 17.641 + { 17.642 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Area); 17.643 - } 17.644 + } 17.645 17.646 //Spatial Property Functions 17.647 @Override 17.648 protected void append(GeneralDBSqlGeoDimension expr, GeneralDBSqlExprBuilder filter) 17.649 - throws UnsupportedRdbmsOperatorException 17.650 - { 17.651 + throws UnsupportedRdbmsOperatorException 17.652 + { 17.653 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Dimension); 17.654 - } 17.655 + } 17.656 17.657 @Override 17.658 protected void append(GeneralDBSqlGeoGeometryType expr, GeneralDBSqlExprBuilder filter) 17.659 - throws UnsupportedRdbmsOperatorException 17.660 - { 17.661 + throws UnsupportedRdbmsOperatorException 17.662 + { 17.663 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_GeometryType); 17.664 - } 17.665 + } 17.666 17.667 @Override 17.668 protected void append(GeneralDBSqlGeoAsText expr, GeneralDBSqlExprBuilder filter) 17.669 - throws UnsupportedRdbmsOperatorException 17.670 - { 17.671 + throws UnsupportedRdbmsOperatorException 17.672 + { 17.673 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_AsText); 17.674 - } 17.675 - 17.676 + } 17.677 + 17.678 @Override 17.679 protected void append(GeneralDBSqlGeoAsGML expr, GeneralDBSqlExprBuilder filter) 17.680 - throws UnsupportedRdbmsOperatorException 17.681 - { 17.682 + throws UnsupportedRdbmsOperatorException 17.683 + { 17.684 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_AsGML); 17.685 - } 17.686 + } 17.687 17.688 // @Override 17.689 // protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 17.690 @@ -733,8 +755,8 @@ 17.691 */ 17.692 @Override 17.693 protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 17.694 - throws UnsupportedRdbmsOperatorException 17.695 - { 17.696 + throws UnsupportedRdbmsOperatorException 17.697 + { 17.698 boolean sridNeeded = true; 17.699 filter.openBracket(); 17.700 17.701 @@ -849,21 +871,21 @@ 17.702 } 17.703 17.704 filter.closeBracket(); 17.705 - } 17.706 + } 17.707 17.708 @Override 17.709 protected void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter) 17.710 - throws UnsupportedRdbmsOperatorException 17.711 - { 17.712 + throws UnsupportedRdbmsOperatorException 17.713 + { 17.714 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_IsSimple); 17.715 - } 17.716 + } 17.717 17.718 @Override 17.719 protected void append(GeneralDBSqlGeoIsEmpty expr, GeneralDBSqlExprBuilder filter) 17.720 - throws UnsupportedRdbmsOperatorException 17.721 - { 17.722 + throws UnsupportedRdbmsOperatorException 17.723 + { 17.724 appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_IsEmpty); 17.725 - } 17.726 + } 17.727 17.728 17.729 /** 17.730 @@ -1017,14 +1039,14 @@ 17.731 17.732 switch(operand) 17.733 { 17.734 - case anyInteract: filter.anyInteract(); break; 17.735 - case equals: filter.equals(); break; 17.736 - case contains: filter.contains(); break; 17.737 - case inside: filter.inside(); break; 17.738 - case left: filter.left(); break; 17.739 - case right: filter.right(); break; 17.740 - case above: filter.above(); break; 17.741 - case below: filter.below(); break; 17.742 + case anyInteract: filter.intersectsMBB(); break; 17.743 + case equals: filter.equalsMBB(); break; 17.744 + case contains: filter.containsMBB(); break; 17.745 + case inside: filter.insideMBB(); break; 17.746 + case left: filter.leftMBB(); break; 17.747 + case right: filter.rightMBB(); break; 17.748 + case above: filter.aboveMBB(); break; 17.749 + case below: filter.belowMBB(); break; 17.750 } 17.751 17.752 // boolean check2a = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 17.753 @@ -1064,8 +1086,8 @@ 17.754 17.755 //Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 17.756 protected void appendTransformFunc(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) 17.757 - throws UnsupportedRdbmsOperatorException 17.758 - { 17.759 + throws UnsupportedRdbmsOperatorException 17.760 + { 17.761 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 17.762 boolean sridNeeded = true; 17.763 //XXX Incorporating SRID 17.764 @@ -1202,15 +1224,15 @@ 17.765 filter.append(sridExpr); 17.766 } 17.767 17.768 - } 17.769 + } 17.770 17.771 17.772 17.773 //Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 17.774 //EXCEPT ST_Transform!!! 17.775 protected void appendGeneralDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 17.776 - throws UnsupportedRdbmsOperatorException 17.777 - { 17.778 + throws UnsupportedRdbmsOperatorException 17.779 + { 17.780 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 17.781 boolean sridNeeded = true; 17.782 //XXX Incorporating SRID 17.783 @@ -1398,12 +1420,12 @@ 17.784 filter.append(sridExpr); 17.785 } 17.786 17.787 - } 17.788 + } 17.789 17.790 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 17.791 protected void appendGeneralDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 17.792 - throws UnsupportedRdbmsOperatorException 17.793 - { 17.794 + throws UnsupportedRdbmsOperatorException 17.795 + { 17.796 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 17.797 boolean sridNeeded = true; 17.798 String sridExpr = null; 17.799 @@ -1525,7 +1547,7 @@ 17.800 } 17.801 17.802 filter.closeBracket(); 17.803 -// //SRID Support 17.804 + // //SRID Support 17.805 if(sridNeeded) 17.806 { 17.807 if(expr instanceof GeneralDBSqlSpatialConstructUnary && expr.getParentNode() == null) 17.808 @@ -1546,12 +1568,12 @@ 17.809 filter.appendComma(); 17.810 filter.append(sridExpr); 17.811 } 17.812 - } 17.813 + } 17.814 17.815 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 17.816 protected void appendGeneralDBSpatialFunctionTriple(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 17.817 - throws UnsupportedRdbmsOperatorException 17.818 - { 17.819 + throws UnsupportedRdbmsOperatorException 17.820 + { 17.821 filter.openBracket(); 17.822 17.823 boolean check1a = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 17.824 @@ -1683,14 +1705,14 @@ 17.825 } 17.826 17.827 filter.closeBracket(); 17.828 - } 17.829 + } 17.830 17.831 17.832 //GeoSPARQL 17.833 //XXX 17.834 protected void appendRelate(BinaryGeneralDBOperator expr, PostGISSqlExprBuilder filter, char[] intersectionPattern) 17.835 - throws UnsupportedRdbmsOperatorException 17.836 - { 17.837 + throws UnsupportedRdbmsOperatorException 17.838 + { 17.839 filter.openBracket(); 17.840 17.841 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 17.842 @@ -1794,12 +1816,12 @@ 17.843 } 17.844 17.845 filter.closeBracket(); 17.846 - } 17.847 + } 17.848 17.849 17.850 protected void appendgeoSPARQLSpatialRelation(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 17.851 - throws UnsupportedRdbmsOperatorException 17.852 - { 17.853 + throws UnsupportedRdbmsOperatorException 17.854 + { 17.855 filter.openBracket(); 17.856 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 17.857 if(check1) 17.858 @@ -2141,15 +2163,15 @@ 17.859 } 17.860 } 17.861 filter.closeBracket(); 17.862 - } 17.863 + } 17.864 17.865 @Override 17.866 //GeoSPARQL 17.867 //XXX 17.868 17.869 protected void appendRelate(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, char[] intersectionPattern) 17.870 - throws UnsupportedRdbmsOperatorException 17.871 - { 17.872 + throws UnsupportedRdbmsOperatorException 17.873 + { 17.874 filter.openBracket(); 17.875 System.out.println(expr.getLeftArg().getClass().getCanonicalName()); 17.876 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 17.877 @@ -2253,5 +2275,6 @@ 17.878 } 17.879 17.880 filter.closeBracket(); 17.881 - } 17.882 + } 17.883 + 17.884 }