Strabon

changeset 1040:61bc2e9bf304

Avoided converting to geography when the radius of strdf:buffer is 0
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Wed Apr 17 18:56:04 2013 +0300 (2013-04-17)
parents 516d8a0ae1db
children bbba44d70ba5 8495c0c9b597
files monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java
line diff
     1.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Wed Apr 17 14:35:06 2013 +0300
     1.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Wed Apr 17 18:56:04 2013 +0300
     1.3 @@ -1709,23 +1709,23 @@
     1.4  						throw new UnsupportedRdbmsOperatorException("No such unit of measure exists");
     1.5  					}	
     1.6  	
     1.7 -					if(units.equals(OGCConstants.OGCmetre))
     1.8 +					if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
     1.9  					{
    1.10 +						filter.appendFunction("ST_Buffer");
    1.11 +						filter.openBracket();
    1.12 +						filter.appendFunction(ST_TRANSFORM);
    1.13 +						filter.openBracket();		
    1.14 +					}
    1.15 +					else
    1.16 +					{	
    1.17  						filter.appendFunction(GEOMETRY);
    1.18  						filter.openBracket();
    1.19 -						filter.appendFunction("Buffer");			
    1.20 +						filter.appendFunction("ST_Buffer");
    1.21  						filter.openBracket();
    1.22  						filter.appendFunction(GEOGRAPHY);
    1.23  						filter.openBracket();
    1.24  						filter.appendFunction(ST_TRANSFORM);
    1.25  						filter.openBracket();
    1.26 -					}
    1.27 -					else if(units.equals(OGCConstants.OGCdegree))
    1.28 -					{
    1.29 -						filter.appendFunction("Buffer");			
    1.30 -						filter.openBracket();
    1.31 -						filter.appendFunction(ST_TRANSFORM);
    1.32 -						filter.openBracket();
    1.33  					}	
    1.34  				}	
    1.35  				
    1.36 @@ -1757,11 +1757,21 @@
    1.37  
    1.38  				if(units.equals(OGCConstants.OGCmetre))
    1.39  				{
    1.40 -					filter.appendComma();
    1.41 -					filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.42 -					filter.closeBracket(); //close st_transform
    1.43 -					filter.closeBracket(); //close geography
    1.44 -					filter.appendComma();
    1.45 +					if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
    1.46 +					{
    1.47 +						filter.appendComma();
    1.48 +						filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.49 +						filter.closeBracket(); //close st_transform
    1.50 +						filter.appendComma();
    1.51 +					}	
    1.52 +					else
    1.53 +					{	
    1.54 +						filter.appendComma();
    1.55 +						filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.56 +						filter.closeBracket(); //close st_transform
    1.57 +						filter.closeBracket(); //close geography
    1.58 +						filter.appendComma();
    1.59 +					}
    1.60  				}
    1.61  				else if(units.equals(OGCConstants.OGCdegree))
    1.62  				{
    1.63 @@ -1833,7 +1843,7 @@
    1.64  				}
    1.65  				///
    1.66  			}
    1.67 -			if(units.equals(OGCConstants.OGCmetre))
    1.68 +			if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))))
    1.69  				filter.closeBracket(); //close Geometry
    1.70  			filter.closeBracket();
    1.71  			//Used to explicitly include SRID
     2.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Wed Apr 17 14:35:06 2013 +0300
     2.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Wed Apr 17 18:56:04 2013 +0300
     2.3 @@ -1893,18 +1893,28 @@
     2.4  				if(!OGCConstants.supportedUnitsOfMeasure.contains(units))
     2.5  				{
     2.6  					throw new UnsupportedRdbmsOperatorException("No such unit of measure exists");
     2.7 -				}
     2.8 -
     2.9 +				}													
    2.10 +					
    2.11  				if(units.equals(OGCConstants.OGCmetre))
    2.12  				{
    2.13 -					filter.appendFunction(GEOMETRY);
    2.14 -					filter.openBracket();
    2.15 -					filter.appendFunction("ST_Buffer");
    2.16 -					filter.openBracket();
    2.17 -					filter.appendFunction(GEOGRAPHY);
    2.18 -					filter.openBracket();
    2.19 -					filter.appendFunction(ST_TRANSFORM);
    2.20 -					filter.openBracket();
    2.21 +					if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
    2.22 +					{
    2.23 +						filter.appendFunction("ST_Buffer");
    2.24 +						filter.openBracket();
    2.25 +						filter.appendFunction(ST_TRANSFORM);
    2.26 +						filter.openBracket();		
    2.27 +					}
    2.28 +					else
    2.29 +					{	
    2.30 +						filter.appendFunction(GEOMETRY);
    2.31 +						filter.openBracket();
    2.32 +						filter.appendFunction("ST_Buffer");
    2.33 +						filter.openBracket();
    2.34 +						filter.appendFunction(GEOGRAPHY);
    2.35 +						filter.openBracket();
    2.36 +						filter.appendFunction(ST_TRANSFORM);
    2.37 +						filter.openBracket();
    2.38 +					}
    2.39  				}
    2.40  				else if(units.equals(OGCConstants.OGCdegree))
    2.41  				{
    2.42 @@ -1943,11 +1953,21 @@
    2.43  
    2.44  			if(units.equals(OGCConstants.OGCmetre))
    2.45  			{
    2.46 -				filter.appendComma();
    2.47 -				filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.48 -				filter.closeBracket(); //close st_transform
    2.49 -				filter.closeBracket(); //close geography
    2.50 -				filter.appendComma();
    2.51 +				if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
    2.52 +				{
    2.53 +					filter.appendComma();
    2.54 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.55 +					filter.closeBracket(); //close st_transform
    2.56 +					filter.appendComma();
    2.57 +				}	
    2.58 +				else
    2.59 +				{	
    2.60 +					filter.appendComma();
    2.61 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.62 +					filter.closeBracket(); //close st_transform
    2.63 +					filter.closeBracket(); //close geography
    2.64 +					filter.appendComma();
    2.65 +				}
    2.66  			}
    2.67  			else if(units.equals(OGCConstants.OGCdegree))
    2.68  			{
    2.69 @@ -2005,7 +2025,7 @@
    2.70  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
    2.71  			}
    2.72  			
    2.73 -			if(units.equals(OGCConstants.OGCmetre))
    2.74 +			if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))))
    2.75  				filter.closeBracket(); //close Geometry
    2.76  			filter.closeBracket();
    2.77  			//SRID Support