Strabon

changeset 743:6b543070da6f temporals

Now periods as constant typed literal values are supported as well
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Wed Nov 28 17:57:15 2012 +0200 (2012-11-28)
parents c9cf73b38b54
children 565907aa0e93
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	Wed Nov 28 17:51:08 2012 +0200
     1.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Wed Nov 28 17:57:15 2012 +0200
     1.3 @@ -958,6 +958,17 @@
     1.4  	 * 
     1.5  	 * */
     1.6  	
     1.7 +	protected String appendPeriodConstant(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter)
     1.8 +	{
     1.9 +		GeneralDBStringValue arg = (GeneralDBStringValue) expr;
    1.10 +		String period = arg.getValue();
    1.11 +		
    1.12 +		//FIXME period constant should be validated before appended
    1.13 +		
    1.14 +		filter.append("period_in(textout('"+period+"'))");
    1.15 +		return period;
    1.16 +	}
    1.17 +	
    1.18  	@Override
    1.19  	protected void append(GeneralDBSqlPeriodContainedBy expr, GeneralDBSqlExprBuilder filter)
    1.20  			throws UnsupportedRdbmsOperatorException
    1.21 @@ -1428,6 +1439,10 @@
    1.22  			{
    1.23  				appendConstructFunction(expr.getLeftArg(), filter);
    1.24  			}
    1.25 +			else if(expr.getLeftArg() instanceof GeneralDBStringValue)
    1.26 +			{
    1.27 +				appendPeriodConstant(expr.getLeftArg(), filter);
    1.28 +			}
    1.29  			else
    1.30  			{			
    1.31  				appendPeriod((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
    1.32 @@ -1437,8 +1452,9 @@
    1.33  			if(func.equals("=")|| func.equals("!=")|| func.equals("-")|| func.equals("+")|| func.equals("~")|| 
    1.34  					func.equals("@")|| func.equals("<<")|| func.equals(">>")|| func.equals("&>")|| func.equals("&>")|| func.equals("&&"))
    1.35  			{
    1.36 +				filter.append(" ");
    1.37  				filter.appendFunction(func);
    1.38 -				
    1.39 +				filter.append(" ");
    1.40  			}
    1.41  			
    1.42  		//TODO:Think about adding more temporal function types (e.g., metrics, unary operators)
    1.43 @@ -1464,6 +1480,10 @@
    1.44  			{
    1.45  				appendConstructFunction(expr.getRightArg(), filter);
    1.46  			}
    1.47 +			else if(expr.getRightArg() instanceof GeneralDBStringValue)
    1.48 +			{
    1.49 +				appendPeriodConstant(expr.getRightArg(), filter);
    1.50 +			}
    1.51  			else
    1.52  			{
    1.53  				appendPeriod((GeneralDBLabelColumn)(expr.getRightArg()),filter);