Strabon

changeset 164:b708f04e2555

'Optimized' geosparql - utilizing R-Tree when possible
author Manos Karpathiotakis <mk@di.uoa.gr>
date Fri May 18 15:35:56 2012 +0300 (2012-05-18)
parents 0e40bd909071
children 693894391629 bab8044ab6d3
files postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java
line diff
     1.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri May 18 15:34:48 2012 +0300
     1.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri May 18 15:35:56 2012 +0300
     1.3 @@ -109,7 +109,7 @@
     1.4  	 * Opting to ask for 'null' instead
     1.5  	 */
     1.6  	boolean nullLabel = false;
     1.7 -	
     1.8 +
     1.9  	public enum SpatialOperandsPostGIS { anyInteract, equals, contains, inside, left, right, above, below; }
    1.10  	public enum SpatialFunctionsPostGIS 
    1.11  	{ 	//stSPARQL++
    1.12 @@ -1715,13 +1715,7 @@
    1.13  				appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
    1.14  			}
    1.15  			filter.appendComma();
    1.16 -			//			boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.GeneralDBSqlNull");
    1.17 -			//			if(check2)
    1.18 -			//			{
    1.19 -			//				this.append((GeneralDBSqlNull)expr.getRightArg(), filter);
    1.20 -			//			}
    1.21 -			//			else
    1.22 -			//			{
    1.23 +
    1.24  			if(expr.getRightArg() instanceof GeneralDBStringValue)
    1.25  			{
    1.26  				appendWKT(expr.getRightArg(),filter);
    1.27 @@ -1766,7 +1760,6 @@
    1.28  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
    1.29  			}
    1.30  
    1.31 -			//			}
    1.32  			//3rd arg
    1.33  			filter.appendComma();
    1.34  
    1.35 @@ -1779,6 +1772,7 @@
    1.36  			filter.append("'");
    1.37  
    1.38  			filter.closeBracket();
    1.39 +
    1.40  		}
    1.41  
    1.42  		filter.closeBracket();
    1.43 @@ -2120,10 +2114,13 @@
    1.44  					filter.or();
    1.45  				}
    1.46  			}
    1.47 -			//			filter.appendFunction("ST_Relate");
    1.48 -			//			filter.openBracket();
    1.49 -			//			
    1.50 -			//			filter.closeBracket();
    1.51 +
    1.52 +			//Also need bounding box intersection query to enable the usage of the Gist R-tree index
    1.53 +			if(func != SpatialFunctionsPostGIS.SF_Disjoint && func != SpatialFunctionsPostGIS.EH_Disjoint)
    1.54 +			{
    1.55 +				filter.and();
    1.56 +				appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Intersects);
    1.57 +			}
    1.58  		}
    1.59  		filter.closeBracket();
    1.60  			}