Strabon

changeset 733:09fc776e43be temporals

continue support for stSPARQL temporal relation functions
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Fri Nov 23 16:08:50 2012 +0200 (2012-11-23)
parents 35884bc15005
children 413b712d1ea3
files generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.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/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java	Thu Nov 22 19:34:08 2012 +0200
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java	Fri Nov 23 16:08:50 2012 +0200
     1.3 @@ -90,6 +90,11 @@
     1.4  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Overlaps;
     1.5  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Touches;
     1.6  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Within;
     1.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlAfterPeriod;
     1.8 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlBeforePeriod;
     1.9 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContainedBy;
    1.10 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContains;
    1.11 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodOverlaps;
    1.12  import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
    1.13  /**
    1.14   * Support method to create SQL expressions.
    1.15 @@ -350,7 +355,23 @@
    1.16  	public static GeneralDBSqlExpr below(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.17  		return new GeneralDBSqlBelow(left, right);
    1.18  	}
    1.19 -
    1.20 +	
    1.21 +	//stSparql Temporal Relation Functions
    1.22 +	public static GeneralDBSqlExpr afterPeriod(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.23 +		return new GeneralDBSqlAfterPeriod(left, right);
    1.24 +	}
    1.25 +	public static GeneralDBSqlExpr beforePeriod(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.26 +		return new GeneralDBSqlBeforePeriod(left, right);
    1.27 +	}
    1.28 +	public static GeneralDBSqlExpr periodContains(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.29 +		return new GeneralDBSqlPeriodContains(left, right);
    1.30 +	}
    1.31 +	public static GeneralDBSqlExpr periodContainedBy(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.32 +		return new GeneralDBSqlPeriodContainedBy(left, right);
    1.33 +	}
    1.34 +	public static GeneralDBSqlExpr periodOverlaps(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.35 +		return new GeneralDBSqlPeriodOverlaps(left, right);
    1.36 +	}
    1.37  	//XXX Spatial Construct Functions
    1.38  	public static GeneralDBSqlExpr geoUnion(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    1.39  
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Thu Nov 22 19:34:08 2012 +0200
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Fri Nov 23 16:08:50 2012 +0200
     2.3 @@ -46,6 +46,7 @@
     2.4  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc;
     2.5  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc;
     2.6  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RelateFunc;
     2.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants;
     2.8  import org.openrdf.query.algebra.helpers.QueryModelVisitorBase;
     2.9  import org.openrdf.sail.generaldb.algebra.GeneralDBFalseValue;
    2.10  import org.openrdf.sail.generaldb.algebra.GeneralDBRefIdColumn;
    2.11 @@ -938,6 +939,23 @@
    2.12  		{
    2.13  			return mbbEqualsGeo(leftArg,rightArg);
    2.14  		}
    2.15 +		//stSPARQL temporal functions
    2.16 +		else if(function.getURI().equals(TemporalConstants.afterPeriod))
    2.17 +		{
    2.18 +			return afterPeriod(leftArg,rightArg);
    2.19 +		}
    2.20 +		else if(function.getURI().equals(TemporalConstants.beforePeriod))
    2.21 +		{
    2.22 +			return beforePeriod(leftArg,rightArg);
    2.23 +		}
    2.24 +		else if(function.getURI().equals(TemporalConstants.periodContains))
    2.25 +		{
    2.26 +			return periodContains(leftArg,rightArg);
    2.27 +		}
    2.28 +		else if(function.getURI().equals(TemporalConstants.periodOverlaps))
    2.29 +		{
    2.30 +			return periodOverlaps(leftArg,rightArg);
    2.31 +		}
    2.32  		//XXX GeoSPARQL
    2.33  		//Simple Features
    2.34  		else if(function.getURI().equals(GeoConstants.sfContains))
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Nov 22 19:34:08 2012 +0200
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Fri Nov 23 16:08:50 2012 +0200
     3.3 @@ -857,7 +857,7 @@
     3.4  			//			GeneralDBColumnVar var = ((GeneralDBLongLabelColumn) expr).getRdbmsVar();
     3.5  			//			for(GeneralDBColumnVar reference: allKnown)
     3.6  			//			{
     3.7 -			//				if(var.getName().equals(reference.getName()))
     3.8 +			//				if(var.getName()-.equals(reference.getName()))
     3.9  			//				{
    3.10  			//					var = reference;
    3.11  			//				}
     4.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Thu Nov 22 19:34:08 2012 +0200
     4.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Fri Nov 23 16:08:50 2012 +0200
     4.3 @@ -114,6 +114,7 @@
     4.4  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Touches;
     4.5  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Within;
     4.6  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlAfterPeriod;
     4.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlBeforePeriod;
     4.8  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContainedBy;
     4.9  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContains;
    4.10  import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodIntersection;
    4.11 @@ -596,6 +597,21 @@
    4.12  		else if (expr instanceof GeneralDBSqlMbbEquals) {
    4.13  			append((GeneralDBSqlMbbEquals)expr, filter);
    4.14  		}
    4.15 +		else if(expr instanceof GeneralDBSqlAfterPeriod){
    4.16 +			append((GeneralDBSqlAfterPeriod)expr, filter);
    4.17 +		}
    4.18 +		else if(expr instanceof GeneralDBSqlBeforePeriod){
    4.19 +			append((GeneralDBSqlBeforePeriod)expr, filter);
    4.20 +		}
    4.21 +		else if(expr instanceof GeneralDBSqlPeriodContainedBy){
    4.22 +			append((GeneralDBSqlPeriodContainedBy)expr, filter);
    4.23 +		}
    4.24 +		else if(expr instanceof GeneralDBSqlPeriodContains){
    4.25 +			append((GeneralDBSqlPeriodContains)expr, filter);
    4.26 +		}
    4.27 +		else if(expr instanceof GeneralDBSqlPeriodOverlaps){
    4.28 +			append((GeneralDBSqlPeriodOverlaps)expr, filter);
    4.29 +		}
    4.30  		//GeoSPARQL
    4.31  		//Simple Features
    4.32  		else if (expr instanceof GeneralDBSqlSF_Contains) {
    4.33 @@ -704,6 +720,10 @@
    4.34  		}
    4.35  	}
    4.36  
    4.37 +	
    4.38 +
    4.39 +	
    4.40 +
    4.41  	protected void dispatchTripleSqlOperator(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter)
    4.42  			throws UnsupportedRdbmsOperatorException
    4.43  			{
    4.44 @@ -1231,7 +1251,7 @@
    4.45  	
    4.46  
    4.47  	//GeoSPARQL
    4.48 -	//XXX
    4.49 +	//XXX temporal Functions
    4.50  
    4.51  	protected abstract void appendRelate(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, char[] intersectionPattern)
    4.52  			throws UnsupportedRdbmsOperatorException;
    4.53 @@ -1239,50 +1259,37 @@
    4.54   * Postgres Temporal Functions 
    4.55   */
    4.56  
    4.57 -	protected void append(GeneralDBSqlPeriodContainedBy expr,
    4.58 +	protected abstract void append(GeneralDBSqlPeriodContainedBy expr,
    4.59  			GeneralDBSqlExprBuilder filter)
    4.60 -			throws UnsupportedRdbmsOperatorException {
    4.61 -				
    4.62 -	}
    4.63 +			throws UnsupportedRdbmsOperatorException;
    4.64  
    4.65 -protected void append(GeneralDBSqlPeriodContains expr,
    4.66 +protected abstract void append(GeneralDBSqlPeriodContains expr,
    4.67  		GeneralDBSqlExprBuilder filter)
    4.68 -		throws UnsupportedRdbmsOperatorException {
    4.69 -	
    4.70 -}
    4.71 +		throws UnsupportedRdbmsOperatorException;
    4.72  
    4.73 -protected void append(GeneralDBSqlPeriodIntersection expr,
    4.74 +protected abstract void append(GeneralDBSqlPeriodIntersection expr,
    4.75  		GeneralDBSqlExprBuilder filter)
    4.76 -		throws UnsupportedRdbmsOperatorException {
    4.77 -	
    4.78 -}
    4.79 +		throws UnsupportedRdbmsOperatorException;
    4.80  
    4.81 -protected void append(GeneralDBSqlPeriodMinus expr,
    4.82 +protected abstract void append(GeneralDBSqlPeriodMinus expr,
    4.83  		GeneralDBSqlExprBuilder filter)
    4.84 -		throws UnsupportedRdbmsOperatorException {
    4.85 -	
    4.86 -}
    4.87 +		throws UnsupportedRdbmsOperatorException;
    4.88  
    4.89 -protected void append(GeneralDBSqlPeriodOverlaps expr,
    4.90 +protected abstract void append(GeneralDBSqlPeriodOverlaps expr,
    4.91  		GeneralDBSqlExprBuilder filter)
    4.92 -		throws UnsupportedRdbmsOperatorException {
    4.93 -	
    4.94 -}
    4.95 +		throws UnsupportedRdbmsOperatorException;
    4.96  
    4.97 -protected void append(GeneralDBSqlPeriodUnion expr,
    4.98 +protected abstract void append(GeneralDBSqlPeriodUnion expr,
    4.99  		GeneralDBSqlExprBuilder filter)
   4.100 -		throws UnsupportedRdbmsOperatorException {
   4.101 -	
   4.102 -}
   4.103 +		throws UnsupportedRdbmsOperatorException;
   4.104  
   4.105 -protected void append(GeneralDBSqlTemporal expr, GeneralDBSqlExprBuilder filter)
   4.106 -		throws UnsupportedRdbmsOperatorException {
   4.107 -}
   4.108 +protected abstract void append(GeneralDBSqlAfterPeriod expr,
   4.109 +		GeneralDBSqlExprBuilder filter)
   4.110 +		throws UnsupportedRdbmsOperatorException;
   4.111  
   4.112 -protected void append(GeneralDBSqlAfterPeriod expr,
   4.113 +protected abstract void append(GeneralDBSqlBeforePeriod expr,
   4.114  		GeneralDBSqlExprBuilder filter)
   4.115 -		throws UnsupportedRdbmsOperatorException {
   4.116 -	
   4.117 -}
   4.118 +		throws UnsupportedRdbmsOperatorException;
   4.119 +
   4.120  
   4.121  }
     5.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Thu Nov 22 19:34:08 2012 +0200
     5.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Fri Nov 23 16:08:50 2012 +0200
     5.3 @@ -95,6 +95,14 @@
     5.4  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Overlaps;
     5.5  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Touches;
     5.6  import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Within;
     5.7 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlAfterPeriod;
     5.8 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlBeforePeriod;
     5.9 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContainedBy;
    5.10 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodContains;
    5.11 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodIntersection;
    5.12 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodMinus;
    5.13 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodOverlaps;
    5.14 +import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodUnion;
    5.15  import org.openrdf.sail.generaldb.evaluation.GeneralDBQueryBuilder;
    5.16  import org.openrdf.sail.generaldb.evaluation.GeneralDBSqlBracketBuilder;
    5.17  import org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder;
    5.18 @@ -2091,4 +2099,68 @@
    5.19  		
    5.20  	}
    5.21  
    5.22 +	@Override
    5.23 +	protected void append(GeneralDBSqlPeriodContainedBy expr,
    5.24 +			GeneralDBSqlExprBuilder filter)
    5.25 +			throws UnsupportedRdbmsOperatorException {
    5.26 +		// TODO Auto-generated method stub
    5.27 +		
    5.28 +	}
    5.29 +
    5.30 +	@Override
    5.31 +	protected void append(GeneralDBSqlPeriodContains expr,
    5.32 +			GeneralDBSqlExprBuilder filter)
    5.33 +			throws UnsupportedRdbmsOperatorException {
    5.34 +		// TODO Auto-generated method stub
    5.35 +		
    5.36 +	}
    5.37 +
    5.38 +	@Override
    5.39 +	protected void append(GeneralDBSqlPeriodIntersection expr,
    5.40 +			GeneralDBSqlExprBuilder filter)
    5.41 +			throws UnsupportedRdbmsOperatorException {
    5.42 +		// TODO Auto-generated method stub
    5.43 +		
    5.44 +	}
    5.45 +
    5.46 +	@Override
    5.47 +	protected void append(GeneralDBSqlPeriodMinus expr,
    5.48 +			GeneralDBSqlExprBuilder filter)
    5.49 +			throws UnsupportedRdbmsOperatorException {
    5.50 +		// TODO Auto-generated method stub
    5.51 +		
    5.52 +	}
    5.53 +
    5.54 +	@Override
    5.55 +	protected void append(GeneralDBSqlPeriodOverlaps expr,
    5.56 +			GeneralDBSqlExprBuilder filter)
    5.57 +			throws UnsupportedRdbmsOperatorException {
    5.58 +		// TODO Auto-generated method stub
    5.59 +		
    5.60 +	}
    5.61 +
    5.62 +	@Override
    5.63 +	protected void append(GeneralDBSqlPeriodUnion expr,
    5.64 +			GeneralDBSqlExprBuilder filter)
    5.65 +			throws UnsupportedRdbmsOperatorException {
    5.66 +		// TODO Auto-generated method stub
    5.67 +		
    5.68 +	}
    5.69 +
    5.70 +	@Override
    5.71 +	protected void append(GeneralDBSqlAfterPeriod expr,
    5.72 +			GeneralDBSqlExprBuilder filter)
    5.73 +			throws UnsupportedRdbmsOperatorException {
    5.74 +		// TODO Auto-generated method stub
    5.75 +		
    5.76 +	}
    5.77 +
    5.78 +	@Override
    5.79 +	protected void append(GeneralDBSqlBeforePeriod expr,
    5.80 +			GeneralDBSqlExprBuilder filter)
    5.81 +			throws UnsupportedRdbmsOperatorException {
    5.82 +		// TODO Auto-generated method stub
    5.83 +		
    5.84 +	}
    5.85 +
    5.86  }
    5.87 \ No newline at end of file
     6.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Thu Nov 22 19:34:08 2012 +0200
     6.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri Nov 23 16:08:50 2012 +0200
     6.3 @@ -985,7 +985,14 @@
     6.4  			{
     6.5  		appendGeneralDBTemporalFunctionBinary(expr, filter, expr.getOperator());
     6.6  			}
     6.7 -
     6.8 +	
     6.9 +	@Override
    6.10 +	protected void append(GeneralDBSqlBeforePeriod expr,
    6.11 +			GeneralDBSqlExprBuilder filter)
    6.12 +			throws UnsupportedRdbmsOperatorException {
    6.13 +		appendGeneralDBTemporalFunctionBinary(expr, filter, expr.getOperator());
    6.14 +		
    6.15 +	}
    6.16  	
    6.17  	@Override
    6.18  	protected void append(GeneralDBSqlPeriodIntersection expr, GeneralDBSqlExprBuilder filter)
    6.19 @@ -2523,4 +2530,6 @@
    6.20  		filter.closeBracket();
    6.21  			}
    6.22  
    6.23 +	
    6.24 +
    6.25  }