Strabon

changeset 1061:7368a5899fc1

added geof:distance function (same as strdf:distance)
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Mon Apr 22 15:25:11 2013 +0300 (2013-04-22)
parents 7f8023f3b97e
children 2e32beaa5a09
files generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Mon Apr 22 15:23:10 2013 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Mon Apr 22 15:25:11 2013 +0300
     1.3 @@ -1218,8 +1218,7 @@
     1.4  		{
     1.5  			return geoSymDifference(leftArg, rightArg);
     1.6  		}
     1.7 -		//XXX GeoSPARQL - Non topological - except distance
     1.8 -		//TODO Must add buffer after deciding how to implement it
     1.9 +		//XXX GeoSPARQL - Non topological - except distance		
    1.10  		else if(function.getURI().equals(GeoConstants.geoSparqlConvexHull))
    1.11  		{
    1.12  			return geoConvexHull(leftArg);
    1.13 @@ -1280,11 +1279,14 @@
    1.14  		{
    1.15  			return geoDistance(leftArg, rightArg, thirdArg);
    1.16  		}
    1.17 +		else if(function.getURI().equals(GeoConstants.geoSparqlDistance))
    1.18 +		{
    1.19 +			return geoDistance(leftArg, rightArg, thirdArg);
    1.20 +		}	
    1.21  		else if(function.getURI().equals(GeoConstants.stSPARQLarea))
    1.22  		{
    1.23  			return geoArea(leftArg);
    1.24 -		}
    1.25 -		//GeoSPARQL's distance must be added at this place
    1.26 +		}		
    1.27  
    1.28  		logger.error("[Strabon.spatialMetricPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI());
    1.29  		return null;
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java	Mon Apr 22 15:23:10 2013 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java	Mon Apr 22 15:25:11 2013 +0300
     2.3 @@ -471,8 +471,7 @@
     2.4  		{
     2.5  			return geoSymDifference(leftArg, rightArg);
     2.6  		}
     2.7 -		//XXX GeoSPARQL - Non topological - except distance
     2.8 -		//TODO Must add buffer after deciding how to implement it
     2.9 +		//XXX GeoSPARQL - Non topological - except distance		
    2.10  		else if(function.getURI().equals(GeoConstants.geoSparqlConvexHull))
    2.11  		{
    2.12  			return geoConvexHull(leftArg);
    2.13 @@ -534,11 +533,14 @@
    2.14  		{
    2.15  			return geoDistance(leftArg, rightArg, thirdArg);
    2.16  		}
    2.17 +		else if(function.getURI().equals(GeoConstants.geoSparqlDistance))
    2.18 +		{
    2.19 +			return geoDistance(leftArg, rightArg, thirdArg);
    2.20 +		}
    2.21  		else if(function.getURI().equals(GeoConstants.stSPARQLarea))
    2.22  		{
    2.23  			return geoArea(leftArg);
    2.24 -		}
    2.25 -		//GeoSPARQL's distance must be added at this place
    2.26 +		}		
    2.27  
    2.28  		//Should never reach this place
    2.29  		return null;
     3.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Mon Apr 22 15:23:10 2013 +0300
     3.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Mon Apr 22 15:25:11 2013 +0300
     3.3 @@ -1782,6 +1782,10 @@
     3.4  			{
     3.5  				appendMetricFunction(expr.getRightArg(), filter);
     3.6  			}
     3.7 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
     3.8 +			{
     3.9 +				appendMetricFunction(expr.getRightArg(), filter);
    3.10 +			}
    3.11  			else
    3.12  			{
    3.13  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
    3.14 @@ -1989,6 +1993,10 @@
    3.15  			{
    3.16  				appendConstructFunction(expr.getRightArg(), filter);
    3.17  			}
    3.18 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple)
    3.19 +			{
    3.20 +				appendConstructFunction(expr.getRightArg(), filter);
    3.21 +			}
    3.22  			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
    3.23  			{
    3.24  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
    3.25 @@ -2303,6 +2311,10 @@
    3.26  			{
    3.27  				appendMetricFunction(expr.getRightArg(), filter);
    3.28  			}
    3.29 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
    3.30 +			{
    3.31 +				appendMetricFunction(expr.getRightArg(), filter);
    3.32 +			}
    3.33  			else
    3.34  			{
    3.35  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
    3.36 @@ -2437,6 +2449,10 @@
    3.37  			{
    3.38  				appendMetricFunction(expr.getRightArg(), filter);
    3.39  			}
    3.40 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
    3.41 +			{
    3.42 +				appendMetricFunction(expr.getRightArg(), filter);
    3.43 +			}
    3.44  			else
    3.45  			{
    3.46  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
    3.47 @@ -2921,6 +2937,10 @@
    3.48  				{
    3.49  					appendMetricFunction(expr.getRightArg(), filter);
    3.50  				}
    3.51 +				else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
    3.52 +				{
    3.53 +					appendMetricFunction(expr.getRightArg(), filter);
    3.54 +				}
    3.55  				else
    3.56  				{
    3.57  					appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);