Strabon

changeset 844:0a5573bebcea temporals

fixed. Now the following temporal constructs: period_intersect, period_union and period_minus are implemented in postgres temporal as well
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Tue Jan 08 11:43:32 2013 +0200 (2013-01-08)
parents 2fbca5bcab55
children 365173f976f5
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	Mon Jan 07 20:59:51 2013 +0200
     1.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Tue Jan 08 11:43:32 2013 +0200
     1.3 @@ -264,6 +264,7 @@
     1.4  				//XXX SRID
     1.5  				filter.appendFunction(ST_TRANSFORM);
     1.6  				filter.openBracket();
     1.7 +				System.out.println("267");
     1.8  				//
     1.9  
    1.10  				filter.column(alias, STRDFGEO_FIELD);
    1.11 @@ -357,7 +358,6 @@
    1.12  			&&!(expr instanceof GeneralDBSqlTemporalConstructBinary))
    1.13  		{
    1.14  			query.select().appendFunction(ST_ASBINARY);
    1.15 -			System.out.println("appended st_asBinary!");
    1.16  		}
    1.17  		else
    1.18  		{
    1.19 @@ -1325,6 +1325,7 @@
    1.20  
    1.21  		filter.openBracket();
    1.22  		filter.appendFunction(ST_TRANSFORM);
    1.23 +		System.out.println("1328");
    1.24  		filter.openBracket();
    1.25  
    1.26  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
    1.27 @@ -1385,6 +1386,7 @@
    1.28  				{
    1.29  					filter.appendFunction(ST_TRANSFORM);
    1.30  					filter.openBracket();
    1.31 +					System.out.println("1390");
    1.32  				}
    1.33  			}
    1.34  
    1.35 @@ -1463,11 +1465,7 @@
    1.36  	protected void appendGeneralDBTemporalFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, String func)
    1.37  			throws UnsupportedRdbmsOperatorException
    1.38  			{
    1.39 -		//In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))")
    1.40 -		boolean sridNeeded = true;
    1.41 -		//XXX Incorporating SRID
    1.42 -		String sridExpr = null;
    1.43 -
    1.44 +	
    1.45  		//filter.openBracket();
    1.46  
    1.47  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
    1.48 @@ -1504,33 +1502,16 @@
    1.49  					tmp = child;
    1.50  					if(tmp instanceof GeneralDBLabelColumn)
    1.51  					{
    1.52 -						//Reached the innermost left var -> need to capture its SRID
    1.53 -						String alias;
    1.54 -						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
    1.55 -							//Predicates used in triple patterns non-existent in db
    1.56 -							alias="NULL";
    1.57 -						}
    1.58 -						else
    1.59 -						{
    1.60 -							//Reached the innermost left var -> need to capture its SRID
    1.61 -							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
    1.62 -							alias=alias+".srid";
    1.63 -						}
    1.64 -						sridExpr = alias;
    1.65 +			
    1.66  						break;
    1.67  					}
    1.68  					else if (tmp instanceof GeneralDBStringValue) //Constant!!
    1.69  					{
    1.70 -						sridNeeded  = false;
    1.71 -						break;
    1.72 +												break;
    1.73  					}
    1.74  
    1.75  				}
    1.76 -				if(sridNeeded)
    1.77 -				{
    1.78 -					filter.appendFunction(ST_TRANSFORM);
    1.79 -					filter.openBracket();
    1.80 -				}
    1.81 +				
    1.82  			}
    1.83  			/////
    1.84  			filter.appendFunction(func); //postgres temporal operators get deprecated. I will use the function names instead- constant
    1.85 @@ -1559,22 +1540,7 @@
    1.86  			
    1.87  		//TODO:Think about adding more temporal function types (e.g., metrics, unary operators)
    1.88  			
    1.89 -			/*else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary)
    1.90 -			{
    1.91 -				appendConstructFunction(expr.getLeftArg(), filter);
    1.92 -			}
    1.93 -			else if(expr.getLeftArg(functionName) instanceof GeneralDBSqlCase)
    1.94 -			{
    1.95 -				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
    1.96 -				appendMBB(onlyLabel,filter); 
    1.97 -			}
    1.98 -			else
    1.99 -			{
   1.100 -				appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
   1.101 -			}*/
   1.102 -			//filter.appendComma();
   1.103  
   1.104 -						//filter.openBracket();
   1.105  			filter.appendComma();
   1.106  			if (expr.getRightArg() instanceof GeneralDBSqlTemporalConstructBinary)
   1.107  			{
   1.108 @@ -1588,26 +1554,10 @@
   1.109  			{
   1.110  				appendPeriod((GeneralDBLabelColumn)(expr.getRightArg()),filter);
   1.111  			}
   1.112 -		
   1.113  
   1.114 -//			//filter.closeBracket();
   1.115 -			//SRID Support
   1.116 -			if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null)
   1.117 -			{
   1.118 -				filter.appendComma();
   1.119 -				//filter.append(((GeneralDBSqlSpatialConstructBinary)expr).getSrid());
   1.120 -				filter.append(sridExpr);
   1.121 -				filter.closeBracket();
   1.122 -			}
   1.123 -			///
   1.124  		}
   1.125  		filter.closeBracket();
   1.126 -		//Used to explicitly include SRID
   1.127 -		if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null)
   1.128 -		{
   1.129 -			filter.appendComma();
   1.130 -			filter.append(sridExpr);
   1.131 -		}
   1.132 +
   1.133  
   1.134  			}
   1.135  	
   1.136 @@ -1681,6 +1631,7 @@
   1.137  				{
   1.138  					filter.appendFunction(ST_TRANSFORM);
   1.139  					filter.openBracket();
   1.140 +					System.out.println("1687");
   1.141  				}
   1.142  			}
   1.143  			/////
   1.144 @@ -1890,6 +1841,7 @@
   1.145  				{
   1.146  					filter.appendFunction(ST_TRANSFORM);
   1.147  					filter.openBracket();
   1.148 +					System.out.println("before switch");
   1.149  				}
   1.150  			}
   1.151  			/////