Strabon

changeset 855:985c9bbd8194 temporals

added the temporal unary constructs period_start and period_end that will be evaluated using postgresql temporal. These constructs return the starting and te ending
points of a period respectively.
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Wed Jan 09 18:24:12 2013 +0200 (2013-01-09)
parents 365173f976f5
children c1f6c1f56954
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/TemporalConstants.java evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBQueryModelVisitorBase.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlPeriodEnd.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlPeriodStart.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlTemporalConstructUnary.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java 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/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/TemporalConstants.java	Tue Jan 08 17:27:03 2013 +0200
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/TemporalConstants.java	Wed Jan 09 18:24:12 2013 +0200
     1.3 @@ -55,6 +55,6 @@
     1.4  	public static final String minusPeriod=stRDF+ "period_minus";
     1.5  	public static final String precedingPeriod=stRDF+ "preceding_period";
     1.6  	public static final String succedingPeriod=stRDF+ "succeeding_period";
     1.7 -	public static final String start=stRDF+ "period_end";
     1.8 -	public static final String end=stRDF+ "period_start";
     1.9 +	public static final String start=stRDF+ "period_start";
    1.10 +	public static final String end=stRDF+ "period_end";
    1.11  }
     2.1 --- a/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function	Tue Jan 08 17:27:03 2013 +0200
     2.2 +++ b/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function	Wed Jan 09 18:24:12 2013 +0200
     2.3 @@ -83,6 +83,8 @@
     2.4  org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodSucceedingFunc
     2.5  org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodFunc
     2.6  org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodMinusFunc
     2.7 +org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodEndsFunc
     2.8 +org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodStartsFunc
     2.9  org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.periodUnionFunc
    2.10  org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.AdjacentPeriodFunc
    2.11  org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.AfterPeriodFunc
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java	Tue Jan 08 17:27:03 2013 +0200
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java	Wed Jan 09 18:24:12 2013 +0200
     3.3 @@ -101,9 +101,11 @@
     3.4  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlOverrightPeriod;
     3.5  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContainedBy;
     3.6  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContains;
     3.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodEnd;
     3.8  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodIntersection;
     3.9  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodMinus;
    3.10  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodOverlaps;
    3.11 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodStart;
    3.12  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodUnion;
    3.13  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlStarts;
    3.14  import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
    3.15 @@ -368,7 +370,7 @@
    3.16  	public static GeneralDBSqlExpr below(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    3.17  		return new GeneralDBSqlBelow(left, right);
    3.18  	}
    3.19 -	//stSPARQL Temporal Construct Functions
    3.20 +	//stSPARQL Temporal Construct Binary Functions
    3.21  	
    3.22  	public static GeneralDBSqlExpr periodIntersection(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    3.23  		return new GeneralDBSqlPeriodIntersection(left, right);
    3.24 @@ -380,6 +382,18 @@
    3.25  		return new GeneralDBSqlPeriodMinus(left, right);
    3.26  	}
    3.27  	
    3.28 +	
    3.29 +	//stSPARQL Temporal Construct Unary Function
    3.30 +	
    3.31 +	public static GeneralDBSqlExpr periodStart(GeneralDBSqlExpr arg) {
    3.32 +		return new GeneralDBSqlPeriodStart(arg);
    3.33 +	}
    3.34 +	
    3.35 +	public static GeneralDBSqlExpr periodEnd(GeneralDBSqlExpr arg) {
    3.36 +		return new GeneralDBSqlPeriodEnd(arg);
    3.37 +	}
    3.38 +	
    3.39 +	
    3.40  	//stSparql Temporal Relation Functions
    3.41  	public static GeneralDBSqlExpr afterPeriod(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    3.42  		return new GeneralDBSqlAfterPeriod(left, right);
     4.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBQueryModelVisitorBase.java	Tue Jan 08 17:27:03 2013 +0200
     4.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBQueryModelVisitorBase.java	Wed Jan 09 18:24:12 2013 +0200
     4.3 @@ -60,6 +60,7 @@
     4.4  import org.openrdf.sail.generaldb.algebra.GeneralDBUnionItem;
     4.5  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal;
     4.6  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporalConstructBinary;
     4.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporalConstructUnary;
     4.8  
     4.9  /**
    4.10   * Base class for RDBMS visitor classes. This class is extended with additional
    4.11 @@ -387,6 +388,14 @@
    4.12  		 meetNode(node);
    4.13  	 }
    4.14  
    4.15 +	/**
    4.16 +	 * @param generalDBSqlPeriodStart
    4.17 +	 */
    4.18 +	public void meet(GeneralDBSqlTemporalConstructUnary node) {
    4.19 +		meet(node);
    4.20 +		
    4.21 +	}
    4.22 +
    4.23  
    4.24  
    4.25  
     5.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Tue Jan 08 17:27:03 2013 +0200
     5.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Wed Jan 09 18:24:12 2013 +0200
     5.3 @@ -46,8 +46,10 @@
     5.4  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc;
     5.5  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc;
     5.6  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RelateFunc;
     5.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodEndsFunc;
     5.8  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodIntersectionFunc;
     5.9  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodMinusFunc;
    5.10 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodStartsFunc;
    5.11  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.TemporalConstructFunc;
    5.12  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.periodUnionFunc;
    5.13  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.AdjacentPeriodFunc;
    5.14 @@ -996,6 +998,14 @@
    5.15  		{
    5.16  			return periodMinus(leftArg, rightArg);
    5.17  		}
    5.18 +		else if(function instanceof PeriodStartsFunc)
    5.19 +		{
    5.20 +			return periodStart(leftArg);
    5.21 +		}
    5.22 +		else if(function instanceof PeriodEndsFunc)
    5.23 +		{
    5.24 +			return periodEnd(leftArg);
    5.25 +		}
    5.26  		else
    5.27  			return null;
    5.28  	}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlPeriodEnd.java	Wed Jan 09 18:24:12 2013 +0200
     6.3 @@ -0,0 +1,45 @@
     6.4 +/**
     6.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     6.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     6.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6.8 + *
     6.9 + * Copyright (C) 2012, Pyravlos Team
    6.10 + *
    6.11 + * http://www.strabon.di.uoa.gr/
    6.12 + */
    6.13 +package org.openrdf.sail.generaldb.algebra.temporal;
    6.14 +
    6.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary;
    6.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    6.17 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    6.18 +
    6.19 +/**
    6.20 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
    6.21 + *
    6.22 + */
    6.23 +public class GeneralDBSqlPeriodEnd extends GeneralDBSqlTemporalConstructUnary{
    6.24 +
    6.25 +	public GeneralDBSqlPeriodEnd(GeneralDBSqlExpr arg) {
    6.26 +		super(arg);
    6.27 +	}
    6.28 +
    6.29 +
    6.30 +	/* (non-Javadoc)
    6.31 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GneralDBSqlTemporalConstructBinary#getPostgresFunction()
    6.32 +	 */
    6.33 +	@Override
    6.34 +	public String getPostgresFunction() {
    6.35 +
    6.36 +		return "last";
    6.37 +	}
    6.38 +	/* (non-Javadoc)
    6.39 +	 * @see org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelNodeBase#visit(org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase)
    6.40 +	 */
    6.41 +	@Override
    6.42 +	public <X extends Exception> void visit(
    6.43 +			GeneralDBQueryModelVisitorBase<X> visitor) throws X {
    6.44 +		visitor.meet(this);
    6.45 +		
    6.46 +	}
    6.47 +
    6.48 +}
    6.49 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlPeriodStart.java	Wed Jan 09 18:24:12 2013 +0200
     7.3 @@ -0,0 +1,45 @@
     7.4 +/**
     7.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     7.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     7.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7.8 + *
     7.9 + * Copyright (C) 2012, Pyravlos Team
    7.10 + *
    7.11 + * http://www.strabon.di.uoa.gr/
    7.12 + */
    7.13 +package org.openrdf.sail.generaldb.algebra.temporal;
    7.14 +
    7.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary;
    7.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    7.17 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    7.18 +
    7.19 +/**
    7.20 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
    7.21 + *
    7.22 + */
    7.23 +public class GeneralDBSqlPeriodStart extends GeneralDBSqlTemporalConstructUnary{
    7.24 +
    7.25 +	public GeneralDBSqlPeriodStart(GeneralDBSqlExpr arg) {
    7.26 +		super(arg);
    7.27 +	}
    7.28 +
    7.29 +
    7.30 +	/* (non-Javadoc)
    7.31 +	 * @see org.openrdf.sail.generaldb.algebra.temporal.GneralDBSqlTemporalConstructBinary#getPostgresFunction()
    7.32 +	 */
    7.33 +	@Override
    7.34 +	public String getPostgresFunction() {
    7.35 +
    7.36 +		return "first";
    7.37 +	}
    7.38 +	/* (non-Javadoc)
    7.39 +	 * @see org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelNodeBase#visit(org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase)
    7.40 +	 */
    7.41 +	@Override
    7.42 +	public <X extends Exception> void visit(
    7.43 +			GeneralDBQueryModelVisitorBase<X> visitor) throws X {
    7.44 +		visitor.meet(this);
    7.45 +		
    7.46 +	}
    7.47 +
    7.48 +}
    7.49 \ No newline at end of file
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/temporal/GeneralDBSqlTemporalConstructUnary.java	Wed Jan 09 18:24:12 2013 +0200
     8.3 @@ -0,0 +1,37 @@
     8.4 +/**
     8.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     8.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     8.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     8.8 + *
     8.9 + * Copyright (C) 2012, Pyravlos Team
    8.10 + *
    8.11 + * http://www.strabon.di.uoa.gr/
    8.12 + */
    8.13 +package org.openrdf.sail.generaldb.algebra.temporal;
    8.14 +
    8.15 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator;
    8.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    8.17 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    8.18 +import org.openrdf.sail.generaldb.algebra.base.UnaryGeneralDBOperator;
    8.19 +
    8.20 +/**
    8.21 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
    8.22 + *
    8.23 + */
    8.24 +public abstract class GeneralDBSqlTemporalConstructUnary extends UnaryGeneralDBOperator {
    8.25 +		
    8.26 +	/*In Postgres Temporal it seems that an operator is assigned to every PERIOD function 
    8.27 +	 * I store this information in the declaration of each function so that i can use it in the mapping
    8.28 +	 * of stSPARQL queries to spatiotemporally extended SQL queries
    8.29 +	 * */
    8.30 +	//This method returns the respective function of the Postgres Temporal extension
    8.31 +	public abstract  String getPostgresFunction();
    8.32 +
    8.33 +	public GeneralDBSqlTemporalConstructUnary(GeneralDBSqlExpr arg) {
    8.34 +			super(arg);
    8.35 +		}
    8.36 +
    8.37 +	
    8.38 +	}
    8.39 +
    8.40 +
     9.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Tue Jan 08 17:27:03 2013 +0200
     9.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Wed Jan 09 18:24:12 2013 +0200
     9.3 @@ -101,6 +101,7 @@
     9.4  import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn;
     9.5  import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
     9.6  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporalConstructBinary;
     9.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporalConstructUnary;
     9.8  import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron;
     9.9  import org.openrdf.sail.generaldb.schema.IdSequence;
    9.10  import org.openrdf.sail.generaldb.util.StSPARQLValueComparator;
    9.11 @@ -940,11 +941,11 @@
    9.12  					throw new UnsupportedRdbmsOperatorException("No such temporal expression exists!");
    9.13  					
    9.14  				} else {
    9.15 -					info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type);				
    9.16 -					
    9.17 +					info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type);		
    9.18  				}
    9.19  
    9.20  				constructIndexesAndNames.put(info,index++);
    9.21 +				
    9.22  
    9.23  			}
    9.24  		}
    9.25 @@ -963,7 +964,6 @@
    9.26  			query.offset(qb.getOffset());
    9.27  		}
    9.28  		parameters.addAll(query.getParameters());
    9.29 -
    9.30  		return query.toString();
    9.31  	}
    9.32  
    9.33 @@ -1090,6 +1090,10 @@
    9.34  			locateColumnVars(((GeneralDBSqlTemporalConstructBinary)expr).getLeftArg(),allKnown);
    9.35  			locateColumnVars(((GeneralDBSqlTemporalConstructBinary)expr).getRightArg(),allKnown);
    9.36  		}
    9.37 +		else if(expr instanceof GeneralDBSqlTemporalConstructUnary)
    9.38 +		{
    9.39 +			locateColumnVars(((GeneralDBSqlTemporalConstructUnary)expr).getArg(),allKnown);
    9.40 +		}
    9.41  		else
    9.42  		{
    9.43  			//must recurse
    9.44 @@ -1164,6 +1168,11 @@
    9.45  		{
    9.46  			return ResultType.PERIOD;
    9.47  		}
    9.48 +		else if(expr instanceof GeneralDBSqlTemporalConstructUnary)
    9.49 +		{
    9.50 +			return ResultType.PERIOD;
    9.51 +		}
    9.52 +		System.out.println("NOT SUPPORTED OPERATOR!!!");
    9.53  		return ResultType.NULL;//SHOULD NEVER REACH THIS CASE
    9.54  	}
    9.55  }
    10.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Tue Jan 08 17:27:03 2013 +0200
    10.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Wed Jan 09 18:24:12 2013 +0200
    10.3 @@ -124,9 +124,11 @@
    10.4  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlOverrightPeriod;
    10.5  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContainedBy;
    10.6  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContains;
    10.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodEnd;
    10.8  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodIntersection;
    10.9  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodMinus;
   10.10  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodOverlaps;
   10.11 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodStart;
   10.12  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodUnion;
   10.13  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlStarts;
   10.14  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporal;
   10.15 @@ -657,6 +659,7 @@
   10.16  		else if(expr instanceof GeneralDBSqlPeriodMinus){
   10.17  			append((GeneralDBSqlPeriodMinus)expr, filter);
   10.18  		}
   10.19 +	
   10.20  		
   10.21  		//GeoSPARQL
   10.22  		//Simple Features
   10.23 @@ -852,6 +855,12 @@
   10.24  		else if (expr instanceof GeneralDBSqlGeoBoundary) {
   10.25  			append((GeneralDBSqlGeoBoundary)expr, filter);
   10.26  		}
   10.27 +		else if (expr instanceof GeneralDBSqlPeriodStart) {
   10.28 +			append((GeneralDBSqlPeriodStart)expr, filter);
   10.29 +		}
   10.30 +		else if (expr instanceof GeneralDBSqlPeriodEnd) {
   10.31 +			append((GeneralDBSqlPeriodEnd)expr, filter);
   10.32 +		}
   10.33  		//Metrics
   10.34  		else if (expr instanceof GeneralDBSqlGeoArea) {
   10.35  			append((GeneralDBSqlGeoArea)expr, filter);
   10.36 @@ -884,6 +893,11 @@
   10.37  		}
   10.38  			}
   10.39  
   10.40 +	/**
   10.41 +	 * @param expr
   10.42 +	 * @param filter
   10.43 +	 */
   10.44 +
   10.45  	protected void dispatchValueColumnBase(GeneralDBValueColumnBase expr, GeneralDBSqlExprBuilder filter)
   10.46  			throws UnsupportedRdbmsOperatorException
   10.47  			{
   10.48 @@ -1300,6 +1314,15 @@
   10.49  		{
   10.50  			append((GeneralDBSqlPeriodUnion)constr, filter);
   10.51  		}
   10.52 +		else if(constr instanceof GeneralDBSqlPeriodStart)
   10.53 +		{
   10.54 +			append((GeneralDBSqlPeriodStart)constr, filter);
   10.55 +		}
   10.56 +		else if(constr instanceof GeneralDBSqlPeriodEnd)
   10.57 +		{
   10.58 +			append((GeneralDBSqlPeriodEnd)constr, filter);
   10.59 +		}
   10.60 +		
   10.61  
   10.62  			}
   10.63  
   10.64 @@ -1350,6 +1373,14 @@
   10.65  		GeneralDBSqlExprBuilder filter)
   10.66  		throws UnsupportedRdbmsOperatorException;
   10.67  
   10.68 +protected abstract void append(GeneralDBSqlPeriodStart expr,
   10.69 +		GeneralDBSqlExprBuilder filter)
   10.70 +		throws UnsupportedRdbmsOperatorException;
   10.71 +
   10.72 +protected abstract void append(GeneralDBSqlPeriodEnd expr,
   10.73 +		GeneralDBSqlExprBuilder filter)
   10.74 +		throws UnsupportedRdbmsOperatorException;
   10.75 +
   10.76  protected abstract void append(GeneralDBSqlPeriodOverlaps expr,
   10.77  		GeneralDBSqlExprBuilder filter)
   10.78  		throws UnsupportedRdbmsOperatorException;
   10.79 @@ -1394,4 +1425,13 @@
   10.80  		throws UnsupportedRdbmsOperatorException;
   10.81  
   10.82  
   10.83 +
   10.84 +/**
   10.85 + * @param expr
   10.86 + * @param filter
   10.87 + * @throws UnsupportedRdbmsOperatorException
   10.88 + */
   10.89 +
   10.90 +
   10.91 +
   10.92  }
    11.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java	Tue Jan 08 17:27:03 2013 +0200
    11.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java	Wed Jan 09 18:24:12 2013 +0200
    11.3 @@ -74,8 +74,10 @@
    11.4  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc;
    11.5  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.TransformFunc;
    11.6  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc;
    11.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodEndsFunc;
    11.8  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodMinusFunc;
    11.9  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodPrecedingFunc;
   11.10 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodStartsFunc;
   11.11  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodSucceedingFunc;
   11.12  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.TemporalConstructFunc;
   11.13  import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalRelationFunc;
   11.14 @@ -1268,7 +1270,7 @@
   11.15  		{
   11.16  			Function function = FunctionRegistry.getInstance().get(((FunctionCall) expr).getURI());
   11.17  			if((!(function instanceof UnionFunc) || !(((FunctionCall) expr).getArgs().size()==1))&&!(function instanceof ExtentFunc) && !(function instanceof PeriodPrecedingFunc)
   11.18 -					&& !(function instanceof PeriodSucceedingFunc) && !(function instanceof PeriodMinusFunc))
   11.19 +					&& !(function instanceof PeriodSucceedingFunc))
   11.20  			{
   11.21  				//Recursively check arguments
   11.22  				boolean unionPresent = false;
   11.23 @@ -1283,11 +1285,13 @@
   11.24  			}
   11.25  			else
   11.26  			{
   11.27 +				System.out.println("Will be evaluated in Java");
   11.28  				return true;
   11.29  			}
   11.30  		}
   11.31  		else //Var
   11.32  		{
   11.33 +			System.out.println("Should not be evaluated in Java");
   11.34  			return false;
   11.35  		}
   11.36  
    12.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Tue Jan 08 17:27:03 2013 +0200
    12.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Wed Jan 09 18:24:12 2013 +0200
    12.3 @@ -106,9 +106,11 @@
    12.4  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlOverrightPeriod;
    12.5  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContainedBy;
    12.6  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContains;
    12.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodEnd;
    12.8  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodIntersection;
    12.9  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodMinus;
   12.10  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodOverlaps;
   12.11 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodStart;
   12.12  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodUnion;
   12.13  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlStarts;
   12.14  import org.openrdf.sail.generaldb.evaluation.GeneralDBQueryBuilder;
   12.15 @@ -2235,4 +2237,26 @@
   12.16  		
   12.17  	}
   12.18  
   12.19 +	/* (non-Javadoc)
   12.20 +	 * @see org.openrdf.sail.generaldb.evaluation.GeneralDBQueryBuilder#append(org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodStart, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)
   12.21 +	 */
   12.22 +	@Override
   12.23 +	protected void append(GeneralDBSqlPeriodStart expr,
   12.24 +			GeneralDBSqlExprBuilder filter)
   12.25 +			throws UnsupportedRdbmsOperatorException {
   12.26 +		// TODO Auto-generated method stub
   12.27 +		
   12.28 +	}
   12.29 +
   12.30 +	/* (non-Javadoc)
   12.31 +	 * @see org.openrdf.sail.generaldb.evaluation.GeneralDBQueryBuilder#append(org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodEnd, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)
   12.32 +	 */
   12.33 +	@Override
   12.34 +	protected void append(GeneralDBSqlPeriodEnd expr,
   12.35 +			GeneralDBSqlExprBuilder filter)
   12.36 +			throws UnsupportedRdbmsOperatorException {
   12.37 +		// TODO Auto-generated method stub
   12.38 +		
   12.39 +	}
   12.40 +
   12.41  }
   12.42 \ No newline at end of file
    13.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Tue Jan 08 17:27:03 2013 +0200
    13.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Wed Jan 09 18:24:12 2013 +0200
    13.3 @@ -355,7 +355,8 @@
    13.4  				&&!(expr instanceof GeneralDBSqlMathExpr)
    13.5  				&&!(expr instanceof GeneralDBSqlSpatialProperty)
    13.6  			&&!(expr instanceof GeneralDBSqlTemporal)
    13.7 -			&&!(expr instanceof GeneralDBSqlTemporalConstructBinary))
    13.8 +			&&!(expr instanceof GeneralDBSqlTemporalConstructBinary)
    13.9 +			&&!(expr instanceof GeneralDBSqlTemporalConstructUnary))
   13.10  		{
   13.11  			query.select().appendFunction(ST_ASBINARY);
   13.12  		}
   13.13 @@ -1130,8 +1131,19 @@
   13.14  	appendGeneralDBTemporalFunctionBinary(expr, filter, expr.getPostgresFunction());
   13.15  			}
   13.16  
   13.17 +	@Override
   13.18 +	protected void append(GeneralDBSqlPeriodStart expr, GeneralDBSqlExprBuilder filter)
   13.19 +			throws UnsupportedRdbmsOperatorException
   13.20 +			{
   13.21 +	appendGeneralDBTemporalFunctionUnary(expr, filter, expr.getPostgresFunction());
   13.22 +			}
   13.23  
   13.24 -
   13.25 +	@Override
   13.26 +	protected void append(GeneralDBSqlPeriodEnd expr, GeneralDBSqlExprBuilder filter)
   13.27 +			throws UnsupportedRdbmsOperatorException
   13.28 +			{
   13.29 +	appendGeneralDBTemporalFunctionUnary(expr, filter, expr.getPostgresFunction());
   13.30 +			}
   13.31  
   13.32  
   13.33  
   13.34 @@ -1540,7 +1552,22 @@
   13.35  			
   13.36  		//TODO:Think about adding more temporal function types (e.g., metrics, unary operators)
   13.37  			
   13.38 +			/*else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary)
   13.39 +			{
   13.40 +				appendConstructFunction(expr.getLeftArg(), filter);
   13.41 +			}
   13.42 +			else if(expr.getLeftArg(functionName) instanceof GeneralDBSqlCase)
   13.43 +			{
   13.44 +				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
   13.45 +				appendMBB(onlyLabel,filter); 
   13.46 +			}
   13.47 +			else
   13.48 +			{
   13.49 +				appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
   13.50 +			}*/
   13.51 +			//filter.appendComma();
   13.52  
   13.53 +						//filter.openBracket();
   13.54  			filter.appendComma();
   13.55  			if (expr.getRightArg() instanceof GeneralDBSqlTemporalConstructBinary)
   13.56  			{
   13.57 @@ -1561,6 +1588,75 @@
   13.58  
   13.59  			}
   13.60  	
   13.61 +	protected void appendGeneralDBTemporalFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, String func)
   13.62 +			throws UnsupportedRdbmsOperatorException
   13.63 +			{
   13.64 +	
   13.65 +		//filter.openBracket();
   13.66 +
   13.67 +		boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
   13.68 +
   13.69 +		if(check1)
   13.70 +		{
   13.71 +			this.append((GeneralDBSqlNull)expr.getArg(), filter);
   13.72 +
   13.73 +		}
   13.74 +		else
   13.75 +		{
   13.76 +
   13.77 +			GeneralDBSqlExpr tmp = expr;
   13.78 +			if(tmp instanceof GeneralDBSqlTemporalConstructUnary && tmp.getParentNode() == null)
   13.79 +			{
   13.80 +				while(true)
   13.81 +				{
   13.82 +					GeneralDBSqlExpr child;
   13.83 +
   13.84 +					if(tmp instanceof BinaryGeneralDBOperator)
   13.85 +					{
   13.86 +						child = ((BinaryGeneralDBOperator) tmp).getLeftArg();
   13.87 +					}
   13.88 +					else //(tmp instanceof UnaryGeneralDBOperator)
   13.89 +					{
   13.90 +						child = ((UnaryGeneralDBOperator) tmp).getArg();
   13.91 +					}
   13.92 +
   13.93 +					tmp = child;
   13.94 +					if(tmp instanceof GeneralDBLabelColumn)
   13.95 +					{
   13.96 +			
   13.97 +						break;
   13.98 +					}
   13.99 +					else if (tmp instanceof GeneralDBStringValue) //Constant!!
  13.100 +					{
  13.101 +												break;
  13.102 +					}
  13.103 +
  13.104 +				}
  13.105 +				
  13.106 +			}
  13.107 +			/////
  13.108 +			filter.appendFunction(func); //postgres temporal operators get deprecated. I will use the function names instead- constant
  13.109 +			filter.openBracket();
  13.110 +			if ((expr.getArg() instanceof GeneralDBSqlTemporalConstructBinary) || (expr.getArg() instanceof GeneralDBSqlTemporalConstructUnary))
  13.111 +			{
  13.112 +				appendConstructFunction(expr.getArg(), filter);
  13.113 +			}
  13.114 +			else if(expr.getArg() instanceof GeneralDBStringValue)
  13.115 +			{
  13.116 +				appendPeriodConstant(expr.getArg(), filter);
  13.117 +			}
  13.118 +			else
  13.119 +			{			
  13.120 +				appendPeriod((GeneralDBLabelColumn)(expr.getArg()),filter);
  13.121 +
  13.122 +			}
  13.123 +
  13.124 +		}
  13.125 +		filter.closeBracket();
  13.126 +
  13.127 +
  13.128 +			}
  13.129 +	
  13.130  	protected void appendGeneralDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
  13.131  			throws UnsupportedRdbmsOperatorException
  13.132  			{