Strabon

changeset 968:c4ddeafb67d6

updated "4326" to String.valueOf(GeoConstants.defaultSRID) in PostGISQueryBuilder and
in MonetDBQueryBuilder
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Wed Apr 03 15:28:33 2013 +0300 (2013-04-03)
parents cd8b50e4ac90
children a60fced07da5
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	Tue Apr 02 20:50:48 2013 +0300
     1.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Wed Apr 03 15:28:33 2013 +0300
     1.3 @@ -102,6 +102,8 @@
     1.4  import org.openrdf.sail.rdbms.exceptions.RdbmsException;
     1.5  import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
     1.6  
     1.7 +import eu.earthobservatory.constants.GeoConstants;
     1.8 +
     1.9  /**
    1.10   * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s.
    1.11   * 
    1.12 @@ -918,7 +920,7 @@
    1.13  			else
    1.14  			{
    1.15  				//4326 by default - Software House additions
    1.16 -				filter.append("4326");
    1.17 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.18  			}
    1.19  		}
    1.20  
    1.21 @@ -957,7 +959,7 @@
    1.22  			e.printStackTrace();
    1.23  		}
    1.24  
    1.25 -		filter.append(" GeomFromText('"+poly.toWKT() +"',4326)");
    1.26 +		filter.append(" GeomFromText('"+poly.toWKT() +"',"+String.valueOf(GeoConstants.defaultSRID)+")");
    1.27  
    1.28  		return raw;
    1.29  	}
    1.30 @@ -1512,7 +1514,7 @@
    1.31  				if(units.equals("metre") || units.equals("meter"))
    1.32  				{					
    1.33  					filter.appendComma();
    1.34 -					filter.append("4326");
    1.35 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.36  					filter.closeBracket(); //close st_transform
    1.37  					filter.closeBracket(); //close geography
    1.38  					
    1.39 @@ -1526,7 +1528,7 @@
    1.40  				else if(units.equals("degree"))
    1.41  				{
    1.42  					filter.appendComma();
    1.43 -					filter.append("4326");
    1.44 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.45  					filter.closeBracket(); //close st_transform
    1.46  					
    1.47  					filter.appendComma();
    1.48 @@ -1595,14 +1597,14 @@
    1.49  				if(units.equals("metre") || units.equals("meter"))
    1.50  				{
    1.51  					filter.appendComma();
    1.52 -					filter.append("4326");
    1.53 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.54  					filter.closeBracket();
    1.55  					filter.closeBracket();
    1.56  				}
    1.57  				else if(units.equals("degree"))
    1.58  				{
    1.59  					filter.appendComma();
    1.60 -					filter.append("4326");
    1.61 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
    1.62  					filter.closeBracket();
    1.63  				}
    1.64  
     2.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Tue Apr 02 20:50:48 2013 +0300
     2.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Wed Apr 03 15:28:33 2013 +0300
     2.3 @@ -9,6 +9,7 @@
     2.4  import java.util.List;
     2.5  
     2.6  import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
     2.7 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper;
     2.8  import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar;
     2.9  import org.openrdf.sail.generaldb.algebra.GeneralDBDateTimeColumn;
    2.10  import org.openrdf.sail.generaldb.algebra.GeneralDBDoubleValue;
    2.11 @@ -103,6 +104,8 @@
    2.12  import org.openrdf.sail.rdbms.exceptions.RdbmsException;
    2.13  import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
    2.14  
    2.15 +import eu.earthobservatory.constants.GeoConstants;
    2.16 +
    2.17  /**
    2.18   * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s.
    2.19   * 
    2.20 @@ -926,8 +929,8 @@
    2.21  			}
    2.22  			else
    2.23  			{
    2.24 -				//4326 by default - Software House additions
    2.25 -				filter.append("4326");
    2.26 +				// set default SRID ({@link GeoConstants#defaultSRID})
    2.27 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.28  			}
    2.29  		}
    2.30  
    2.31 @@ -966,7 +969,7 @@
    2.32  			e.printStackTrace();
    2.33  		}
    2.34  
    2.35 -		filter.append(" ST_GeomFromText('"+poly.toWKT() +"',4326)");
    2.36 +		filter.append(" ST_GeomFromText('"+poly.toWKT() +"',"+String.valueOf(GeoConstants.defaultSRID)+")");
    2.37  
    2.38  		return raw;
    2.39  	}
    2.40 @@ -1268,8 +1271,8 @@
    2.41  			else if(expr.getRightArg() instanceof GeneralDBStringValue)
    2.42  			{
    2.43  				String unparsedSRID = ((GeneralDBStringValue)expr.getRightArg()).getValue();
    2.44 -				//				int srid = Integer.parseInt(unparsedSRID.substring(unparsedSRID.lastIndexOf('/')+1));
    2.45 -				sridExpr = unparsedSRID.substring(unparsedSRID.lastIndexOf('/')+1);
    2.46 +				// TODO Check for other kinds of URIs (e.g., not only for EPSG)
    2.47 +				sridExpr = String.valueOf(WKTHelper.getSRID(unparsedSRID));
    2.48  				filter.append(sridExpr);
    2.49  				filter.closeBracket();
    2.50  			}
    2.51 @@ -1666,7 +1669,7 @@
    2.52  			if(units.equals("metre") || units.equals("meter"))
    2.53  			{					
    2.54  				filter.appendComma();
    2.55 -				filter.append("4326");
    2.56 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.57  				filter.closeBracket(); //close st_transform
    2.58  				filter.closeBracket(); //close geography
    2.59  				
    2.60 @@ -1680,7 +1683,7 @@
    2.61  			else if(units.equals("degree"))
    2.62  			{
    2.63  				filter.appendComma();
    2.64 -				filter.append("4326");
    2.65 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.66  				filter.closeBracket(); //close st_transform
    2.67  				
    2.68  				filter.appendComma();
    2.69 @@ -1740,14 +1743,14 @@
    2.70  			if(units.equals("metre") || units.equals("meter"))
    2.71  			{
    2.72  				filter.appendComma();
    2.73 -				filter.append("4326");
    2.74 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.75  				filter.closeBracket();
    2.76  				filter.closeBracket();
    2.77  			}
    2.78  			else if(units.equals("degree"))
    2.79  			{
    2.80  				filter.appendComma();
    2.81 -				filter.append("4326");
    2.82 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
    2.83  				filter.closeBracket();
    2.84  			}	
    2.85